소스 검색

HPCC-26765 Prometheus metric sink replaces invalid metric name char

- Replaces invalid '.' char in metric names

Signed-off-by: Rodrigo Pastrana <rodrigo.pastrana@lexisnexisrisk.com>
Rodrigo Pastrana 3 년 전
부모
커밋
2dc6ffec6a
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      system/metrics/sinks/prometheus/prometheusSink.cpp

+ 4 - 1
system/metrics/sinks/prometheus/prometheusSink.cpp

@@ -104,7 +104,10 @@ void PrometheusMetricSink::toPrometheusMetrics(const std::vector<std::shared_ptr
 
     for (auto &pMetric: reportMetrics)
     {
-        const std::string & name = pMetric->queryName();
+        std::string name = pMetric->queryName();
+
+        //'.' is a known char used in HPCC metric names but invalid in Prometheus
+        std::replace(name.begin(), name.end(), '.', '_');
         if (verbose)
         {
             if (!pMetric->queryDescription().empty())