Skip to content

Commit

Permalink
clang format
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarker committed Dec 5, 2024
1 parent 3e15cce commit dc98669
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
3 changes: 1 addition & 2 deletions exporters/otlp/test/otlp_file_metric_exporter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ class OtlpFileMetricExporterTestPeer : public ::testing::Test
data.resource_ = &resource;

auto scope = opentelemetry::sdk::instrumentationscope::InstrumentationScope::Create(
"library_name", "1.5.0", "scope_url",
{{"scope_key", "scope_value"}});
"library_name", "1.5.0", "scope_url", {{"scope_key", "scope_value"}});

opentelemetry::sdk::metrics::MetricData metric_data{
opentelemetry::sdk::metrics::InstrumentDescriptor{
Expand Down
47 changes: 24 additions & 23 deletions exporters/otlp/test/otlp_metrics_serialization_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -307,37 +307,38 @@ TEST(OtlpMetricSerializationTest, ObservableUpDownCounter)

TEST(OtlpMetricSerializationTest, PopulateExportMetricsServiceRequest)
{
const auto resource = resource::Resource::Create({{"service.name", "test_service_name"}}, "resource_schema_url");
const auto scope = opentelemetry::sdk::instrumentationscope::InstrumentationScope::Create("scope_name", "scope_version", "scope_schema_url",
{{"scope_key", "scope_value"}});

metrics_sdk::ScopeMetrics scope_metrics{scope.get(), CreateSumAggregationData()};
metrics_sdk::ResourceMetrics resource_metrics{&resource, scope_metrics};

const auto resource =
resource::Resource::Create({{"service.name", "test_service_name"}}, "resource_schema_url");
const auto scope = opentelemetry::sdk::instrumentationscope::InstrumentationScope::Create(
"scope_name", "scope_version", "scope_schema_url", {{"scope_key", "scope_value"}});

metrics_sdk::ScopeMetrics scope_metrics{scope.get(), CreateSumAggregationData()};
metrics_sdk::ResourceMetrics resource_metrics{&resource, scope_metrics};

proto::collector::metrics::v1::ExportMetricsServiceRequest request_proto;
otlp_exporter::OtlpMetricUtils::PopulateRequest(resource_metrics, &request_proto);

ASSERT_EQ(1, request_proto.resource_metrics_size());
const auto& resource_metrics_proto = request_proto.resource_metrics(0);
const auto& resource_proto = resource_metrics_proto.resource();
EXPECT_EQ("resource_schema_url", resource_metrics_proto.schema_url());
ASSERT_EQ(1, request_proto.resource_metrics_size());
const auto &resource_metrics_proto = request_proto.resource_metrics(0);
const auto &resource_proto = resource_metrics_proto.resource();
EXPECT_EQ("resource_schema_url", resource_metrics_proto.schema_url());

ASSERT_EQ(1, resource_metrics_proto.scope_metrics_size());
const auto& scope_metrics_proto = resource_metrics_proto.scope_metrics(0);
const auto &scope_metrics_proto = resource_metrics_proto.scope_metrics(0);
EXPECT_EQ("scope_schema_url", scope_metrics_proto.schema_url());

ASSERT_EQ(1, scope_metrics_proto.metrics_size());
const auto& metric_proto = scope_metrics_proto.metrics(0);
EXPECT_EQ("Counter", metric_proto.name());
ASSERT_EQ(1, scope_metrics_proto.metrics_size());
const auto &metric_proto = scope_metrics_proto.metrics(0);
EXPECT_EQ("Counter", metric_proto.name());

const auto& scope_proto = scope_metrics_proto.scope();
EXPECT_EQ("scope_name", scope_proto.name());
EXPECT_EQ("scope_version", scope_proto.version());
const auto &scope_proto = scope_metrics_proto.scope();
EXPECT_EQ("scope_name", scope_proto.name());
EXPECT_EQ("scope_version", scope_proto.version());

ASSERT_EQ(1, scope_proto.attributes_size());
const auto& scope_attributes_proto = scope_proto.attributes(0);
EXPECT_EQ("scope_key", scope_attributes_proto.key());
EXPECT_EQ("scope_value", scope_attributes_proto.value().string_value());
ASSERT_EQ(1, scope_proto.attributes_size());
const auto &scope_attributes_proto = scope_proto.attributes(0);
EXPECT_EQ("scope_key", scope_attributes_proto.key());
EXPECT_EQ("scope_value", scope_attributes_proto.value().string_value());
}

} // namespace otlp
Expand Down

0 comments on commit dc98669

Please sign in to comment.