This is an automated email from the ASF dual-hosted git repository.

rawlin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new 55dde3c  Restores logging the cache status. (#6667)
55dde3c is described below

commit 55dde3cab1d9316dc590984fb51a4831bc40a377
Author: John J. Rushford <[email protected]>
AuthorDate: Wed Mar 30 10:27:13 2022 -0600

    Restores logging the cache status. (#6667)
    
    When the tc-health-client was switched to using the combined
    TM CrStates endpoint, the ability to log the cache status was
    lost, Issue #6448.  PR #6612 adds the cache status field to the
    TM CrStates endpoint allowing cache status to be logged again.
    This PR adds back the cache status logging.
---
 CHANGELOG.md                        |  1 +
 tc-health-client/tmagent/tmagent.go | 19 ++++---------------
 2 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 47e774f..6f1ebe6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@ The format is based on [Keep a 
Changelog](http://keepachangelog.com/en/1.0.0/).
 ## [unreleased]
 ### Added
 - [#6448](https://github.com/apache/trafficcontrol/issues/6448) Added `status` 
and `lastPoll` fields to the `publish/CrStates` endpoint of Traffic Monitor 
(TM).
+- Added back to the health-client the `status` field logging with the addition 
of the filed to `publish/CrStates`
 - Added a new Traffic Ops endpoint to `GET` capacity and telemetry data for 
CDNi integration.
 - Added a Traffic Ops endpoints to `PUT` a requested configuration change for 
a full configuration or per host and an endpoint to approve or deny the request.
 - Traffic Monitor config option `distributed_polling` which enables the 
ability for Traffic Monitor to poll a subset of the CDN and divide into "local 
peer groups" and "distributed peer groups". Traffic Monitors in the same group 
are local peers, while Traffic Monitors in other groups are distibuted peers. 
Each TM group polls the same set of cachegroups and gets availability data for 
the other cachegroups from other TM groups. This allows each TM to be 
responsible for polling a subset of [...]
diff --git a/tc-health-client/tmagent/tmagent.go 
b/tc-health-client/tmagent/tmagent.go
index 10206ef..bb4ebe0 100644
--- a/tc-health-client/tmagent/tmagent.go
+++ b/tc-health-client/tmagent/tmagent.go
@@ -353,11 +353,7 @@ func (c *ParentInfo) PollAndUpdateCacheStatus() {
                                        if !c.Cfg.EnableActiveMarkdowns && 
!tmAvailable {
                                                log.Infof("TM reports that %s 
is not available and should be marked DOWN but, mark downs are disabled by 
configuration", hostName)
                                        } else {
-                                               // See issue #6448, the status 
field used in api/cache-status is not
-                                               // available in the 
publish/CrStates endpoint.  For now, will not
-                                               // use it.
-                                               //if err = 
c.markParent(cs.Fqdn, *v.Status, tmAvailable); err != nil {
-                                               if err = c.markParent(cs.Fqdn, 
tmAvailable); err != nil {
+                                               if err = c.markParent(cs.Fqdn, 
v.Status, tmAvailable); err != nil {
                                                        log.Errorln(err.Error())
                                                }
                                        }
@@ -523,10 +519,7 @@ func (c *ParentInfo) execTrafficCtl(fqdn string, available 
bool) error {
 
 // used to mark a parent as up or down in the trafficserver HostStatus
 // subsystem.
-//
-// TODO see issue #6448, add cacheStatus back when available in CrStates
-//func (c *ParentInfo) markParent(fqdn string, cacheStatus string, available 
bool) error {
-func (c *ParentInfo) markParent(fqdn string, available bool) error {
+func (c *ParentInfo) markParent(fqdn string, cacheStatus string, available 
bool) error {
        var hostAvailable bool
        var err error
        hostName := parseFqdn(fqdn)
@@ -553,10 +546,8 @@ func (c *ParentInfo) markParent(fqdn string, available 
bool) error {
                                        log.Errorln(err.Error())
                                }
                                if err == nil {
-                                       // TODO see issue 6448, add cacheStatus 
back when available in CrStates
-                                       // log.Infof("marked parent %s DOWN, 
cache status was: %s\n", hostName, cacheStatus)
                                        hostAvailable = false
-                                       log.Infof("marked parent %s DOWN", 
hostName)
+                                       log.Infof("marked parent %s DOWN, cache 
status was: %s\n", hostName, cacheStatus)
                                }
                        }
                } else { // available
@@ -566,9 +557,7 @@ func (c *ParentInfo) markParent(fqdn string, available 
bool) error {
                                hostAvailable = true
                                // reset the unavilable poll count
                                unavailablePollCount = 0
-                               // TODO see issue #6448, add cacheStatus back 
when available in CrStates
-                               //log.Infof("marked parent %s UP, cache status 
was: %s\n", hostName, cacheStatus)
-                               log.Infof("marked parent %s UP", hostName)
+                               log.Infof("marked parent %s UP, cache status 
was: %s\n", hostName, cacheStatus)
                        } else {
                                hostAvailable = false
                        }

Reply via email to