From b20642409d1e803cdae37389e25f6298c5b7521e Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Tue, 31 Jan 2023 17:34:12 -0800 Subject: [PATCH 01/10] add benchmark for sum aggregation --- .../histogram_aggregation_benchmark.cc | 40 +++++- sdk/test/metrics/sum_aggregation_benchmark.cc | 122 ++++++++++++++++++ 2 files changed, 160 insertions(+), 2 deletions(-) create mode 100644 sdk/test/metrics/sum_aggregation_benchmark.cc diff --git a/sdk/test/metrics/histogram_aggregation_benchmark.cc b/sdk/test/metrics/histogram_aggregation_benchmark.cc index 41ac2379ca..72fb1aef67 100644 --- a/sdk/test/metrics/histogram_aggregation_benchmark.cc +++ b/sdk/test/metrics/histogram_aggregation_benchmark.cc @@ -73,12 +73,48 @@ void BM_HistogramAggregation(benchmark::State &state) auto h = m->CreateDoubleHistogram("histogram1", "histogram1_description", "histogram1_unit"); std::default_random_engine generator; std::uniform_int_distribution distribution(0, 1000000); + // Generate 100000 measurements + constexpr size_t TOTAL_MEASUREMENTS = 100000; + double measurements[TOTAL_MEASUREMENTS]; + for (size_t i = 0; i < TOTAL_MEASUREMENTS; i++) + { + measurements[i] = (double)distribution(generator); + } + std::vector actuals; + std::vector collectionThreads; + std::function collectMetrics = [&reader, &actuals, &TOTAL_MEASUREMENTS]() { + reader->Collect([&](ResourceMetrics &rm) { + for (const ScopeMetrics &smd : rm.scope_metric_data_) + { + for (const MetricData &md : smd.metric_data_) + { + for (const PointDataAttributes &dp : md.point_data_attr_) + { + actuals.push_back(opentelemetry::nostd::get(dp.point_data)); + } + } + } + return true; + }); + }; + while (state.KeepRunning()) { - auto value = (double)distribution(generator); - h->Record(value, {}); + for (size_t i = 0; i < TOTAL_MEASUREMENTS; i++) + { + h->Record(measurements[i], {}); + if (i % 1000 == 0 || i == TOTAL_MEASUREMENTS - 1) + { + collectMetrics(); + if (i == 100) + { + std::this_thread::sleep_for(std::chrono::nanoseconds(4)); + } + } + } } } + BENCHMARK(BM_HistogramAggregation); } // namespace diff --git a/sdk/test/metrics/sum_aggregation_benchmark.cc b/sdk/test/metrics/sum_aggregation_benchmark.cc new file mode 100644 index 0000000000..a80168f25e --- /dev/null +++ b/sdk/test/metrics/sum_aggregation_benchmark.cc @@ -0,0 +1,122 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +#include + +#include "opentelemetry/sdk/metrics/data/point_data.h" +#include "opentelemetry/sdk/metrics/meter.h" +#include "opentelemetry/sdk/metrics/meter_context.h" +#include "opentelemetry/sdk/metrics/meter_provider.h" +#include "opentelemetry/sdk/metrics/metric_reader.h" +#include "opentelemetry/sdk/metrics/push_metric_exporter.h" + +#include +#include + +using namespace opentelemetry; +using namespace opentelemetry::sdk::instrumentationscope; +using namespace opentelemetry::sdk::metrics; + +class MockMetricExporter : public PushMetricExporter +{ +public: + MockMetricExporter() = default; + opentelemetry::sdk::common::ExportResult Export( + const ResourceMetrics & /* records */) noexcept override + { + return opentelemetry::sdk::common::ExportResult::kSuccess; + } + + AggregationTemporality GetAggregationTemporality( + InstrumentType /* instrument_type */) const noexcept override + { + return AggregationTemporality::kCumulative; + } + + bool ForceFlush(std::chrono::microseconds /* timeout */) noexcept override { return true; } + + bool Shutdown(std::chrono::microseconds /* timeout */) noexcept override { return true; } +}; + +class MockMetricReader : public MetricReader +{ +public: + MockMetricReader(std::unique_ptr exporter) : exporter_(std::move(exporter)) {} + AggregationTemporality GetAggregationTemporality( + InstrumentType instrument_type) const noexcept override + { + return exporter_->GetAggregationTemporality(instrument_type); + } + virtual bool OnForceFlush(std::chrono::microseconds /* timeout */) noexcept override + { + return true; + } + virtual bool OnShutDown(std::chrono::microseconds /* timeout */) noexcept override + { + return true; + } + virtual void OnInitialized() noexcept override {} + +private: + std::unique_ptr exporter_; +}; + +namespace +{ +void BM_SumAggregation(benchmark::State &state) +{ + MeterProvider mp; + auto m = mp.GetMeter("meter1", "version1", "schema1"); + + std::unique_ptr exporter(new MockMetricExporter()); + std::shared_ptr reader{new MockMetricReader(std::move(exporter))}; + mp.AddMetricReader(reader); + auto h = m->CreateDoubleCounter("counter1", "counter1_description", "counter1_unit"); + std::default_random_engine generator; + std::uniform_int_distribution distribution(0, 1000000); + // Generate 100000 measurements + constexpr size_t TOTAL_MEASUREMENTS = 100000; + double measurements[TOTAL_MEASUREMENTS]; + for (size_t i = 0; i < TOTAL_MEASUREMENTS; i++) + { + measurements[i] = (double)distribution(generator); + } + std::vector actuals; + std::vector collectionThreads; + std::function collectMetrics = [&reader, &actuals, &TOTAL_MEASUREMENTS]() { + reader->Collect([&](ResourceMetrics &rm) { + for (const ScopeMetrics &smd : rm.scope_metric_data_) + { + for (const MetricData &md : smd.metric_data_) + { + for (const PointDataAttributes &dp : md.point_data_attr_) + { + actuals.push_back(opentelemetry::nostd::get(dp.point_data)); + } + } + } + return true; + }); + }; + + while (state.KeepRunning()) + { + for (size_t i = 0; i < TOTAL_MEASUREMENTS; i++) + { + h->Add(measurements[i], {}); + if (i % 1000 == 0 || i == TOTAL_MEASUREMENTS - 1) + { + collectMetrics(); + if (i == 100) + { + std::this_thread::sleep_for(std::chrono::nanoseconds(4)); + } + } + } + } +} + +BENCHMARK(BM_SumAggregation); + +} // namespace +BENCHMARK_MAIN(); From 54d85c6d9cf9f0755805b43b78da7bc48eb274b9 Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Tue, 31 Jan 2023 19:45:47 -0800 Subject: [PATCH 02/10] fix --- sdk/test/metrics/histogram_aggregation_benchmark.cc | 8 ++++---- sdk/test/metrics/sum_aggregation_benchmark.cc | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sdk/test/metrics/histogram_aggregation_benchmark.cc b/sdk/test/metrics/histogram_aggregation_benchmark.cc index 72fb1aef67..af6dee6c41 100644 --- a/sdk/test/metrics/histogram_aggregation_benchmark.cc +++ b/sdk/test/metrics/histogram_aggregation_benchmark.cc @@ -106,10 +106,10 @@ void BM_HistogramAggregation(benchmark::State &state) if (i % 1000 == 0 || i == TOTAL_MEASUREMENTS - 1) { collectMetrics(); - if (i == 100) - { - std::this_thread::sleep_for(std::chrono::nanoseconds(4)); - } + } + if (i == 100) + { + std::this_thread::sleep_for(std::chrono::nanoseconds(4)); } } } diff --git a/sdk/test/metrics/sum_aggregation_benchmark.cc b/sdk/test/metrics/sum_aggregation_benchmark.cc index a80168f25e..ef4355340e 100644 --- a/sdk/test/metrics/sum_aggregation_benchmark.cc +++ b/sdk/test/metrics/sum_aggregation_benchmark.cc @@ -107,10 +107,10 @@ void BM_SumAggregation(benchmark::State &state) if (i % 1000 == 0 || i == TOTAL_MEASUREMENTS - 1) { collectMetrics(); - if (i == 100) - { - std::this_thread::sleep_for(std::chrono::nanoseconds(4)); - } + } + if (i == 500) + { + std::this_thread::sleep_for(std::chrono::nanoseconds(2)); } } } From a801f6ddea326028cce2cf149f4fb6a6ace4baa5 Mon Sep 17 00:00:00 2001 From: Lalit Date: Tue, 31 Jan 2023 22:55:22 -0800 Subject: [PATCH 03/10] sum aggregation --- sdk/test/metrics/BUILD | 49 +++++++++++++ sdk/test/metrics/CMakeLists.txt | 23 ++++++- sdk/test/metrics/async_metric_storage_test.cc | 26 ++----- sdk/test/metrics/common.cc | 68 +++++++++++++++++++ sdk/test/metrics/common.h | 60 ++++++++++++++++ .../histogram_aggregation_benchmark.cc | 47 +------------ .../metrics/histogram_aggregation_test.cc | 45 +----------- sdk/test/metrics/histogram_test.cc | 46 +------------ sdk/test/metrics/meter_provider_sdk_test.cc | 47 +------------ sdk/test/metrics/meter_test.cc | 18 +---- sdk/test/metrics/metric_reader_test.cc | 24 +------ sdk/test/metrics/sum_aggregation_benchmark.cc | 47 +------------ sdk/test/metrics/sum_aggregation_test.cc | 46 +------------ .../sync_metric_storage_counter_test.cc | 19 +----- .../sync_metric_storage_histogram_test.cc | 21 +----- ...ync_metric_storage_up_down_counter_test.cc | 19 +----- 16 files changed, 226 insertions(+), 379 deletions(-) create mode 100644 sdk/test/metrics/common.cc create mode 100644 sdk/test/metrics/common.h diff --git a/sdk/test/metrics/BUILD b/sdk/test/metrics/BUILD index b554dd0a6f..4a9d3582af 100644 --- a/sdk/test/metrics/BUILD +++ b/sdk/test/metrics/BUILD @@ -1,5 +1,19 @@ load("//bazel:otel_cc_benchmark.bzl", "otel_cc_benchmark") +cc_test( + name = "metrics_common_test_utils", + srcs = [ + "common.cc", + ], + tags = [ + "metrics", + "test", + ], + deps = [ + "//sdk/src/metrics", + ], +) + cc_test( name = "meter_test", srcs = [ @@ -10,6 +24,7 @@ cc_test( "test", ], deps = [ + "metrics_common_test_utils", "//sdk/src/metrics", "@com_google_googletest//:gtest_main", ], @@ -25,6 +40,7 @@ cc_test( "test", ], deps = [ + "metrics_common_test_utils", "//sdk/src/metrics", "//sdk/src/resource", "@com_google_googletest//:gtest_main", @@ -41,6 +57,7 @@ cc_test( "test", ], deps = [ + "metrics_common_test_utils", "//sdk/src/metrics", "//sdk/src/resource", "@com_google_googletest//:gtest_main", @@ -57,6 +74,7 @@ cc_test( "test", ], deps = [ + "metrics_common_test_utils", "//sdk/src/metrics", "//sdk/src/resource", "@com_google_googletest//:gtest_main", @@ -73,6 +91,7 @@ cc_test( "test", ], deps = [ + "metrics_common_test_utils", "//sdk/src/metrics", "//sdk/src/resource", "@com_google_googletest//:gtest_main", @@ -89,6 +108,7 @@ cc_test( "test", ], deps = [ + "metrics_common_test_utils", "//sdk/src/metrics", "//sdk/src/resource", "@com_google_googletest//:gtest_main", @@ -105,6 +125,7 @@ cc_test( "test", ], deps = [ + "metrics_common_test_utils", "//sdk/src/metrics", "//sdk/src/resource", "@com_google_googletest//:gtest_main", @@ -121,6 +142,7 @@ cc_test( "test", ], deps = [ + "metrics_common_test_utils", "//sdk/src/metrics", "//sdk/src/resource", "@com_google_googletest//:gtest_main", @@ -184,6 +206,7 @@ cc_test( "test", ], deps = [ + "metrics_common_test_utils", "//sdk/src/metrics", "//sdk/src/resource", "@com_google_googletest//:gtest_main", @@ -200,6 +223,7 @@ cc_test( "test", ], deps = [ + "metrics_common_test_utils", "//sdk/src/metrics", "//sdk/src/resource", "@com_google_googletest//:gtest_main", @@ -216,6 +240,7 @@ cc_test( "test", ], deps = [ + "metrics_common_test_utils", "//sdk/src/metrics", "//sdk/src/resource", "@com_google_googletest//:gtest_main", @@ -232,6 +257,7 @@ cc_test( "test", ], deps = [ + "metrics_common_test_utils", "//sdk/src/metrics", "@com_google_googletest//:gtest_main", ], @@ -247,6 +273,7 @@ cc_test( "test", ], deps = [ + "metrics_common_test_utils", "//sdk/src/metrics", "@com_google_googletest//:gtest_main", ], @@ -262,6 +289,7 @@ cc_test( "test", ], deps = [ + "metrics_common_test_utils", "//sdk/src/metrics", "@com_google_googletest//:gtest_main", ], @@ -277,6 +305,7 @@ cc_test( "test", ], deps = [ + "metrics_common_test_utils", "//sdk/src/metrics", "@com_google_googletest//:gtest_main", ], @@ -286,6 +315,7 @@ otel_cc_benchmark( name = "attributes_processor_benchmark", srcs = [ "attributes_processor_benchmark.cc", + "metrics_common_test_utils", ], tags = [ "benchmark", @@ -301,6 +331,7 @@ otel_cc_benchmark( name = "attributes_hashmap_benchmark", srcs = [ "attributes_hashmap_benchmark.cc", + "metrics_common_test_utils", ], tags = [ "benchmark", @@ -316,6 +347,24 @@ otel_cc_benchmark( name = "histogram_aggregation_benchmark", srcs = [ "histogram_aggregation_benchmark.cc", + "metrics_common_test_utils", + ], + tags = [ + "benchmark", + "metrics", + "test", + ], + deps = [ + "//sdk/src/metrics", + "//sdk/src/resource", + ], +) + +otel_cc_benchmark( + name = "sum_aggregation_benchmark", + srcs = [ + "metrics_common_test_utils", + "sum_aggregation_benchmark.cc", ], tags = [ "benchmark", diff --git a/sdk/test/metrics/CMakeLists.txt b/sdk/test/metrics/CMakeLists.txt index 97658217d7..e1c498b5a4 100644 --- a/sdk/test/metrics/CMakeLists.txt +++ b/sdk/test/metrics/CMakeLists.txt @@ -1,3 +1,6 @@ +add_library(metrics_common_test_utils common.cc) +target_link_libraries(metrics_common_test_utils opentelemetry_metrics) + foreach( testname meter_provider_sdk_test @@ -24,7 +27,7 @@ foreach( add_executable(${testname} "${testname}.cc") target_link_libraries( ${testname} ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} - opentelemetry_resources opentelemetry_metrics) + metrics_common_test_utils opentelemetry_resources opentelemetry_metrics) gtest_add_tests( TARGET ${testname} TEST_PREFIX metrics. @@ -44,8 +47,22 @@ if(WITH_BENCHMARK) add_executable(histogram_aggregation_benchmark histogram_aggregation_benchmark.cc) target_link_libraries( - histogram_aggregation_benchmark benchmark::benchmark - ${CMAKE_THREAD_LIBS_INIT} opentelemetry_common opentelemetry_metrics + histogram_aggregation_benchmark + benchmark::benchmark + ${CMAKE_THREAD_LIBS_INIT} + metrics_common_test_utils + opentelemetry_common + opentelemetry_metrics + opentelemetry_resources) + + add_executable(sum_aggregation_benchmark sum_aggregation_benchmark.cc) + target_link_libraries( + sum_aggregation_benchmark + benchmark::benchmark + ${CMAKE_THREAD_LIBS_INIT} + metrics_common_test_utils + opentelemetry_common + opentelemetry_metrics opentelemetry_resources) endif() diff --git a/sdk/test/metrics/async_metric_storage_test.cc b/sdk/test/metrics/async_metric_storage_test.cc index f56a403862..0ce91dafe1 100644 --- a/sdk/test/metrics/async_metric_storage_test.cc +++ b/sdk/test/metrics/async_metric_storage_test.cc @@ -1,8 +1,8 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "opentelemetry/sdk/metrics/state/async_metric_storage.h" -#include +#include "common.h" + #include "opentelemetry/common/key_value_iterable_view.h" #include "opentelemetry/sdk/metrics/async_instruments.h" #include "opentelemetry/sdk/metrics/instruments.h" @@ -10,38 +10,22 @@ #include "opentelemetry/sdk/metrics/metric_reader.h" #include "opentelemetry/sdk/metrics/observer_result.h" #include "opentelemetry/sdk/metrics/push_metric_exporter.h" +#include "opentelemetry/sdk/metrics/state/async_metric_storage.h" #include "opentelemetry/sdk/metrics/state/metric_collector.h" #include "opentelemetry/sdk/metrics/state/observable_registry.h" #include +#include #include #include using namespace opentelemetry::sdk::metrics; using namespace opentelemetry::sdk::instrumentationscope; using namespace opentelemetry::sdk::resource; - -using namespace opentelemetry::sdk::metrics; using namespace opentelemetry::common; -using M = std::map; namespace nostd = opentelemetry::nostd; -class MockCollectorHandle : public CollectorHandle -{ -public: - MockCollectorHandle(AggregationTemporality temp) : temporality(temp) {} - - ~MockCollectorHandle() override = default; - - AggregationTemporality GetAggregationTemporality( - InstrumentType /* instrument_type */) noexcept override - { - return temporality; - } - -private: - AggregationTemporality temporality; -}; +using M = std::map; class WritableMetricStorageTestFixture : public ::testing::TestWithParam {}; diff --git a/sdk/test/metrics/common.cc b/sdk/test/metrics/common.cc new file mode 100644 index 0000000000..87343f6186 --- /dev/null +++ b/sdk/test/metrics/common.cc @@ -0,0 +1,68 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +#include "common.h" + +using namespace opentelemetry; +using namespace opentelemetry::sdk::instrumentationscope; +using namespace opentelemetry::sdk::metrics; +using namespace opentelemetry::sdk::common; + +// MockMetricExporter + +ExportResult MockMetricExporter::Export(const ResourceMetrics & /*resource_metrics*/) noexcept +{ + return ExportResult::kSuccess; +} + +AggregationTemporality MockMetricExporter::GetAggregationTemporality( + InstrumentType /*instrument_type*/) const noexcept +{ + return AggregationTemporality::kCumulative; +} + +bool MockMetricExporter::ForceFlush(std::chrono::microseconds /* timeout */) noexcept +{ + return true; +} + +bool MockMetricExporter::Shutdown(std::chrono::microseconds /* timeout */) noexcept +{ + return true; +} + +// MockMetricReader +MockMetricReader::MockMetricReader(std::unique_ptr exporter) + : exporter_(std::move(exporter)) +{} + +MockMetricReader::MockMetricReader() : exporter_{new MockMetricExporter()} {} + +AggregationTemporality MockMetricReader::GetAggregationTemporality( + InstrumentType instrument_type) const noexcept + +{ + return exporter_->GetAggregationTemporality(instrument_type); +} + +bool MockMetricReader::OnForceFlush(std::chrono::microseconds /* timeout */) noexcept +{ + return true; +} + +bool MockMetricReader::OnShutDown(std::chrono::microseconds /* timeout */) noexcept +{ + return true; +} + +void MockMetricReader::OnInitialized() noexcept {} + +// MockCollectorHandle + +MockCollectorHandle::MockCollectorHandle(AggregationTemporality temp) : temporality_(temp) {} + +AggregationTemporality MockCollectorHandle::GetAggregationTemporality( + InstrumentType /* instrument_type */) noexcept +{ + return temporality_; +} diff --git a/sdk/test/metrics/common.h b/sdk/test/metrics/common.h new file mode 100644 index 0000000000..9a98e446dd --- /dev/null +++ b/sdk/test/metrics/common.h @@ -0,0 +1,60 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +#pragma once + +#include "opentelemetry/sdk/metrics/data/point_data.h" +#include "opentelemetry/sdk/metrics/metric_reader.h" +#include "opentelemetry/sdk/metrics/push_metric_exporter.h" +#include "opentelemetry/sdk/metrics/state/metric_collector.h" + +#include + +class MockMetricExporter : public opentelemetry::sdk::metrics::PushMetricExporter +{ +public: + MockMetricExporter() = default; + opentelemetry::sdk::common::ExportResult Export( + const opentelemetry::sdk::metrics::ResourceMetrics &) noexcept override; + + opentelemetry::sdk::metrics::AggregationTemporality GetAggregationTemporality( + opentelemetry::sdk::metrics::InstrumentType) const noexcept override; + + bool ForceFlush(std::chrono::microseconds) noexcept override; + + bool Shutdown(std::chrono::microseconds) noexcept override; +}; + +class MockMetricReader : public opentelemetry::sdk::metrics::MetricReader +{ +public: + MockMetricReader(std::unique_ptr); + + MockMetricReader(); + + opentelemetry::sdk::metrics::AggregationTemporality GetAggregationTemporality( + opentelemetry::sdk::metrics::InstrumentType) const noexcept override; + + bool OnForceFlush(std::chrono::microseconds) noexcept override; + + bool OnShutDown(std::chrono::microseconds) noexcept override; + + void OnInitialized() noexcept override; + +private: + std::unique_ptr exporter_; +}; + +class MockCollectorHandle : public opentelemetry::sdk::metrics::CollectorHandle +{ +public: + MockCollectorHandle(opentelemetry::sdk::metrics::AggregationTemporality); + + ~MockCollectorHandle() override = default; + + opentelemetry::sdk::metrics::AggregationTemporality GetAggregationTemporality( + opentelemetry::sdk::metrics::InstrumentType) noexcept override; + +private: + opentelemetry::sdk::metrics::AggregationTemporality temporality_; +}; \ No newline at end of file diff --git a/sdk/test/metrics/histogram_aggregation_benchmark.cc b/sdk/test/metrics/histogram_aggregation_benchmark.cc index af6dee6c41..3fb0e322b0 100644 --- a/sdk/test/metrics/histogram_aggregation_benchmark.cc +++ b/sdk/test/metrics/histogram_aggregation_benchmark.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include +#include "common.h" #include "opentelemetry/sdk/metrics/data/point_data.h" #include "opentelemetry/sdk/metrics/meter.h" @@ -10,56 +10,13 @@ #include "opentelemetry/sdk/metrics/metric_reader.h" #include "opentelemetry/sdk/metrics/push_metric_exporter.h" +#include #include using namespace opentelemetry; using namespace opentelemetry::sdk::instrumentationscope; using namespace opentelemetry::sdk::metrics; -class MockMetricExporter : public PushMetricExporter -{ -public: - MockMetricExporter() = default; - opentelemetry::sdk::common::ExportResult Export( - const ResourceMetrics & /* records */) noexcept override - { - return opentelemetry::sdk::common::ExportResult::kSuccess; - } - - AggregationTemporality GetAggregationTemporality( - InstrumentType /* instrument_type */) const noexcept override - { - return AggregationTemporality::kCumulative; - } - - bool ForceFlush(std::chrono::microseconds /* timeout */) noexcept override { return true; } - - bool Shutdown(std::chrono::microseconds /* timeout */) noexcept override { return true; } -}; - -class MockMetricReader : public MetricReader -{ -public: - MockMetricReader(std::unique_ptr exporter) : exporter_(std::move(exporter)) {} - AggregationTemporality GetAggregationTemporality( - InstrumentType instrument_type) const noexcept override - { - return exporter_->GetAggregationTemporality(instrument_type); - } - virtual bool OnForceFlush(std::chrono::microseconds /* timeout */) noexcept override - { - return true; - } - virtual bool OnShutDown(std::chrono::microseconds /* timeout */) noexcept override - { - return true; - } - virtual void OnInitialized() noexcept override {} - -private: - std::unique_ptr exporter_; -}; - namespace { void BM_HistogramAggregation(benchmark::State &state) diff --git a/sdk/test/metrics/histogram_aggregation_test.cc b/sdk/test/metrics/histogram_aggregation_test.cc index 99f6ec3d82..666a02d119 100644 --- a/sdk/test/metrics/histogram_aggregation_test.cc +++ b/sdk/test/metrics/histogram_aggregation_test.cc @@ -1,6 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include "common.h" #include "opentelemetry/common/macros.h" #include "opentelemetry/sdk/metrics/data/point_data.h" #include "opentelemetry/sdk/metrics/meter.h" @@ -17,50 +18,6 @@ using namespace opentelemetry; using namespace opentelemetry::sdk::instrumentationscope; using namespace opentelemetry::sdk::metrics; -class MockMetricExporter : public PushMetricExporter -{ -public: - MockMetricExporter() = default; - opentelemetry::sdk::common::ExportResult Export( - const ResourceMetrics & /* records */) noexcept override - { - return opentelemetry::sdk::common::ExportResult::kSuccess; - } - - AggregationTemporality GetAggregationTemporality( - InstrumentType /* instrument_type */) const noexcept override - { - return AggregationTemporality::kCumulative; - } - - bool ForceFlush(std::chrono::microseconds /* timeout */) noexcept override { return true; } - - bool Shutdown(std::chrono::microseconds /* timeout */) noexcept override { return true; } -}; - -class MockMetricReader : public MetricReader -{ -public: - MockMetricReader(std::unique_ptr exporter) : exporter_(std::move(exporter)) {} - AggregationTemporality GetAggregationTemporality( - InstrumentType instrument_type) const noexcept override - { - return exporter_->GetAggregationTemporality(instrument_type); - } - virtual bool OnForceFlush(std::chrono::microseconds /* timeout */) noexcept override - { - return true; - } - virtual bool OnShutDown(std::chrono::microseconds /* timeout */) noexcept override - { - return true; - } - virtual void OnInitialized() noexcept override {} - -private: - std::unique_ptr exporter_; -}; - TEST(HistogramInstrumentToHistogramAggregation, Double) { MeterProvider mp; diff --git a/sdk/test/metrics/histogram_test.cc b/sdk/test/metrics/histogram_test.cc index ee3aa939b6..ef2d023c92 100644 --- a/sdk/test/metrics/histogram_test.cc +++ b/sdk/test/metrics/histogram_test.cc @@ -1,6 +1,8 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include "common.h" + #include "opentelemetry/common/macros.h" #include "opentelemetry/sdk/metrics/data/point_data.h" #include "opentelemetry/sdk/metrics/meter.h" @@ -19,50 +21,6 @@ using namespace opentelemetry; using namespace opentelemetry::sdk::instrumentationscope; using namespace opentelemetry::sdk::metrics; -class MockMetricExporter : public PushMetricExporter -{ -public: - MockMetricExporter() = default; - opentelemetry::sdk::common::ExportResult Export( - const ResourceMetrics & /* records */) noexcept override - { - return opentelemetry::sdk::common::ExportResult::kSuccess; - } - - AggregationTemporality GetAggregationTemporality( - InstrumentType /* instrument_type */) const noexcept override - { - return AggregationTemporality::kCumulative; - } - - bool ForceFlush(std::chrono::microseconds /* timeout */) noexcept override { return true; } - - bool Shutdown(std::chrono::microseconds /* timeout */) noexcept override { return true; } -}; - -class MockMetricReader : public MetricReader -{ -public: - MockMetricReader(std::unique_ptr exporter) : exporter_(std::move(exporter)) {} - AggregationTemporality GetAggregationTemporality( - InstrumentType instrument_type) const noexcept override - { - return exporter_->GetAggregationTemporality(instrument_type); - } - virtual bool OnForceFlush(std::chrono::microseconds /* timeout */) noexcept override - { - return true; - } - virtual bool OnShutDown(std::chrono::microseconds /* timeout */) noexcept override - { - return true; - } - virtual void OnInitialized() noexcept override {} - -private: - std::unique_ptr exporter_; -}; - TEST(Histogram, Double) { MeterProvider mp; diff --git a/sdk/test/metrics/meter_provider_sdk_test.cc b/sdk/test/metrics/meter_provider_sdk_test.cc index 7663ca9b01..bcdc6c4b79 100644 --- a/sdk/test/metrics/meter_provider_sdk_test.cc +++ b/sdk/test/metrics/meter_provider_sdk_test.cc @@ -1,6 +1,8 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include "common.h" + #include #include "opentelemetry/sdk/metrics/export/metric_producer.h" #include "opentelemetry/sdk/metrics/meter.h" @@ -12,51 +14,6 @@ using namespace opentelemetry::sdk::metrics; -class MockMetricExporter : public PushMetricExporter -{ - -public: - MockMetricExporter() = default; - opentelemetry::sdk::common::ExportResult Export( - const ResourceMetrics & /* records */) noexcept override - { - return opentelemetry::sdk::common::ExportResult::kSuccess; - } - - AggregationTemporality GetAggregationTemporality( - InstrumentType /* instrument_type */) const noexcept override - { - return AggregationTemporality::kCumulative; - } - - bool ForceFlush(std::chrono::microseconds /* timeout */) noexcept override { return true; } - - bool Shutdown(std::chrono::microseconds /* timeout */) noexcept override { return true; } -}; - -class MockMetricReader : public MetricReader -{ -public: - MockMetricReader(std::unique_ptr exporter) : exporter_(std::move(exporter)) {} - AggregationTemporality GetAggregationTemporality( - InstrumentType instrument_type) const noexcept override - { - return exporter_->GetAggregationTemporality(instrument_type); - } - virtual bool OnForceFlush(std::chrono::microseconds /* timeout */) noexcept override - { - return true; - } - virtual bool OnShutDown(std::chrono::microseconds /* timeout */) noexcept override - { - return true; - } - virtual void OnInitialized() noexcept override {} - -private: - std::unique_ptr exporter_; -}; - TEST(MeterProvider, GetMeter) { diff --git a/sdk/test/metrics/meter_test.cc b/sdk/test/metrics/meter_test.cc index fb260ea19d..084f50fc09 100644 --- a/sdk/test/metrics/meter_test.cc +++ b/sdk/test/metrics/meter_test.cc @@ -1,8 +1,10 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "opentelemetry/sdk/metrics/meter.h" +#include "common.h" + #include "opentelemetry/sdk/metrics/data/point_data.h" +#include "opentelemetry/sdk/metrics/meter.h" #include "opentelemetry/sdk/metrics/meter_context.h" #include "opentelemetry/sdk/metrics/meter_provider.h" #include "opentelemetry/sdk/metrics/metric_reader.h" @@ -13,20 +15,6 @@ using namespace opentelemetry; using namespace opentelemetry::sdk::instrumentationscope; using namespace opentelemetry::sdk::metrics; -class MockMetricReader : public MetricReader -{ -public: - MockMetricReader() = default; - AggregationTemporality GetAggregationTemporality( - InstrumentType /* instrument_type */) const noexcept override - { - return AggregationTemporality::kCumulative; - } - bool OnShutDown(std::chrono::microseconds /* timeout */) noexcept override { return true; } - bool OnForceFlush(std::chrono::microseconds /* timeout */) noexcept override { return true; } - void OnInitialized() noexcept override {} -}; - namespace { nostd::shared_ptr InitMeter(MetricReader **metricReaderPtr, diff --git a/sdk/test/metrics/metric_reader_test.cc b/sdk/test/metrics/metric_reader_test.cc index de787d617c..061d505a1d 100644 --- a/sdk/test/metrics/metric_reader_test.cc +++ b/sdk/test/metrics/metric_reader_test.cc @@ -1,35 +1,17 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "opentelemetry/sdk/metrics/metric_reader.h" +#include "common.h" + #include #include "opentelemetry/sdk/metrics/meter_context.h" +#include "opentelemetry/sdk/metrics/metric_reader.h" #include "opentelemetry/sdk/metrics/push_metric_exporter.h" using namespace opentelemetry; using namespace opentelemetry::sdk::instrumentationscope; using namespace opentelemetry::sdk::metrics; -class MockMetricReader : public MetricReader -{ -public: - MockMetricReader() = default; - AggregationTemporality GetAggregationTemporality( - InstrumentType /* instrument_type */) const noexcept override - { - return AggregationTemporality::kCumulative; - } - virtual bool OnForceFlush(std::chrono::microseconds /* timeout */) noexcept override - { - return true; - } - virtual bool OnShutDown(std::chrono::microseconds /* timeout */) noexcept override - { - return true; - } - virtual void OnInitialized() noexcept override {} -}; - TEST(MetricReaderTest, BasicTests) { std::unique_ptr metric_reader1(new MockMetricReader()); diff --git a/sdk/test/metrics/sum_aggregation_benchmark.cc b/sdk/test/metrics/sum_aggregation_benchmark.cc index ef4355340e..e52ab98ca3 100644 --- a/sdk/test/metrics/sum_aggregation_benchmark.cc +++ b/sdk/test/metrics/sum_aggregation_benchmark.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include +#include "common.h" #include "opentelemetry/sdk/metrics/data/point_data.h" #include "opentelemetry/sdk/metrics/meter.h" @@ -10,6 +10,7 @@ #include "opentelemetry/sdk/metrics/metric_reader.h" #include "opentelemetry/sdk/metrics/push_metric_exporter.h" +#include #include #include @@ -17,50 +18,6 @@ using namespace opentelemetry; using namespace opentelemetry::sdk::instrumentationscope; using namespace opentelemetry::sdk::metrics; -class MockMetricExporter : public PushMetricExporter -{ -public: - MockMetricExporter() = default; - opentelemetry::sdk::common::ExportResult Export( - const ResourceMetrics & /* records */) noexcept override - { - return opentelemetry::sdk::common::ExportResult::kSuccess; - } - - AggregationTemporality GetAggregationTemporality( - InstrumentType /* instrument_type */) const noexcept override - { - return AggregationTemporality::kCumulative; - } - - bool ForceFlush(std::chrono::microseconds /* timeout */) noexcept override { return true; } - - bool Shutdown(std::chrono::microseconds /* timeout */) noexcept override { return true; } -}; - -class MockMetricReader : public MetricReader -{ -public: - MockMetricReader(std::unique_ptr exporter) : exporter_(std::move(exporter)) {} - AggregationTemporality GetAggregationTemporality( - InstrumentType instrument_type) const noexcept override - { - return exporter_->GetAggregationTemporality(instrument_type); - } - virtual bool OnForceFlush(std::chrono::microseconds /* timeout */) noexcept override - { - return true; - } - virtual bool OnShutDown(std::chrono::microseconds /* timeout */) noexcept override - { - return true; - } - virtual void OnInitialized() noexcept override {} - -private: - std::unique_ptr exporter_; -}; - namespace { void BM_SumAggregation(benchmark::State &state) diff --git a/sdk/test/metrics/sum_aggregation_test.cc b/sdk/test/metrics/sum_aggregation_test.cc index 47022c866f..9fb1804022 100644 --- a/sdk/test/metrics/sum_aggregation_test.cc +++ b/sdk/test/metrics/sum_aggregation_test.cc @@ -1,6 +1,8 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include "common.h" + #include "opentelemetry/common/macros.h" #include "opentelemetry/sdk/metrics/data/point_data.h" #include "opentelemetry/sdk/metrics/meter.h" @@ -17,50 +19,6 @@ using namespace opentelemetry; using namespace opentelemetry::sdk::instrumentationscope; using namespace opentelemetry::sdk::metrics; -class MockMetricExporter : public PushMetricExporter -{ -public: - MockMetricExporter() = default; - opentelemetry::sdk::common::ExportResult Export( - const ResourceMetrics & /* records */) noexcept override - { - return opentelemetry::sdk::common::ExportResult::kSuccess; - } - - AggregationTemporality GetAggregationTemporality( - InstrumentType /* instrument_type */) const noexcept override - { - return AggregationTemporality::kCumulative; - } - - bool ForceFlush(std::chrono::microseconds /* timeout */) noexcept override { return true; } - - bool Shutdown(std::chrono::microseconds /* timeout */) noexcept override { return true; } -}; - -class MockMetricReader : public MetricReader -{ -public: - MockMetricReader(std::unique_ptr exporter) : exporter_(std::move(exporter)) {} - AggregationTemporality GetAggregationTemporality( - InstrumentType instrument_type) const noexcept override - { - return exporter_->GetAggregationTemporality(instrument_type); - } - virtual bool OnForceFlush(std::chrono::microseconds /* timeout */) noexcept override - { - return true; - } - virtual bool OnShutDown(std::chrono::microseconds /* timeout */) noexcept override - { - return true; - } - virtual void OnInitialized() noexcept override {} - -private: - std::unique_ptr exporter_; -}; - TEST(HistogramToSum, Double) { MeterProvider mp; diff --git a/sdk/test/metrics/sync_metric_storage_counter_test.cc b/sdk/test/metrics/sync_metric_storage_counter_test.cc index 5603a8db05..1c57e1ee38 100644 --- a/sdk/test/metrics/sync_metric_storage_counter_test.cc +++ b/sdk/test/metrics/sync_metric_storage_counter_test.cc @@ -1,6 +1,8 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include "common.h" + #include #include "opentelemetry/common/key_value_iterable_view.h" #include "opentelemetry/nostd/shared_ptr.h" @@ -17,23 +19,6 @@ using namespace opentelemetry::common; using M = std::map; namespace nostd = opentelemetry::nostd; -class MockCollectorHandle : public CollectorHandle -{ -public: - MockCollectorHandle(AggregationTemporality temp) : temporality(temp) {} - - ~MockCollectorHandle() override = default; - - AggregationTemporality GetAggregationTemporality( - InstrumentType /* instrument_type */) noexcept override - { - return temporality; - } - -private: - AggregationTemporality temporality; -}; - class WritableMetricStorageTestFixture : public ::testing::TestWithParam {}; diff --git a/sdk/test/metrics/sync_metric_storage_histogram_test.cc b/sdk/test/metrics/sync_metric_storage_histogram_test.cc index 6544a21a8c..b63d31e7ce 100644 --- a/sdk/test/metrics/sync_metric_storage_histogram_test.cc +++ b/sdk/test/metrics/sync_metric_storage_histogram_test.cc @@ -1,7 +1,8 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include +#include "common.h" + #include "opentelemetry/common/key_value_iterable_view.h" #include "opentelemetry/nostd/shared_ptr.h" #include "opentelemetry/sdk/metrics/exemplar/no_exemplar_reservoir.h" @@ -11,29 +12,13 @@ #include #include +#include using namespace opentelemetry::sdk::metrics; using namespace opentelemetry::common; using M = std::map; namespace nostd = opentelemetry::nostd; -class MockCollectorHandle : public CollectorHandle -{ -public: - MockCollectorHandle(AggregationTemporality temp) : temporality(temp) {} - - ~MockCollectorHandle() override = default; - - AggregationTemporality GetAggregationTemporality( - InstrumentType /* instrument_type */) noexcept override - { - return temporality; - } - -private: - AggregationTemporality temporality; -}; - class WritableMetricStorageHistogramTestFixture : public ::testing::TestWithParam {}; diff --git a/sdk/test/metrics/sync_metric_storage_up_down_counter_test.cc b/sdk/test/metrics/sync_metric_storage_up_down_counter_test.cc index f84bde7628..94bfc1a03d 100644 --- a/sdk/test/metrics/sync_metric_storage_up_down_counter_test.cc +++ b/sdk/test/metrics/sync_metric_storage_up_down_counter_test.cc @@ -1,6 +1,8 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include "common.h" + #include "opentelemetry/common/key_value_iterable_view.h" #include "opentelemetry/nostd/shared_ptr.h" #include "opentelemetry/sdk/metrics/exemplar/histogram_exemplar_reservoir.h" @@ -17,23 +19,6 @@ using namespace opentelemetry::common; using M = std::map; namespace nostd = opentelemetry::nostd; -class MockCollectorHandle : public CollectorHandle -{ -public: - MockCollectorHandle(AggregationTemporality temp) : temporality(temp) {} - - ~MockCollectorHandle() override = default; - - AggregationTemporality GetAggregationTemporality( - InstrumentType /* instrument_type */) noexcept override - { - return temporality; - } - -private: - AggregationTemporality temporality; -}; - class WritableMetricStorageTestFixture : public ::testing::TestWithParam {}; From e5807a4fd061f2cb788c8b91ba392442f34519e0 Mon Sep 17 00:00:00 2001 From: Lalit Date: Tue, 31 Jan 2023 23:02:35 -0800 Subject: [PATCH 04/10] Fix --- sdk/test/metrics/BUILD | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sdk/test/metrics/BUILD b/sdk/test/metrics/BUILD index 4a9d3582af..2feca1e147 100644 --- a/sdk/test/metrics/BUILD +++ b/sdk/test/metrics/BUILD @@ -159,6 +159,7 @@ cc_test( "test", ], deps = [ + "metrics_common_test_utils", "//sdk/src/metrics", "//sdk/src/resource", "@com_google_googletest//:gtest_main", @@ -175,6 +176,7 @@ cc_test( "test", ], deps = [ + "metrics_common_test_utils", "//sdk/src/metrics", "//sdk/src/resource", "@com_google_googletest//:gtest_main", @@ -191,6 +193,7 @@ cc_test( "test", ], deps = [ + "metrics_common_test_utils", "//sdk/src/metrics", "@com_google_googletest//:gtest_main", ], @@ -315,7 +318,6 @@ otel_cc_benchmark( name = "attributes_processor_benchmark", srcs = [ "attributes_processor_benchmark.cc", - "metrics_common_test_utils", ], tags = [ "benchmark", @@ -323,6 +325,7 @@ otel_cc_benchmark( "test", ], deps = [ + "metrics_common_test_utils", "//sdk/src/metrics", ], ) @@ -331,7 +334,6 @@ otel_cc_benchmark( name = "attributes_hashmap_benchmark", srcs = [ "attributes_hashmap_benchmark.cc", - "metrics_common_test_utils", ], tags = [ "benchmark", @@ -339,6 +341,7 @@ otel_cc_benchmark( "test", ], deps = [ + "metrics_common_test_utils", "//sdk/src/metrics", ], ) @@ -347,7 +350,6 @@ otel_cc_benchmark( name = "histogram_aggregation_benchmark", srcs = [ "histogram_aggregation_benchmark.cc", - "metrics_common_test_utils", ], tags = [ "benchmark", @@ -355,6 +357,7 @@ otel_cc_benchmark( "test", ], deps = [ + "metrics_common_test_utils", "//sdk/src/metrics", "//sdk/src/resource", ], @@ -363,7 +366,6 @@ otel_cc_benchmark( otel_cc_benchmark( name = "sum_aggregation_benchmark", srcs = [ - "metrics_common_test_utils", "sum_aggregation_benchmark.cc", ], tags = [ @@ -372,6 +374,7 @@ otel_cc_benchmark( "test", ], deps = [ + "metrics_common_test_utils", "//sdk/src/metrics", "//sdk/src/resource", ], From 7f3675a913ec8e75e08150274ff87db3ef23d101 Mon Sep 17 00:00:00 2001 From: Lalit Date: Tue, 31 Jan 2023 23:22:38 -0800 Subject: [PATCH 05/10] Fix --- sdk/test/metrics/common.cc | 2 +- sdk/test/metrics/common.h | 2 +- sdk/test/metrics/histogram_aggregation_benchmark.cc | 2 +- sdk/test/metrics/histogram_aggregation_test.cc | 3 ++- sdk/test/metrics/histogram_test.cc | 2 +- sdk/test/metrics/meter_provider_sdk_test.cc | 2 +- sdk/test/metrics/meter_test.cc | 2 +- sdk/test/metrics/metric_reader_test.cc | 2 +- sdk/test/metrics/sum_aggregation_benchmark.cc | 2 +- sdk/test/metrics/sum_aggregation_test.cc | 2 +- sdk/test/metrics/sync_metric_storage_counter_test.cc | 2 +- sdk/test/metrics/sync_metric_storage_histogram_test.cc | 2 +- sdk/test/metrics/sync_metric_storage_up_down_counter_test.cc | 2 +- 13 files changed, 14 insertions(+), 13 deletions(-) diff --git a/sdk/test/metrics/common.cc b/sdk/test/metrics/common.cc index 87343f6186..b11923ead2 100644 --- a/sdk/test/metrics/common.cc +++ b/sdk/test/metrics/common.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "common.h" +#include "test/metrics/common.h" using namespace opentelemetry; using namespace opentelemetry::sdk::instrumentationscope; diff --git a/sdk/test/metrics/common.h b/sdk/test/metrics/common.h index 9a98e446dd..b3b73e15d6 100644 --- a/sdk/test/metrics/common.h +++ b/sdk/test/metrics/common.h @@ -57,4 +57,4 @@ class MockCollectorHandle : public opentelemetry::sdk::metrics::CollectorHandle private: opentelemetry::sdk::metrics::AggregationTemporality temporality_; -}; \ No newline at end of file +}; diff --git a/sdk/test/metrics/histogram_aggregation_benchmark.cc b/sdk/test/metrics/histogram_aggregation_benchmark.cc index 3fb0e322b0..2fc858f0e8 100644 --- a/sdk/test/metrics/histogram_aggregation_benchmark.cc +++ b/sdk/test/metrics/histogram_aggregation_benchmark.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "common.h" +#include "test/metrics/common.h" #include "opentelemetry/sdk/metrics/data/point_data.h" #include "opentelemetry/sdk/metrics/meter.h" diff --git a/sdk/test/metrics/histogram_aggregation_test.cc b/sdk/test/metrics/histogram_aggregation_test.cc index 666a02d119..dd07b773e6 100644 --- a/sdk/test/metrics/histogram_aggregation_test.cc +++ b/sdk/test/metrics/histogram_aggregation_test.cc @@ -1,7 +1,8 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "common.h" +#include "test/metrics/common.h" + #include "opentelemetry/common/macros.h" #include "opentelemetry/sdk/metrics/data/point_data.h" #include "opentelemetry/sdk/metrics/meter.h" diff --git a/sdk/test/metrics/histogram_test.cc b/sdk/test/metrics/histogram_test.cc index ef2d023c92..362ad1883b 100644 --- a/sdk/test/metrics/histogram_test.cc +++ b/sdk/test/metrics/histogram_test.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "common.h" +#include "test/metrics/common.h" #include "opentelemetry/common/macros.h" #include "opentelemetry/sdk/metrics/data/point_data.h" diff --git a/sdk/test/metrics/meter_provider_sdk_test.cc b/sdk/test/metrics/meter_provider_sdk_test.cc index bcdc6c4b79..80727652ed 100644 --- a/sdk/test/metrics/meter_provider_sdk_test.cc +++ b/sdk/test/metrics/meter_provider_sdk_test.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "common.h" +#include "test/metrics/common.h" #include #include "opentelemetry/sdk/metrics/export/metric_producer.h" diff --git a/sdk/test/metrics/meter_test.cc b/sdk/test/metrics/meter_test.cc index 084f50fc09..0964b27eb4 100644 --- a/sdk/test/metrics/meter_test.cc +++ b/sdk/test/metrics/meter_test.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "common.h" +#include "test/metrics/common.h" #include "opentelemetry/sdk/metrics/data/point_data.h" #include "opentelemetry/sdk/metrics/meter.h" diff --git a/sdk/test/metrics/metric_reader_test.cc b/sdk/test/metrics/metric_reader_test.cc index 061d505a1d..635f7c93f8 100644 --- a/sdk/test/metrics/metric_reader_test.cc +++ b/sdk/test/metrics/metric_reader_test.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "common.h" +#include "test/metrics/common.h" #include #include "opentelemetry/sdk/metrics/meter_context.h" diff --git a/sdk/test/metrics/sum_aggregation_benchmark.cc b/sdk/test/metrics/sum_aggregation_benchmark.cc index e52ab98ca3..7df8bade58 100644 --- a/sdk/test/metrics/sum_aggregation_benchmark.cc +++ b/sdk/test/metrics/sum_aggregation_benchmark.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "common.h" +#include "test/metrics/common.h" #include "opentelemetry/sdk/metrics/data/point_data.h" #include "opentelemetry/sdk/metrics/meter.h" diff --git a/sdk/test/metrics/sum_aggregation_test.cc b/sdk/test/metrics/sum_aggregation_test.cc index 9fb1804022..562a7246d5 100644 --- a/sdk/test/metrics/sum_aggregation_test.cc +++ b/sdk/test/metrics/sum_aggregation_test.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "common.h" +#include "test/metrics/common.h" #include "opentelemetry/common/macros.h" #include "opentelemetry/sdk/metrics/data/point_data.h" diff --git a/sdk/test/metrics/sync_metric_storage_counter_test.cc b/sdk/test/metrics/sync_metric_storage_counter_test.cc index 1c57e1ee38..f94d0bf36e 100644 --- a/sdk/test/metrics/sync_metric_storage_counter_test.cc +++ b/sdk/test/metrics/sync_metric_storage_counter_test.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "common.h" +#include "test/metrics/common.h" #include #include "opentelemetry/common/key_value_iterable_view.h" diff --git a/sdk/test/metrics/sync_metric_storage_histogram_test.cc b/sdk/test/metrics/sync_metric_storage_histogram_test.cc index b63d31e7ce..14dd308739 100644 --- a/sdk/test/metrics/sync_metric_storage_histogram_test.cc +++ b/sdk/test/metrics/sync_metric_storage_histogram_test.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "common.h" +#include "test/metrics/common.h" #include "opentelemetry/common/key_value_iterable_view.h" #include "opentelemetry/nostd/shared_ptr.h" diff --git a/sdk/test/metrics/sync_metric_storage_up_down_counter_test.cc b/sdk/test/metrics/sync_metric_storage_up_down_counter_test.cc index 94bfc1a03d..a49daf09de 100644 --- a/sdk/test/metrics/sync_metric_storage_up_down_counter_test.cc +++ b/sdk/test/metrics/sync_metric_storage_up_down_counter_test.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "common.h" +#include "test/metrics/common.h" #include "opentelemetry/common/key_value_iterable_view.h" #include "opentelemetry/nostd/shared_ptr.h" From 1a50affff7fcee53f2702da4c11ad936e3535cd2 Mon Sep 17 00:00:00 2001 From: Lalit Date: Tue, 31 Jan 2023 23:28:28 -0800 Subject: [PATCH 06/10] fix --- sdk/test/metrics/common.cc | 2 +- sdk/test/metrics/histogram_aggregation_benchmark.cc | 2 +- sdk/test/metrics/histogram_aggregation_test.cc | 2 +- sdk/test/metrics/histogram_test.cc | 2 +- sdk/test/metrics/meter_provider_sdk_test.cc | 2 +- sdk/test/metrics/meter_test.cc | 2 +- sdk/test/metrics/metric_reader_test.cc | 2 +- sdk/test/metrics/sum_aggregation_benchmark.cc | 2 +- sdk/test/metrics/sum_aggregation_test.cc | 2 +- sdk/test/metrics/sync_metric_storage_counter_test.cc | 2 +- sdk/test/metrics/sync_metric_storage_histogram_test.cc | 2 +- sdk/test/metrics/sync_metric_storage_up_down_counter_test.cc | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sdk/test/metrics/common.cc b/sdk/test/metrics/common.cc index b11923ead2..2f59b79f77 100644 --- a/sdk/test/metrics/common.cc +++ b/sdk/test/metrics/common.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "test/metrics/common.h" +#include "sdk/test/metrics/common.h" using namespace opentelemetry; using namespace opentelemetry::sdk::instrumentationscope; diff --git a/sdk/test/metrics/histogram_aggregation_benchmark.cc b/sdk/test/metrics/histogram_aggregation_benchmark.cc index 2fc858f0e8..ec3ddfe2a2 100644 --- a/sdk/test/metrics/histogram_aggregation_benchmark.cc +++ b/sdk/test/metrics/histogram_aggregation_benchmark.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "test/metrics/common.h" +#include "sdk/test/metrics/common.h" #include "opentelemetry/sdk/metrics/data/point_data.h" #include "opentelemetry/sdk/metrics/meter.h" diff --git a/sdk/test/metrics/histogram_aggregation_test.cc b/sdk/test/metrics/histogram_aggregation_test.cc index dd07b773e6..83396b9e33 100644 --- a/sdk/test/metrics/histogram_aggregation_test.cc +++ b/sdk/test/metrics/histogram_aggregation_test.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "test/metrics/common.h" +#include "sdk/test/metrics/common.h" #include "opentelemetry/common/macros.h" #include "opentelemetry/sdk/metrics/data/point_data.h" diff --git a/sdk/test/metrics/histogram_test.cc b/sdk/test/metrics/histogram_test.cc index 362ad1883b..eaf2948ef2 100644 --- a/sdk/test/metrics/histogram_test.cc +++ b/sdk/test/metrics/histogram_test.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "test/metrics/common.h" +#include "sdk/test/metrics/common.h" #include "opentelemetry/common/macros.h" #include "opentelemetry/sdk/metrics/data/point_data.h" diff --git a/sdk/test/metrics/meter_provider_sdk_test.cc b/sdk/test/metrics/meter_provider_sdk_test.cc index 80727652ed..ec0075700b 100644 --- a/sdk/test/metrics/meter_provider_sdk_test.cc +++ b/sdk/test/metrics/meter_provider_sdk_test.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "test/metrics/common.h" +#include "sdk/test/metrics/common.h" #include #include "opentelemetry/sdk/metrics/export/metric_producer.h" diff --git a/sdk/test/metrics/meter_test.cc b/sdk/test/metrics/meter_test.cc index 0964b27eb4..a354954848 100644 --- a/sdk/test/metrics/meter_test.cc +++ b/sdk/test/metrics/meter_test.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "test/metrics/common.h" +#include "sdk/test/metrics/common.h" #include "opentelemetry/sdk/metrics/data/point_data.h" #include "opentelemetry/sdk/metrics/meter.h" diff --git a/sdk/test/metrics/metric_reader_test.cc b/sdk/test/metrics/metric_reader_test.cc index 635f7c93f8..5ab3d33a18 100644 --- a/sdk/test/metrics/metric_reader_test.cc +++ b/sdk/test/metrics/metric_reader_test.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "test/metrics/common.h" +#include "sdk/test/metrics/common.h" #include #include "opentelemetry/sdk/metrics/meter_context.h" diff --git a/sdk/test/metrics/sum_aggregation_benchmark.cc b/sdk/test/metrics/sum_aggregation_benchmark.cc index 7df8bade58..0d5ae721da 100644 --- a/sdk/test/metrics/sum_aggregation_benchmark.cc +++ b/sdk/test/metrics/sum_aggregation_benchmark.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "test/metrics/common.h" +#include "sdk/test/metrics/common.h" #include "opentelemetry/sdk/metrics/data/point_data.h" #include "opentelemetry/sdk/metrics/meter.h" diff --git a/sdk/test/metrics/sum_aggregation_test.cc b/sdk/test/metrics/sum_aggregation_test.cc index 562a7246d5..777a8e7cc2 100644 --- a/sdk/test/metrics/sum_aggregation_test.cc +++ b/sdk/test/metrics/sum_aggregation_test.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "test/metrics/common.h" +#include "sdk/test/metrics/common.h" #include "opentelemetry/common/macros.h" #include "opentelemetry/sdk/metrics/data/point_data.h" diff --git a/sdk/test/metrics/sync_metric_storage_counter_test.cc b/sdk/test/metrics/sync_metric_storage_counter_test.cc index f94d0bf36e..98013ded24 100644 --- a/sdk/test/metrics/sync_metric_storage_counter_test.cc +++ b/sdk/test/metrics/sync_metric_storage_counter_test.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "test/metrics/common.h" +#include "sdk/test/metrics/common.h" #include #include "opentelemetry/common/key_value_iterable_view.h" diff --git a/sdk/test/metrics/sync_metric_storage_histogram_test.cc b/sdk/test/metrics/sync_metric_storage_histogram_test.cc index 14dd308739..d8ec3d515a 100644 --- a/sdk/test/metrics/sync_metric_storage_histogram_test.cc +++ b/sdk/test/metrics/sync_metric_storage_histogram_test.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "test/metrics/common.h" +#include "sdk/test/metrics/common.h" #include "opentelemetry/common/key_value_iterable_view.h" #include "opentelemetry/nostd/shared_ptr.h" diff --git a/sdk/test/metrics/sync_metric_storage_up_down_counter_test.cc b/sdk/test/metrics/sync_metric_storage_up_down_counter_test.cc index a49daf09de..d275bf4393 100644 --- a/sdk/test/metrics/sync_metric_storage_up_down_counter_test.cc +++ b/sdk/test/metrics/sync_metric_storage_up_down_counter_test.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "test/metrics/common.h" +#include "sdk/test/metrics/common.h" #include "opentelemetry/common/key_value_iterable_view.h" #include "opentelemetry/nostd/shared_ptr.h" From c339b9fcfeb56c297276dc758f704c3e76182d27 Mon Sep 17 00:00:00 2001 From: Lalit Date: Tue, 31 Jan 2023 23:40:03 -0800 Subject: [PATCH 07/10] Fix --- sdk/test/metrics/BUILD | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sdk/test/metrics/BUILD b/sdk/test/metrics/BUILD index 2feca1e147..6042bdd296 100644 --- a/sdk/test/metrics/BUILD +++ b/sdk/test/metrics/BUILD @@ -5,6 +5,8 @@ cc_test( srcs = [ "common.cc", ], + hdrs = ["sdk/test/metrics/common.h"], + strip_include_prefix = ["sdk/test/metrics/"], tags = [ "metrics", "test", From 5439b1a63e9cb57706eb63c30e0a0c060442eb54 Mon Sep 17 00:00:00 2001 From: Lalit Date: Wed, 1 Feb 2023 00:06:10 -0800 Subject: [PATCH 08/10] changes.. --- sdk/test/metrics/BUILD | 25 ++----------------- sdk/test/metrics/CMakeLists.txt | 19 ++++---------- sdk/test/metrics/common.cc | 2 +- .../histogram_aggregation_benchmark.cc | 2 +- .../metrics/histogram_aggregation_test.cc | 2 +- sdk/test/metrics/histogram_test.cc | 2 +- sdk/test/metrics/meter_provider_sdk_test.cc | 2 +- sdk/test/metrics/meter_test.cc | 2 +- sdk/test/metrics/metric_reader_test.cc | 2 +- sdk/test/metrics/sum_aggregation_benchmark.cc | 2 +- sdk/test/metrics/sum_aggregation_test.cc | 2 +- .../sync_metric_storage_counter_test.cc | 2 +- .../sync_metric_storage_histogram_test.cc | 2 +- ...ync_metric_storage_up_down_counter_test.cc | 2 +- 14 files changed, 19 insertions(+), 49 deletions(-) diff --git a/sdk/test/metrics/BUILD b/sdk/test/metrics/BUILD index 6042bdd296..9bb118148c 100644 --- a/sdk/test/metrics/BUILD +++ b/sdk/test/metrics/BUILD @@ -1,12 +1,11 @@ load("//bazel:otel_cc_benchmark.bzl", "otel_cc_benchmark") -cc_test( +cc_library( name = "metrics_common_test_utils", srcs = [ "common.cc", ], - hdrs = ["sdk/test/metrics/common.h"], - strip_include_prefix = ["sdk/test/metrics/"], + hdrs = ["common.h"], tags = [ "metrics", "test", @@ -27,7 +26,6 @@ cc_test( ], deps = [ "metrics_common_test_utils", - "//sdk/src/metrics", "@com_google_googletest//:gtest_main", ], ) @@ -43,7 +41,6 @@ cc_test( ], deps = [ "metrics_common_test_utils", - "//sdk/src/metrics", "//sdk/src/resource", "@com_google_googletest//:gtest_main", ], @@ -60,7 +57,6 @@ cc_test( ], deps = [ "metrics_common_test_utils", - "//sdk/src/metrics", "//sdk/src/resource", "@com_google_googletest//:gtest_main", ], @@ -77,7 +73,6 @@ cc_test( ], deps = [ "metrics_common_test_utils", - "//sdk/src/metrics", "//sdk/src/resource", "@com_google_googletest//:gtest_main", ], @@ -94,7 +89,6 @@ cc_test( ], deps = [ "metrics_common_test_utils", - "//sdk/src/metrics", "//sdk/src/resource", "@com_google_googletest//:gtest_main", ], @@ -111,7 +105,6 @@ cc_test( ], deps = [ "metrics_common_test_utils", - "//sdk/src/metrics", "//sdk/src/resource", "@com_google_googletest//:gtest_main", ], @@ -128,7 +121,6 @@ cc_test( ], deps = [ "metrics_common_test_utils", - "//sdk/src/metrics", "//sdk/src/resource", "@com_google_googletest//:gtest_main", ], @@ -145,7 +137,6 @@ cc_test( ], deps = [ "metrics_common_test_utils", - "//sdk/src/metrics", "//sdk/src/resource", "@com_google_googletest//:gtest_main", ], @@ -162,7 +153,6 @@ cc_test( ], deps = [ "metrics_common_test_utils", - "//sdk/src/metrics", "//sdk/src/resource", "@com_google_googletest//:gtest_main", ], @@ -179,7 +169,6 @@ cc_test( ], deps = [ "metrics_common_test_utils", - "//sdk/src/metrics", "//sdk/src/resource", "@com_google_googletest//:gtest_main", ], @@ -196,7 +185,6 @@ cc_test( ], deps = [ "metrics_common_test_utils", - "//sdk/src/metrics", "@com_google_googletest//:gtest_main", ], ) @@ -212,7 +200,6 @@ cc_test( ], deps = [ "metrics_common_test_utils", - "//sdk/src/metrics", "//sdk/src/resource", "@com_google_googletest//:gtest_main", ], @@ -229,7 +216,6 @@ cc_test( ], deps = [ "metrics_common_test_utils", - "//sdk/src/metrics", "//sdk/src/resource", "@com_google_googletest//:gtest_main", ], @@ -246,7 +232,6 @@ cc_test( ], deps = [ "metrics_common_test_utils", - "//sdk/src/metrics", "//sdk/src/resource", "@com_google_googletest//:gtest_main", ], @@ -263,7 +248,6 @@ cc_test( ], deps = [ "metrics_common_test_utils", - "//sdk/src/metrics", "@com_google_googletest//:gtest_main", ], ) @@ -279,7 +263,6 @@ cc_test( ], deps = [ "metrics_common_test_utils", - "//sdk/src/metrics", "@com_google_googletest//:gtest_main", ], ) @@ -295,7 +278,6 @@ cc_test( ], deps = [ "metrics_common_test_utils", - "//sdk/src/metrics", "@com_google_googletest//:gtest_main", ], ) @@ -311,7 +293,6 @@ cc_test( ], deps = [ "metrics_common_test_utils", - "//sdk/src/metrics", "@com_google_googletest//:gtest_main", ], ) @@ -328,7 +309,6 @@ otel_cc_benchmark( ], deps = [ "metrics_common_test_utils", - "//sdk/src/metrics", ], ) @@ -344,7 +324,6 @@ otel_cc_benchmark( ], deps = [ "metrics_common_test_utils", - "//sdk/src/metrics", ], ) diff --git a/sdk/test/metrics/CMakeLists.txt b/sdk/test/metrics/CMakeLists.txt index e1c498b5a4..260a979724 100644 --- a/sdk/test/metrics/CMakeLists.txt +++ b/sdk/test/metrics/CMakeLists.txt @@ -27,7 +27,7 @@ foreach( add_executable(${testname} "${testname}.cc") target_link_libraries( ${testname} ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} - metrics_common_test_utils opentelemetry_resources opentelemetry_metrics) + metrics_common_test_utils opentelemetry_resources) gtest_add_tests( TARGET ${testname} TEST_PREFIX metrics. @@ -47,23 +47,14 @@ if(WITH_BENCHMARK) add_executable(histogram_aggregation_benchmark histogram_aggregation_benchmark.cc) target_link_libraries( - histogram_aggregation_benchmark - benchmark::benchmark - ${CMAKE_THREAD_LIBS_INIT} - metrics_common_test_utils - opentelemetry_common - opentelemetry_metrics + histogram_aggregation_benchmark benchmark::benchmark + ${CMAKE_THREAD_LIBS_INIT} metrics_common_test_utils opentelemetry_common opentelemetry_resources) add_executable(sum_aggregation_benchmark sum_aggregation_benchmark.cc) target_link_libraries( - sum_aggregation_benchmark - benchmark::benchmark - ${CMAKE_THREAD_LIBS_INIT} - metrics_common_test_utils - opentelemetry_common - opentelemetry_metrics - opentelemetry_resources) + sum_aggregation_benchmark benchmark::benchmark ${CMAKE_THREAD_LIBS_INIT} + metrics_common_test_utils opentelemetry_common opentelemetry_resources) endif() add_subdirectory(exemplar) diff --git a/sdk/test/metrics/common.cc b/sdk/test/metrics/common.cc index 2f59b79f77..87343f6186 100644 --- a/sdk/test/metrics/common.cc +++ b/sdk/test/metrics/common.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "sdk/test/metrics/common.h" +#include "common.h" using namespace opentelemetry; using namespace opentelemetry::sdk::instrumentationscope; diff --git a/sdk/test/metrics/histogram_aggregation_benchmark.cc b/sdk/test/metrics/histogram_aggregation_benchmark.cc index ec3ddfe2a2..3fb0e322b0 100644 --- a/sdk/test/metrics/histogram_aggregation_benchmark.cc +++ b/sdk/test/metrics/histogram_aggregation_benchmark.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "sdk/test/metrics/common.h" +#include "common.h" #include "opentelemetry/sdk/metrics/data/point_data.h" #include "opentelemetry/sdk/metrics/meter.h" diff --git a/sdk/test/metrics/histogram_aggregation_test.cc b/sdk/test/metrics/histogram_aggregation_test.cc index 83396b9e33..fada036747 100644 --- a/sdk/test/metrics/histogram_aggregation_test.cc +++ b/sdk/test/metrics/histogram_aggregation_test.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "sdk/test/metrics/common.h" +#include "common.h" #include "opentelemetry/common/macros.h" #include "opentelemetry/sdk/metrics/data/point_data.h" diff --git a/sdk/test/metrics/histogram_test.cc b/sdk/test/metrics/histogram_test.cc index eaf2948ef2..ef2d023c92 100644 --- a/sdk/test/metrics/histogram_test.cc +++ b/sdk/test/metrics/histogram_test.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "sdk/test/metrics/common.h" +#include "common.h" #include "opentelemetry/common/macros.h" #include "opentelemetry/sdk/metrics/data/point_data.h" diff --git a/sdk/test/metrics/meter_provider_sdk_test.cc b/sdk/test/metrics/meter_provider_sdk_test.cc index ec0075700b..bcdc6c4b79 100644 --- a/sdk/test/metrics/meter_provider_sdk_test.cc +++ b/sdk/test/metrics/meter_provider_sdk_test.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "sdk/test/metrics/common.h" +#include "common.h" #include #include "opentelemetry/sdk/metrics/export/metric_producer.h" diff --git a/sdk/test/metrics/meter_test.cc b/sdk/test/metrics/meter_test.cc index a354954848..084f50fc09 100644 --- a/sdk/test/metrics/meter_test.cc +++ b/sdk/test/metrics/meter_test.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "sdk/test/metrics/common.h" +#include "common.h" #include "opentelemetry/sdk/metrics/data/point_data.h" #include "opentelemetry/sdk/metrics/meter.h" diff --git a/sdk/test/metrics/metric_reader_test.cc b/sdk/test/metrics/metric_reader_test.cc index 5ab3d33a18..061d505a1d 100644 --- a/sdk/test/metrics/metric_reader_test.cc +++ b/sdk/test/metrics/metric_reader_test.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "sdk/test/metrics/common.h" +#include "common.h" #include #include "opentelemetry/sdk/metrics/meter_context.h" diff --git a/sdk/test/metrics/sum_aggregation_benchmark.cc b/sdk/test/metrics/sum_aggregation_benchmark.cc index 0d5ae721da..e52ab98ca3 100644 --- a/sdk/test/metrics/sum_aggregation_benchmark.cc +++ b/sdk/test/metrics/sum_aggregation_benchmark.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "sdk/test/metrics/common.h" +#include "common.h" #include "opentelemetry/sdk/metrics/data/point_data.h" #include "opentelemetry/sdk/metrics/meter.h" diff --git a/sdk/test/metrics/sum_aggregation_test.cc b/sdk/test/metrics/sum_aggregation_test.cc index 777a8e7cc2..9fb1804022 100644 --- a/sdk/test/metrics/sum_aggregation_test.cc +++ b/sdk/test/metrics/sum_aggregation_test.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "sdk/test/metrics/common.h" +#include "common.h" #include "opentelemetry/common/macros.h" #include "opentelemetry/sdk/metrics/data/point_data.h" diff --git a/sdk/test/metrics/sync_metric_storage_counter_test.cc b/sdk/test/metrics/sync_metric_storage_counter_test.cc index 98013ded24..1c57e1ee38 100644 --- a/sdk/test/metrics/sync_metric_storage_counter_test.cc +++ b/sdk/test/metrics/sync_metric_storage_counter_test.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "sdk/test/metrics/common.h" +#include "common.h" #include #include "opentelemetry/common/key_value_iterable_view.h" diff --git a/sdk/test/metrics/sync_metric_storage_histogram_test.cc b/sdk/test/metrics/sync_metric_storage_histogram_test.cc index d8ec3d515a..b63d31e7ce 100644 --- a/sdk/test/metrics/sync_metric_storage_histogram_test.cc +++ b/sdk/test/metrics/sync_metric_storage_histogram_test.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "sdk/test/metrics/common.h" +#include "common.h" #include "opentelemetry/common/key_value_iterable_view.h" #include "opentelemetry/nostd/shared_ptr.h" diff --git a/sdk/test/metrics/sync_metric_storage_up_down_counter_test.cc b/sdk/test/metrics/sync_metric_storage_up_down_counter_test.cc index d275bf4393..94bfc1a03d 100644 --- a/sdk/test/metrics/sync_metric_storage_up_down_counter_test.cc +++ b/sdk/test/metrics/sync_metric_storage_up_down_counter_test.cc @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#include "sdk/test/metrics/common.h" +#include "common.h" #include "opentelemetry/common/key_value_iterable_view.h" #include "opentelemetry/nostd/shared_ptr.h" From 33e4b38eb876d9c6a89377cbe22f467f73ef44fe Mon Sep 17 00:00:00 2001 From: Lalit Date: Wed, 1 Feb 2023 00:25:37 -0800 Subject: [PATCH 09/10] fix --- sdk/test/metrics/histogram_aggregation_benchmark.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/test/metrics/histogram_aggregation_benchmark.cc b/sdk/test/metrics/histogram_aggregation_benchmark.cc index 3fb0e322b0..bb63f1230c 100644 --- a/sdk/test/metrics/histogram_aggregation_benchmark.cc +++ b/sdk/test/metrics/histogram_aggregation_benchmark.cc @@ -39,7 +39,7 @@ void BM_HistogramAggregation(benchmark::State &state) } std::vector actuals; std::vector collectionThreads; - std::function collectMetrics = [&reader, &actuals, &TOTAL_MEASUREMENTS]() { + std::function collectMetrics = [&reader, &actuals]() { reader->Collect([&](ResourceMetrics &rm) { for (const ScopeMetrics &smd : rm.scope_metric_data_) { From 7fca68f0e323de42777416fcc62c4c474d963154 Mon Sep 17 00:00:00 2001 From: Lalit Date: Wed, 1 Feb 2023 00:39:29 -0800 Subject: [PATCH 10/10] fix --- sdk/test/metrics/sum_aggregation_benchmark.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/test/metrics/sum_aggregation_benchmark.cc b/sdk/test/metrics/sum_aggregation_benchmark.cc index e52ab98ca3..43be12523a 100644 --- a/sdk/test/metrics/sum_aggregation_benchmark.cc +++ b/sdk/test/metrics/sum_aggregation_benchmark.cc @@ -40,7 +40,7 @@ void BM_SumAggregation(benchmark::State &state) } std::vector actuals; std::vector collectionThreads; - std::function collectMetrics = [&reader, &actuals, &TOTAL_MEASUREMENTS]() { + std::function collectMetrics = [&reader, &actuals]() { reader->Collect([&](ResourceMetrics &rm) { for (const ScopeMetrics &smd : rm.scope_metric_data_) {