Yan-Daojiang has uploaded this change for review. ( 
http://gerrit.cloudera.org:8080/24121


Change subject: [metrics] Export hostname as a Prometheus label when entity 
labels are enabled
......................................................................

[metrics] Export hostname as a Prometheus label when entity labels are enabled

In https://gerrit.cloudera.org/c/24096/ we enabled exporting entity
attributes as Prometheus labels via --metrics_prometheus_use_entity_labels.
However, when Prometheus scrapes multiple Kudu nodes, there is no label
to identify the source node.

This patch adds a 'hostname' label to each metric, allowing the source
node to be identified without relying on Prometheus relabel_configs.

Changes:
- Add 'hostname' field to MetricPrometheusOptions; pass it from
  ServerBase::Start() via messenger_->hostname() through the handler
  chain into MetricEntity::WriteAsPrometheus(), where it is appended
  as a label when the entity-labels flag is on and hostname is non-empty.
- Add three unit tests covering: hostname label present (flag on),
  no effect in legacy mode (flag off), and empty hostname (no label).

Change-Id: I43b4c8ea5736e99c20b25a2ffea3c6c8dcb9d27e
---
M src/kudu/master/master.cc
M src/kudu/server/default_path_handlers.cc
M src/kudu/server/default_path_handlers.h
M src/kudu/server/server_base.cc
M src/kudu/util/metrics-test.cc
M src/kudu/util/metrics.cc
M src/kudu/util/metrics.h
7 files changed, 118 insertions(+), 7 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/21/24121/1
--
To view, visit http://gerrit.cloudera.org:8080/24121
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I43b4c8ea5736e99c20b25a2ffea3c6c8dcb9d27e
Gerrit-Change-Number: 24121
Gerrit-PatchSet: 1
Gerrit-Owner: Yan-Daojiang <[email protected]>

Reply via email to