You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2020/04/17 21:06:44 UTC
[trafficserver] branch 8.1.x updated: Fixes the 'traffic_ctl host
status' command to correctly lookup next hop metrics and adds back the
automatic creation of parent host metrics when parent.config is read at
startup.
This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 8.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/8.1.x by this push:
new 89a369a Fixes the 'traffic_ctl host status' command to correctly lookup next hop metrics and adds back the automatic creation of parent host metrics when parent.config is read at startup.
89a369a is described below
commit 89a369a8787d4cb601791d3526ce447b8af44ac3
Author: John Rushford <jr...@apache.org>
AuthorDate: Fri Apr 17 16:22:41 2020 +0000
Fixes the 'traffic_ctl host status' command to correctly
lookup next hop metrics and adds back the automatic creation
of parent host metrics when parent.config is read at startup.
---
proxy/ParentSelection.cc | 3 +++
src/traffic_ctl/host.cc | 21 ++++++++-------------
2 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/proxy/ParentSelection.cc b/proxy/ParentSelection.cc
index 057a81e..217dab1 100644
--- a/proxy/ParentSelection.cc
+++ b/proxy/ParentSelection.cc
@@ -439,6 +439,7 @@ ParentRecord::ProcessParents(char *val, bool isPrimary)
char *tmp = nullptr, *tmp2 = nullptr, *tmp3 = nullptr;
const char *errPtr = nullptr;
float weight = 1.0;
+ HostStatus &hs = HostStatus::instance();
if (parents != nullptr && isPrimary == true) {
return "Can not specify more than one set of parents";
@@ -531,6 +532,7 @@ ParentRecord::ProcessParents(char *val, bool isPrimary)
this->parents[i].name = this->parents[i].hostname;
this->parents[i].available = true;
this->parents[i].weight = weight;
+ hs.createHostStat(this->parents[i].hostname);
if (tmp3) {
memcpy(this->parents[i].hash_string, tmp3 + 1, strlen(tmp3));
this->parents[i].name = this->parents[i].hash_string;
@@ -546,6 +548,7 @@ ParentRecord::ProcessParents(char *val, bool isPrimary)
this->secondary_parents[i].name = this->secondary_parents[i].hostname;
this->secondary_parents[i].available = true;
this->secondary_parents[i].weight = weight;
+ hs.createHostStat(this->secondary_parents[i].hostname);
if (tmp3) {
memcpy(this->secondary_parents[i].hash_string, tmp3 + 1, strlen(tmp3));
this->secondary_parents[i].name = this->secondary_parents[i].hash_string;
diff --git a/src/traffic_ctl/host.cc b/src/traffic_ctl/host.cc
index c74e7d2..659b03b 100644
--- a/src/traffic_ctl/host.cc
+++ b/src/traffic_ctl/host.cc
@@ -35,19 +35,14 @@ status_get(unsigned argc, const char **argv)
for (unsigned i = 0; i < n_file_arguments; ++i) {
CtrlMgmtRecord record;
TSMgmtError error;
- std::string str = stat_prefix + file_arguments[i];
-
- for (const char *_reason_tag : Reason::reasons) {
- std::string _stat = str + "_" + _reason_tag;
- error = record.fetch(_stat.c_str());
- if (error != TS_ERR_OKAY) {
- CtrlMgmtError(error, "failed to fetch %s", file_arguments[i]);
- return CTRL_EX_ERROR;
- }
-
- if (REC_TYPE_IS_STAT(record.rclass())) {
- printf("%s %s\n", record.name(), CtrlMgmtRecordValue(record).c_str());
- }
+ std::string _stat = stat_prefix + file_arguments[i];
+ error = record.fetch(_stat.c_str());
+ if (error != TS_ERR_OKAY) {
+ fprintf(stderr, "failed to fetch %s, no record found\n", file_arguments[i]);
+ return CTRL_EX_ERROR;
+ }
+ if (REC_TYPE_IS_STAT(record.rclass())) {
+ printf("%s %s\n", record.name(), CtrlMgmtRecordValue(record).c_str());
}
}