diff --git a/exporters/otlp/src/otlp_metric_utils.cc b/exporters/otlp/src/otlp_metric_utils.cc index 35aaece190..521a7e2f10 100644 --- a/exporters/otlp/src/otlp_metric_utils.cc +++ b/exporters/otlp/src/otlp_metric_utils.cc @@ -254,7 +254,7 @@ void OtlpMetricUtils::PopulateResourceMetrics( proto::common::v1::InstrumentationScope *scope = scope_lib_metrics->mutable_scope(); scope->set_name(scope_metrics.scope_->GetName()); scope->set_version(scope_metrics.scope_->GetVersion()); - scope_lib_metrics->set_schema_url(scope_metrics.scope_->GetSchemaURL()); + scope_lib_metrics->set_schema_url(scope_metrics.scope_->GetSchemaURL()); OtlpPopulateAttributeUtils::PopulateAttribute(scope, *scope_metrics.scope_); diff --git a/exporters/otlp/test/otlp_file_exporter_test.cc b/exporters/otlp/test/otlp_file_exporter_test.cc index be7674f6eb..12fd41b9cd 100644 --- a/exporters/otlp/test/otlp_file_exporter_test.cc +++ b/exporters/otlp/test/otlp_file_exporter_test.cc @@ -70,7 +70,6 @@ static nostd::span MakeSpan(T (&array)[N]) class OtlpFileExporterTestPeer : public ::testing::Test { public: - void ExportJsonIntegrationTest() { static ProtobufGlobalSymbolGuard global_symbol_guard; @@ -109,12 +108,13 @@ class OtlpFileExporterTestPeer : public ::testing::Test new sdk::trace::TracerProvider(std::move(processor), resource)); std::string report_trace_id; - -#if OPENTELEMETRY_ABI_VERSION_NO >= 2 - auto tracer = provider->GetTracer("scope_name", "scope_version", "scope_url", {{"scope_key", "scope_value"}}); + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + auto tracer = provider->GetTracer("scope_name", "scope_version", "scope_url", + {{ "scope_key", + "scope_value" }}); #else - auto tracer = - provider->GetTracer("scope_name", "scope_version", "scope_url"); + auto tracer = provider->GetTracer("scope_name", "scope_version", "scope_url"); #endif auto parent_span = tracer->StartSpan("Test parent span"); @@ -146,19 +146,19 @@ class OtlpFileExporterTestPeer : public ::testing::Test { auto resource_span = *check_json["resourceSpans"].begin(); auto scope_span = *resource_span["scopeSpans"].begin(); - auto scope = scope_span["scope"]; + auto scope = scope_span["scope"]; auto span = *scope_span["spans"].begin(); - + #if OPENTELEMETRY_ABI_VERSION_NO >= 2 - ASSERT_EQ(1, scope["attributes"].size()); - const auto scope_attribute = scope["attributes"].front(); - EXPECT_EQ("scope_key", scope_attribute["key"].get()); - EXPECT_EQ("scope_value", scope_attribute["value"]["stringValue"].get()); + ASSERT_EQ(1, scope["attributes"].size()); + const auto scope_attribute = scope["attributes"].front(); + EXPECT_EQ("scope_key", scope_attribute["key"].get()); + EXPECT_EQ("scope_value", scope_attribute["value"]["stringValue"].get()); #endif - EXPECT_EQ("resource_url", resource_span["schemaUrl"].get()); - EXPECT_EQ("scope_url", scope_span["schemaUrl"].get()); - EXPECT_EQ("scope_name", scope["name"].get()); - EXPECT_EQ("scope_version", scope["version"].get()); + EXPECT_EQ("resource_url", resource_span["schemaUrl"].get()); + EXPECT_EQ("scope_url", scope_span["schemaUrl"].get()); + EXPECT_EQ("scope_name", scope["name"].get()); + EXPECT_EQ("scope_version", scope["version"].get()); EXPECT_EQ(report_trace_id, span["traceId"].get()); } else diff --git a/exporters/otlp/test/otlp_file_metric_exporter_test.cc b/exporters/otlp/test/otlp_file_metric_exporter_test.cc index 699d73e21d..3ee904daf5 100644 --- a/exporters/otlp/test/otlp_file_metric_exporter_test.cc +++ b/exporters/otlp/test/otlp_file_metric_exporter_test.cc @@ -92,8 +92,8 @@ class OtlpFileMetricExporterTestPeer : public ::testing::Test opentelemetry::sdk::resource::ResourceAttributes{}, resource_schema_url); data.resource_ = &resource; - const std::string instrumentation_scope_name{"library_name"}; - const std::string instrumentation_scope_version{"1.5.0"}; + const std::string instrumentation_scope_name{"library_name"}; + const std::string instrumentation_scope_version{"1.5.0"}; const std::string instrumentation_scope_schema_url{"https://opentelemetry.io/schemas/1.2.0"}; auto scope = opentelemetry::sdk::instrumentationscope::InstrumentationScope::Create( @@ -130,7 +130,6 @@ class OtlpFileMetricExporterTestPeer : public ::testing::Test auto resource_metrics = *check_json["resourceMetrics"].begin(); auto scope_metrics = *resource_metrics["scopeMetrics"].begin(); auto scope = scope_metrics["scope"]; - EXPECT_EQ(resource_schema_url, resource_metrics["schemaUrl"].get()); @@ -138,10 +137,9 @@ class OtlpFileMetricExporterTestPeer : public ::testing::Test EXPECT_EQ(instrumentation_scope_name, scope["name"].get()); EXPECT_EQ(instrumentation_scope_version, scope["version"].get()); ASSERT_EQ(1, scope["attributes"].size()); - const auto scope_attribute = scope["attributes"].front(); - EXPECT_EQ("scope_key", scope_attribute["key"].get()); - EXPECT_EQ("scope_value", scope_attribute["value"]["stringValue"].get()); - + const auto scope_attribute = scope["attributes"].front(); + EXPECT_EQ("scope_key", scope_attribute["key"].get()); + EXPECT_EQ("scope_value", scope_attribute["value"]["stringValue"].get()); auto metric = *scope_metrics["metrics"].begin(); EXPECT_EQ("metrics_library_name", metric["name"].get()); diff --git a/exporters/otlp/test/otlp_recordable_test.cc b/exporters/otlp/test/otlp_recordable_test.cc index 1b95298b29..0a58e52243 100644 --- a/exporters/otlp/test/otlp_recordable_test.cc +++ b/exporters/otlp/test/otlp_recordable_test.cc @@ -136,7 +136,7 @@ TEST(OtlpRecordable, SetInstrumentationScopeWithAttributes) ASSERT_EQ(proto_instr_libr.attributes_size(), 1); const auto &proto_attributes = proto_instr_libr.attributes(0); - ASSERT_TRUE(proto_attributes.value().has_string_value()); + ASSERT_TRUE(proto_attributes.value().has_string_value()); EXPECT_EQ("test_key", proto_attributes.key()); EXPECT_EQ("test_value", proto_attributes.value().string_value()); } @@ -346,7 +346,8 @@ TEST(OtlpRecordable, PopulateRequest) auto rec1 = std::unique_ptr(new OtlpRecordable); auto resource1 = resource::Resource::Create({{"service.name", "one"}}); rec1->SetResource(resource1); - auto inst_lib1 = trace_sdk::InstrumentationScope::Create("one", "1", "scope_schema", {{"scope_key", "scope_value"}}); + auto inst_lib1 = trace_sdk::InstrumentationScope::Create("one", "1", "scope_schema", + {{"scope_key", "scope_value"}}); rec1->SetInstrumentationScope(*inst_lib1); auto rec2 = std::unique_ptr(new OtlpRecordable); @@ -372,20 +373,20 @@ TEST(OtlpRecordable, PopulateRequest) EXPECT_EQ(req.resource_spans().size(), 2); for (const auto &resource_spans : req.resource_spans()) { - ASSERT_GT(resource_spans.resource().attributes_size(), 0); + ASSERT_GT(resource_spans.resource().attributes_size(), 0); const auto service_name = resource_spans.resource().attributes(0).value().string_value(); const auto scope_spans_size = resource_spans.scope_spans().size(); if (service_name == "one") { - ASSERT_GT(resource_spans.scope_spans_size(), 0); - const auto& scope_one = resource_spans.scope_spans(0).scope(); + ASSERT_GT(resource_spans.scope_spans_size(), 0); + const auto &scope_one = resource_spans.scope_spans(0).scope(); EXPECT_EQ(scope_spans_size, 1); EXPECT_EQ(scope_one.name(), "one"); EXPECT_EQ(scope_one.version(), "1"); ASSERT_EQ(scope_one.attributes_size(), 1); - const auto& scope_attribute = scope_one.attributes(0); + const auto &scope_attribute = scope_one.attributes(0); EXPECT_EQ(scope_attribute.key(), "scope_key"); EXPECT_EQ(scope_attribute.value().string_value(), "scope_value");