From 66c9c73fa104d33ab5759a266ae22cd3a6626d37 Mon Sep 17 00:00:00 2001 From: Pranav Sharma Date: Wed, 16 Oct 2024 20:55:48 +0000 Subject: [PATCH] Fix handling of without_type_suffix with gauges --- exporters/prometheus/src/exporter_utils.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/exporters/prometheus/src/exporter_utils.cc b/exporters/prometheus/src/exporter_utils.cc index cfbce8cd79..ab8fd47909 100644 --- a/exporters/prometheus/src/exporter_utils.cc +++ b/exporters/prometheus/src/exporter_utils.cc @@ -530,8 +530,9 @@ std::string PrometheusExporterUtils::MapToPrometheusName( // Special case - gauge if (unit == "1" && prometheus_type == prometheus_client::MetricType::Gauge && - sanitized_name.find("ratio") == std::string::npos && !without_type_suffix) + sanitized_name.find("ratio") == std::string::npos && !without_units) { + // this is replacing the unit name sanitized_name += "_ratio"; }