From c178713f86c64c4458e158f0cd3fe7aa17f87322 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Tue, 26 Sep 2023 00:51:34 +0000 Subject: [PATCH] format --- .../exporters/prometheus/exporter_utils.h | 3 ++- exporters/prometheus/src/exporter_utils.cc | 12 ++++++++---- .../prometheus/test/exporter_utils_test.cc | 17 ++++++++++++----- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/exporters/prometheus/include/opentelemetry/exporters/prometheus/exporter_utils.h b/exporters/prometheus/include/opentelemetry/exporters/prometheus/exporter_utils.h index a614d04b86..5297357adf 100644 --- a/exporters/prometheus/include/opentelemetry/exporters/prometheus/exporter_utils.h +++ b/exporters/prometheus/include/opentelemetry/exporters/prometheus/exporter_utils.h @@ -76,7 +76,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 eef184b5bf..a9b8ddd6f6 100644 --- a/exporters/prometheus/src/exporter_utils.cc +++ b/exporters/prometheus/src/exporter_utils.cc @@ -85,14 +85,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 { @@ -108,7 +110,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 { @@ -263,7 +266,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 4df12e05cf..b55e208d47 100644 --- a/exporters/prometheus/test/exporter_utils_test.cc +++ b/exporters/prometheus/test/exporter_utils_test.cc @@ -189,20 +189,27 @@ 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