diff --git a/exporters/prometheus/include/opentelemetry/exporters/prometheus/exporter_utils.h b/exporters/prometheus/include/opentelemetry/exporters/prometheus/exporter_utils.h index 21b83d675f..76c62d58ba 100644 --- a/exporters/prometheus/include/opentelemetry/exporters/prometheus/exporter_utils.h +++ b/exporters/prometheus/include/opentelemetry/exporters/prometheus/exporter_utils.h @@ -67,7 +67,8 @@ class PrometheusExporterUtils /** * Set time and labels to metric data */ - static void SetMetricBasic(::prometheus::ClientMetric &metric, + static void SetMetricBasic( + ::prometheus::ClientMetric &metric, const opentelemetry::sdk::metrics::PointAttributes &labels, const opentelemetry::sdk::instrumentationscope::InstrumentationScope *scope); diff --git a/exporters/prometheus/src/exporter_utils.cc b/exporters/prometheus/src/exporter_utils.cc index eed158c1af..c0f034ffe5 100644 --- a/exporters/prometheus/src/exporter_utils.cc +++ b/exporters/prometheus/src/exporter_utils.cc @@ -164,14 +164,16 @@ std::vector PrometheusExporterUtils::TranslateT auto last_value_point_data = nostd::get(point_data_attr.point_data); std::vector values{last_value_point_data.value_}; - SetData(values, point_data_attr.attributes, instrumentation_info.scope_, type, &metric_family); + SetData(values, point_data_attr.attributes, instrumentation_info.scope_, type, + &metric_family); } else if (nostd::holds_alternative(point_data_attr.point_data)) { auto sum_point_data = nostd::get(point_data_attr.point_data); std::vector values{sum_point_data.value_}; - SetData(values, point_data_attr.attributes, instrumentation_info.scope_, type, &metric_family); + SetData(values, point_data_attr.attributes, instrumentation_info.scope_, type, + &metric_family); } else { @@ -187,7 +189,8 @@ std::vector PrometheusExporterUtils::TranslateT auto sum_point_data = nostd::get(point_data_attr.point_data); std::vector values{sum_point_data.value_}; - SetData(values, point_data_attr.attributes, instrumentation_info.scope_, type, &metric_family); + SetData(values, point_data_attr.attributes, instrumentation_info.scope_, type, + &metric_family); } else { @@ -296,7 +299,8 @@ void PrometheusExporterUtils::SetData( /** * Set labels to metric data */ -void PrometheusExporterUtils::SetMetricBasic(prometheus_client::ClientMetric &metric, +void PrometheusExporterUtils::SetMetricBasic( + prometheus_client::ClientMetric &metric, const metric_sdk::PointAttributes &labels, const opentelemetry::sdk::instrumentationscope::InstrumentationScope *scope) { diff --git a/exporters/prometheus/test/exporter_utils_test.cc b/exporters/prometheus/test/exporter_utils_test.cc index f24e5e3336..3c945c6735 100644 --- a/exporters/prometheus/test/exporter_utils_test.cc +++ b/exporters/prometheus/test/exporter_utils_test.cc @@ -211,20 +211,26 @@ class AttributeCollisionTest : public ::testing::Test TEST_F(AttributeCollisionTest, SeparatesDistinctKeys) { - CheckTranslation({{"foo.a", "value1"}, {"foo.b", "value2"}}, - {{"foo_a", "value1"}, {"foo_b", "value2"}, {"otel_scope_name", "library_name"}, {"otel_scope_version", "1.2.0"}}); + CheckTranslation({{"foo.a", "value1"}, {"foo.b", "value2"}}, {{"foo_a", "value1"}, + {"foo_b", "value2"}, + {"otel_scope_name", "library_name"}, + {"otel_scope_version", "1.2.0"}}); } TEST_F(AttributeCollisionTest, JoinsCollidingKeys) { - CheckTranslation({{"foo.a", "value1"}, {"foo_a", "value2"}}, // - {{"foo_a", "value1;value2"}, {"otel_scope_name", "library_name"}, {"otel_scope_version", "1.2.0"}}); + CheckTranslation({{"foo.a", "value1"}, {"foo_a", "value2"}}, {{"foo_a", "value1;value2"}, + {"otel_scope_name", "library_name"}, + {"otel_scope_version", "1.2.0"}}); } TEST_F(AttributeCollisionTest, DropsInvertedKeys) { CheckTranslation({{"foo.a", "value1"}, {"foo.b", "value2"}, {"foo__a", "value3"}}, - {{"foo_a", "value1"}, {"foo_b", "value2"}, {"otel_scope_name", "library_name"}, {"otel_scope_version", "1.2.0"}}); + {{"foo_a", "value1"}, + {"foo_b", "value2"}, + {"otel_scope_name", "library_name"}, + {"otel_scope_version", "1.2.0"}}); } OPENTELEMETRY_END_NAMESPACE