From 978ddbf6dac501365d758a92aea036c45cc820a3 Mon Sep 17 00:00:00 2001 From: Lalit Date: Thu, 4 Nov 2021 11:05:54 -0700 Subject: [PATCH 1/8] move old metrics to different dir, rename targets as deprecated --- .../{metrics => _metrics}/async_instruments.h | 4 ++-- .../{metrics => _metrics}/instrument.h | 0 .../{metrics => _metrics}/meter.h | 6 ++--- .../{metrics => _metrics}/meter_provider.h | 2 +- .../{metrics => _metrics}/noop.h | 10 ++++---- .../{metrics => _metrics}/observer_result.h | 2 +- .../{metrics => _metrics}/provider.h | 4 ++-- .../{metrics => _metrics}/sync_instruments.h | 2 +- api/test/CMakeLists.txt | 2 +- api/test/{metrics => _metrics}/BUILD | 0 api/test/{metrics => _metrics}/CMakeLists.txt | 0 .../meter_provider_test.cc | 2 +- .../noop_instrument_test.cc | 2 +- .../noop_metrics_test.cc | 8 +++---- api/test/trace/noop_test.cc | 2 +- examples/metrics_simple/BUILD | 4 ++-- examples/metrics_simple/CMakeLists.txt | 4 ++-- examples/metrics_simple/main.cc | 10 ++++---- exporters/ostream/BUILD | 6 ++--- exporters/ostream/CMakeLists.txt | 14 +++++------ .../exporters/ostream/metrics_exporter.h | 10 ++++---- .../ostream/test/ostream_metrics_test.cc | 14 +++++------ exporters/prometheus/CMakeLists.txt | 2 +- .../prometheus/prometheus_collector.h | 2 +- .../prometheus/prometheus_exporter_utils.h | 2 +- .../src/prometheus_exporter_utils.cc | 2 +- .../test/prometheus_collector_test.cc | 18 +++++++------- .../test/prometheus_exporter_utils_test.cc | 12 +++++----- sdk/CMakeLists.txt | 2 +- .../aggregator/aggregator.h | 2 +- .../aggregator/counter_aggregator.h | 4 ++-- .../aggregator/exact_aggregator.h | 4 ++-- .../aggregator/gauge_aggregator.h | 4 ++-- .../aggregator/histogram_aggregator.h | 4 ++-- .../aggregator/min_max_sum_count_aggregator.h | 4 ++-- .../aggregator/sketch_aggregator.h | 4 ++-- .../{metrics => _metrics}/async_instruments.h | 8 +++---- .../sdk/{metrics => _metrics}/controller.h | 10 ++++---- .../sdk/{metrics => _metrics}/exporter.h | 2 +- .../sdk/{metrics => _metrics}/instrument.h | 6 ++--- .../sdk/{metrics => _metrics}/meter.h | 10 ++++---- .../{metrics => _metrics}/meter_provider.h | 14 +++++++++-- .../sdk/{metrics => _metrics}/processor.h | 4 ++-- .../sdk/{metrics => _metrics}/record.h | 4 ++-- .../{metrics => _metrics}/sync_instruments.h | 8 +++---- .../ungrouped_processor.h | 16 ++++++------- sdk/src/CMakeLists.txt | 2 +- sdk/src/{metrics => _metrics}/BUILD | 4 ++-- sdk/src/{metrics => _metrics}/CMakeLists.txt | 10 ++++---- sdk/src/{metrics => _metrics}/meter.cc | 2 +- .../{metrics => _metrics}/meter_provider.cc | 2 +- .../ungrouped_processor.cc | 2 +- sdk/test/CMakeLists.txt | 2 +- sdk/test/{metrics => _metrics}/BUILD | 24 +++++++++---------- sdk/test/{metrics => _metrics}/CMakeLists.txt | 2 +- .../{metrics => _metrics}/controller_test.cc | 0 .../counter_aggregator_test.cc | 0 .../exact_aggregator_test.cc | 0 .../gauge_aggregator_test.cc | 0 .../histogram_aggregator_test.cc | 0 .../meter_provider_sdk_test.cc | 0 sdk/test/{metrics => _metrics}/meter_test.cc | 0 .../metric_instrument_test.cc | 0 .../min_max_sum_count_aggregator_test.cc | 0 .../sketch_aggregator_test.cc | 0 .../ungrouped_processor_test.cc | 0 66 files changed, 158 insertions(+), 148 deletions(-) rename api/include/opentelemetry/{metrics => _metrics}/async_instruments.h (95%) rename api/include/opentelemetry/{metrics => _metrics}/instrument.h (100%) rename api/include/opentelemetry/{metrics => _metrics}/meter.h (98%) rename api/include/opentelemetry/{metrics => _metrics}/meter_provider.h (94%) rename api/include/opentelemetry/{metrics => _metrics}/noop.h (98%) rename api/include/opentelemetry/{metrics => _metrics}/observer_result.h (94%) rename api/include/opentelemetry/{metrics => _metrics}/provider.h (93%) rename api/include/opentelemetry/{metrics => _metrics}/sync_instruments.h (99%) rename api/test/{metrics => _metrics}/BUILD (100%) rename api/test/{metrics => _metrics}/CMakeLists.txt (100%) rename api/test/{metrics => _metrics}/meter_provider_test.cc (96%) rename api/test/{metrics => _metrics}/noop_instrument_test.cc (99%) rename api/test/{metrics => _metrics}/noop_metrics_test.cc (93%) rename sdk/include/opentelemetry/sdk/{metrics => _metrics}/aggregator/aggregator.h (98%) rename sdk/include/opentelemetry/sdk/{metrics => _metrics}/aggregator/counter_aggregator.h (95%) rename sdk/include/opentelemetry/sdk/{metrics => _metrics}/aggregator/exact_aggregator.h (97%) rename sdk/include/opentelemetry/sdk/{metrics => _metrics}/aggregator/gauge_aggregator.h (97%) rename sdk/include/opentelemetry/sdk/{metrics => _metrics}/aggregator/histogram_aggregator.h (98%) rename sdk/include/opentelemetry/sdk/{metrics => _metrics}/aggregator/min_max_sum_count_aggregator.h (97%) rename sdk/include/opentelemetry/sdk/{metrics => _metrics}/aggregator/sketch_aggregator.h (98%) rename sdk/include/opentelemetry/sdk/{metrics => _metrics}/async_instruments.h (96%) rename sdk/include/opentelemetry/sdk/{metrics => _metrics}/controller.h (93%) rename sdk/include/opentelemetry/sdk/{metrics => _metrics}/exporter.h (94%) rename sdk/include/opentelemetry/sdk/{metrics => _metrics}/instrument.h (98%) rename sdk/include/opentelemetry/sdk/{metrics => _metrics}/meter.h (98%) rename sdk/include/opentelemetry/sdk/{metrics => _metrics}/meter_provider.h (71%) rename sdk/include/opentelemetry/sdk/{metrics => _metrics}/processor.h (88%) rename sdk/include/opentelemetry/sdk/{metrics => _metrics}/record.h (92%) rename sdk/include/opentelemetry/sdk/{metrics => _metrics}/sync_instruments.h (98%) rename sdk/include/opentelemetry/sdk/{metrics => _metrics}/ungrouped_processor.h (95%) rename sdk/src/{metrics => _metrics}/BUILD (91%) rename sdk/src/{metrics => _metrics}/CMakeLists.txt (50%) rename sdk/src/{metrics => _metrics}/meter.cc (99%) rename sdk/src/{metrics => _metrics}/meter_provider.cc (92%) rename sdk/src/{metrics => _metrics}/ungrouped_processor.cc (98%) rename sdk/test/{metrics => _metrics}/BUILD (75%) rename sdk/test/{metrics => _metrics}/CMakeLists.txt (96%) rename sdk/test/{metrics => _metrics}/controller_test.cc (100%) rename sdk/test/{metrics => _metrics}/counter_aggregator_test.cc (100%) rename sdk/test/{metrics => _metrics}/exact_aggregator_test.cc (100%) rename sdk/test/{metrics => _metrics}/gauge_aggregator_test.cc (100%) rename sdk/test/{metrics => _metrics}/histogram_aggregator_test.cc (100%) rename sdk/test/{metrics => _metrics}/meter_provider_sdk_test.cc (100%) rename sdk/test/{metrics => _metrics}/meter_test.cc (100%) rename sdk/test/{metrics => _metrics}/metric_instrument_test.cc (100%) rename sdk/test/{metrics => _metrics}/min_max_sum_count_aggregator_test.cc (100%) rename sdk/test/{metrics => _metrics}/sketch_aggregator_test.cc (100%) rename sdk/test/{metrics => _metrics}/ungrouped_processor_test.cc (100%) diff --git a/api/include/opentelemetry/metrics/async_instruments.h b/api/include/opentelemetry/_metrics/async_instruments.h similarity index 95% rename from api/include/opentelemetry/metrics/async_instruments.h rename to api/include/opentelemetry/_metrics/async_instruments.h index 867382ec19..53024b07a5 100644 --- a/api/include/opentelemetry/metrics/async_instruments.h +++ b/api/include/opentelemetry/_metrics/async_instruments.h @@ -4,8 +4,8 @@ #pragma once #ifdef ENABLE_METRICS_PREVIEW -# include "instrument.h" -# include "observer_result.h" +# include "opentelemetry/_metrics/instrument.h" +# include "opentelemetry/_metrics/observer_result.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace metrics diff --git a/api/include/opentelemetry/metrics/instrument.h b/api/include/opentelemetry/_metrics/instrument.h similarity index 100% rename from api/include/opentelemetry/metrics/instrument.h rename to api/include/opentelemetry/_metrics/instrument.h diff --git a/api/include/opentelemetry/metrics/meter.h b/api/include/opentelemetry/_metrics/meter.h similarity index 98% rename from api/include/opentelemetry/metrics/meter.h rename to api/include/opentelemetry/_metrics/meter.h index a2adafb9da..11311cf14b 100644 --- a/api/include/opentelemetry/metrics/meter.h +++ b/api/include/opentelemetry/_metrics/meter.h @@ -4,9 +4,9 @@ #pragma once #ifdef ENABLE_METRICS_PREVIEW -# include "opentelemetry/metrics/async_instruments.h" -# include "opentelemetry/metrics/instrument.h" -# include "opentelemetry/metrics/sync_instruments.h" +# include "opentelemetry/_metrics/async_instruments.h" +# include "opentelemetry/_metrics/instrument.h" +# include "opentelemetry/_metrics/sync_instruments.h" # include "opentelemetry/nostd/shared_ptr.h" # include "opentelemetry/nostd/span.h" # include "opentelemetry/nostd/string_view.h" diff --git a/api/include/opentelemetry/metrics/meter_provider.h b/api/include/opentelemetry/_metrics/meter_provider.h similarity index 94% rename from api/include/opentelemetry/metrics/meter_provider.h rename to api/include/opentelemetry/_metrics/meter_provider.h index 840c7d2aa7..78ce42ee9a 100644 --- a/api/include/opentelemetry/metrics/meter_provider.h +++ b/api/include/opentelemetry/_metrics/meter_provider.h @@ -4,7 +4,7 @@ #pragma once #ifdef ENABLE_METRICS_PREVIEW -# include "opentelemetry/metrics/meter.h" +# include "opentelemetry/_metrics/meter.h" # include "opentelemetry/nostd/shared_ptr.h" # include "opentelemetry/nostd/string_view.h" diff --git a/api/include/opentelemetry/metrics/noop.h b/api/include/opentelemetry/_metrics/noop.h similarity index 98% rename from api/include/opentelemetry/metrics/noop.h rename to api/include/opentelemetry/_metrics/noop.h index 3a38df732b..ecd5c53170 100644 --- a/api/include/opentelemetry/metrics/noop.h +++ b/api/include/opentelemetry/_metrics/noop.h @@ -8,11 +8,11 @@ // This file is part of the internal implementation of OpenTelemetry. Nothing in this file should be // used directly. Please refer to meter.h for documentation on these interfaces. -# include "opentelemetry/metrics/async_instruments.h" -# include "opentelemetry/metrics/instrument.h" -# include "opentelemetry/metrics/meter.h" -# include "opentelemetry/metrics/meter_provider.h" -# include "opentelemetry/metrics/sync_instruments.h" +# include "opentelemetry/_metrics/async_instruments.h" +# include "opentelemetry/_metrics/instrument.h" +# include "opentelemetry/_metrics/meter.h" +# include "opentelemetry/_metrics/meter_provider.h" +# include "opentelemetry/_metrics/sync_instruments.h" # include "opentelemetry/nostd/string_view.h" # include "opentelemetry/nostd/unique_ptr.h" # include "opentelemetry/version.h" diff --git a/api/include/opentelemetry/metrics/observer_result.h b/api/include/opentelemetry/_metrics/observer_result.h similarity index 94% rename from api/include/opentelemetry/metrics/observer_result.h rename to api/include/opentelemetry/_metrics/observer_result.h index 90ad10efc2..de4b36c0dc 100644 --- a/api/include/opentelemetry/metrics/observer_result.h +++ b/api/include/opentelemetry/_metrics/observer_result.h @@ -4,7 +4,7 @@ #pragma once #ifdef ENABLE_METRICS_PREVIEW -# include "instrument.h" +# include "opentelemetry/_metrics/instrument.h" # include "opentelemetry/nostd/shared_ptr.h" OPENTELEMETRY_BEGIN_NAMESPACE diff --git a/api/include/opentelemetry/metrics/provider.h b/api/include/opentelemetry/_metrics/provider.h similarity index 93% rename from api/include/opentelemetry/metrics/provider.h rename to api/include/opentelemetry/_metrics/provider.h index e5b6d1b66f..0e0c3cae46 100644 --- a/api/include/opentelemetry/metrics/provider.h +++ b/api/include/opentelemetry/_metrics/provider.h @@ -6,8 +6,8 @@ # include # include "opentelemetry/common/spin_lock_mutex.h" -# include "opentelemetry/metrics/meter_provider.h" -# include "opentelemetry/metrics/noop.h" +# include "opentelemetry/_metrics/meter_provider.h" +# include "opentelemetry/_metrics/noop.h" # include "opentelemetry/nostd/shared_ptr.h" OPENTELEMETRY_BEGIN_NAMESPACE diff --git a/api/include/opentelemetry/metrics/sync_instruments.h b/api/include/opentelemetry/_metrics/sync_instruments.h similarity index 99% rename from api/include/opentelemetry/metrics/sync_instruments.h rename to api/include/opentelemetry/_metrics/sync_instruments.h index b7eb09e84d..56ccea7074 100644 --- a/api/include/opentelemetry/metrics/sync_instruments.h +++ b/api/include/opentelemetry/_metrics/sync_instruments.h @@ -4,7 +4,7 @@ #pragma once #ifdef ENABLE_METRICS_PREVIEW -# include "instrument.h" +# include "opentelemetry/_metrics/instrument.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace metrics diff --git a/api/test/CMakeLists.txt b/api/test/CMakeLists.txt index 0e4c9bd0f3..7eb67a6b55 100644 --- a/api/test/CMakeLists.txt +++ b/api/test/CMakeLists.txt @@ -4,7 +4,7 @@ add_subdirectory(plugin) add_subdirectory(nostd) add_subdirectory(trace) if(WITH_METRICS_PREVIEW) - add_subdirectory(metrics) + add_subdirectory(_metrics) endif() if(WITH_LOGS_PREVIEW) add_subdirectory(logs) diff --git a/api/test/metrics/BUILD b/api/test/_metrics/BUILD similarity index 100% rename from api/test/metrics/BUILD rename to api/test/_metrics/BUILD diff --git a/api/test/metrics/CMakeLists.txt b/api/test/_metrics/CMakeLists.txt similarity index 100% rename from api/test/metrics/CMakeLists.txt rename to api/test/_metrics/CMakeLists.txt diff --git a/api/test/metrics/meter_provider_test.cc b/api/test/_metrics/meter_provider_test.cc similarity index 96% rename from api/test/metrics/meter_provider_test.cc rename to api/test/_metrics/meter_provider_test.cc index 862ce4a7fe..b2d54be449 100644 --- a/api/test/metrics/meter_provider_test.cc +++ b/api/test/_metrics/meter_provider_test.cc @@ -3,7 +3,7 @@ #ifdef ENABLE_METRICS_PREVIEW # include -# include "opentelemetry/metrics/provider.h" +# include "opentelemetry/_metrics/provider.h" # include "opentelemetry/nostd/shared_ptr.h" using opentelemetry::metrics::Meter; diff --git a/api/test/metrics/noop_instrument_test.cc b/api/test/_metrics/noop_instrument_test.cc similarity index 99% rename from api/test/metrics/noop_instrument_test.cc rename to api/test/_metrics/noop_instrument_test.cc index 0d0b9a07f5..83d8d3960e 100644 --- a/api/test/metrics/noop_instrument_test.cc +++ b/api/test/_metrics/noop_instrument_test.cc @@ -7,7 +7,7 @@ # include # include -# include "opentelemetry/metrics/noop.h" +# include "opentelemetry/_metrics/noop.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace metrics diff --git a/api/test/metrics/noop_metrics_test.cc b/api/test/_metrics/noop_metrics_test.cc similarity index 93% rename from api/test/metrics/noop_metrics_test.cc rename to api/test/_metrics/noop_metrics_test.cc index 14b3643c7b..cc9d1f4b76 100644 --- a/api/test/metrics/noop_metrics_test.cc +++ b/api/test/_metrics/noop_metrics_test.cc @@ -3,10 +3,10 @@ #ifdef ENABLE_METRICS_PREVIEW # include -# include "opentelemetry/metrics/instrument.h" -# include "opentelemetry/metrics/noop.h" -# include "opentelemetry/metrics/observer_result.h" -# include "opentelemetry/metrics/sync_instruments.h" +# include "opentelemetry/_metrics/instrument.h" +# include "opentelemetry/_metrics/noop.h" +# include "opentelemetry/_metrics/observer_result.h" +# include "opentelemetry/_metrics/sync_instruments.h" # include # include diff --git a/api/test/trace/noop_test.cc b/api/test/trace/noop_test.cc index b17faf64d4..876aaf7721 100644 --- a/api/test/trace/noop_test.cc +++ b/api/test/trace/noop_test.cc @@ -23,7 +23,7 @@ TEST(NoopTest, UseNoopTracers) s1->AddEvent("abc", attributes1); std::vector> attributes2; - s1->AddEvent("abc", attributes2); + s1->AddEvent("abc", attributes2); s1->AddEvent("abc", {{"a", 1}, {"b", "2"}, {"c", 3.0}}); diff --git a/examples/metrics_simple/BUILD b/examples/metrics_simple/BUILD index 196614a96c..fa0fee5673 100644 --- a/examples/metrics_simple/BUILD +++ b/examples/metrics_simple/BUILD @@ -6,7 +6,7 @@ cc_binary( linkopts = ["-pthread"], deps = [ "//api", - "//exporters/ostream:ostream_metrics_exporter", - "//sdk/src/metrics", + "//exporters/ostream:ostream_metrics_exporter_deprecated", + "//sdk/src/_metrics:metrics_deprecated", ], ) diff --git a/examples/metrics_simple/CMakeLists.txt b/examples/metrics_simple/CMakeLists.txt index 4269318871..94b441061b 100644 --- a/examples/metrics_simple/CMakeLists.txt +++ b/examples/metrics_simple/CMakeLists.txt @@ -2,5 +2,5 @@ include_directories(${CMAKE_SOURCE_DIR}/exporters/ostream/include) add_executable(simple_metrics main.cc) target_link_libraries( - simple_metrics ${CMAKE_THREAD_LIBS_INIT} opentelemetry_metrics - opentelemetry_exporter_ostream_metrics) + simple_metrics ${CMAKE_THREAD_LIBS_INIT} opentelemetry_metrics_deprecated + opentelemetry_exporter_ostream_metrics_deprecated) diff --git a/examples/metrics_simple/main.cc b/examples/metrics_simple/main.cc index fe0e7df4bb..2ed0981277 100644 --- a/examples/metrics_simple/main.cc +++ b/examples/metrics_simple/main.cc @@ -3,11 +3,11 @@ #ifdef ENABLE_METRICS_PREVIEW # include "opentelemetry/exporters/ostream/metrics_exporter.h" -# include "opentelemetry/metrics/provider.h" -# include "opentelemetry/sdk/metrics/controller.h" -# include "opentelemetry/sdk/metrics/meter.h" -# include "opentelemetry/sdk/metrics/meter_provider.h" -# include "opentelemetry/sdk/metrics/ungrouped_processor.h" +# include "opentelemetry/_metrics/provider.h" +# include "opentelemetry/sdk/_metrics/controller.h" +# include "opentelemetry/sdk/_metrics/meter.h" +# include "opentelemetry/sdk/_metrics/meter_provider.h" +# include "opentelemetry/sdk/_metrics/ungrouped_processor.h" namespace sdkmetrics = opentelemetry::sdk::metrics; namespace nostd = opentelemetry::nostd; diff --git a/exporters/ostream/BUILD b/exporters/ostream/BUILD index d16e727b59..3f4e1ffaeb 100644 --- a/exporters/ostream/BUILD +++ b/exporters/ostream/BUILD @@ -24,7 +24,7 @@ cc_test( ) cc_library( - name = "ostream_metrics_exporter", + name = "ostream_metrics_exporter_deprecated", srcs = [ "src/metrics_exporter.cc", ], @@ -33,7 +33,7 @@ cc_library( ], strip_include_prefix = "include", deps = [ - "//sdk/src/metrics", + "//sdk/src/_metrics:metrics_deprecated", ], ) @@ -41,7 +41,7 @@ cc_test( name = "ostream_metrics_test", srcs = ["test/ostream_metrics_test.cc"], deps = [ - ":ostream_metrics_exporter", + ":ostream_metrics_exporter_deprecated", "@com_google_googletest//:gtest_main", ], ) diff --git a/exporters/ostream/CMakeLists.txt b/exporters/ostream/CMakeLists.txt index fbbf7b231d..53b8a4c13e 100644 --- a/exporters/ostream/CMakeLists.txt +++ b/exporters/ostream/CMakeLists.txt @@ -35,16 +35,16 @@ if(BUILD_TESTING) endif() # BUILD_TESTING if(WITH_METRICS_PREVIEW) - add_library(opentelemetry_exporter_ostream_metrics src/metrics_exporter.cc) - set_target_properties(opentelemetry_exporter_ostream_metrics + add_library(opentelemetry_exporter_ostream_metrics_deprecated src/metrics_exporter.cc) + set_target_properties(opentelemetry_exporter_ostream_metrics_deprecated PROPERTIES EXPORT_NAME ostream_metrics_exporter) target_include_directories( - opentelemetry_exporter_ostream_metrics + opentelemetry_exporter_ostream_metrics_deprecated PUBLIC "$") - target_link_libraries(opentelemetry_exporter_ostream_metrics - PUBLIC opentelemetry_metrics) + target_link_libraries(opentelemetry_exporter_ostream_metrics_deprecated + PUBLIC opentelemetry_metrics_deprecated) install( - TARGETS opentelemetry_exporter_ostream_metrics + TARGETS opentelemetry_exporter_ostream_metrics_deprecated EXPORT "${PROJECT_NAME}-target" RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} @@ -56,7 +56,7 @@ if(WITH_METRICS_PREVIEW) if(BUILD_TESTING) add_executable(ostream_metrics_test test/ostream_metrics_test.cc) target_link_libraries(ostream_metrics_test ${GTEST_BOTH_LIBRARIES} - opentelemetry_exporter_ostream_metrics) + opentelemetry_exporter_ostream_metrics_deprecated) gtest_add_tests( TARGET ostream_metrics_test TEST_PREFIX exporter. diff --git a/exporters/ostream/include/opentelemetry/exporters/ostream/metrics_exporter.h b/exporters/ostream/include/opentelemetry/exporters/ostream/metrics_exporter.h index 469382b6bd..82eceb18e0 100644 --- a/exporters/ostream/include/opentelemetry/exporters/ostream/metrics_exporter.h +++ b/exporters/ostream/include/opentelemetry/exporters/ostream/metrics_exporter.h @@ -6,11 +6,11 @@ # include # include -# include "opentelemetry/sdk/metrics/aggregator/exact_aggregator.h" -# include "opentelemetry/sdk/metrics/aggregator/gauge_aggregator.h" -# include "opentelemetry/sdk/metrics/aggregator/histogram_aggregator.h" -# include "opentelemetry/sdk/metrics/exporter.h" -# include "opentelemetry/sdk/metrics/record.h" +# include "opentelemetry/sdk/_metrics/aggregator/exact_aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/gauge_aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/histogram_aggregator.h" +# include "opentelemetry/sdk/_metrics/exporter.h" +# include "opentelemetry/sdk/_metrics/record.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdkmetrics = opentelemetry::sdk::metrics; diff --git a/exporters/ostream/test/ostream_metrics_test.cc b/exporters/ostream/test/ostream_metrics_test.cc index d86a41b382..9a7c77216d 100644 --- a/exporters/ostream/test/ostream_metrics_test.cc +++ b/exporters/ostream/test/ostream_metrics_test.cc @@ -5,13 +5,13 @@ #ifdef ENABLE_METRICS_PREVIEW # include "opentelemetry/exporters/ostream/metrics_exporter.h" -# include "opentelemetry/sdk/metrics/aggregator/counter_aggregator.h" -# include "opentelemetry/sdk/metrics/aggregator/exact_aggregator.h" -# include "opentelemetry/sdk/metrics/aggregator/gauge_aggregator.h" -# include "opentelemetry/sdk/metrics/aggregator/min_max_sum_count_aggregator.h" -# include "opentelemetry/sdk/metrics/aggregator/sketch_aggregator.h" -# include "opentelemetry/sdk/metrics/exporter.h" -# include "opentelemetry/sdk/metrics/record.h" +# include "opentelemetry/sdk/_metrics/aggregator/counter_aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/exact_aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/gauge_aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/min_max_sum_count_aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/sketch_aggregator.h" +# include "opentelemetry/sdk/_metrics/exporter.h" +# include "opentelemetry/sdk/_metrics/record.h" # include diff --git a/exporters/prometheus/CMakeLists.txt b/exporters/prometheus/CMakeLists.txt index d6b8eefea5..d9148ad5a2 100644 --- a/exporters/prometheus/CMakeLists.txt +++ b/exporters/prometheus/CMakeLists.txt @@ -22,7 +22,7 @@ target_include_directories( PUBLIC "$" "$") -target_link_libraries(prometheus_exporter PUBLIC opentelemetry_metrics +target_link_libraries(prometheus_exporter_deprecated PUBLIC opentelemetry_metrics_deprecated prometheus-cpp::core) install( diff --git a/exporters/prometheus/include/opentelemetry/exporters/prometheus/prometheus_collector.h b/exporters/prometheus/include/opentelemetry/exporters/prometheus/prometheus_collector.h index e1e6e74f4e..69d7754ad6 100644 --- a/exporters/prometheus/include/opentelemetry/exporters/prometheus/prometheus_collector.h +++ b/exporters/prometheus/include/opentelemetry/exporters/prometheus/prometheus_collector.h @@ -8,7 +8,7 @@ # include # include -# include "opentelemetry/sdk/metrics/record.h" +# include "opentelemetry/sdk/_metrics/record.h" # include "prometheus/collectable.h" # include "prometheus/metric_family.h" # include "prometheus_exporter_utils.h" diff --git a/exporters/prometheus/include/opentelemetry/exporters/prometheus/prometheus_exporter_utils.h b/exporters/prometheus/include/opentelemetry/exporters/prometheus/prometheus_exporter_utils.h index 30793725b4..a1fb3cd754 100644 --- a/exporters/prometheus/include/opentelemetry/exporters/prometheus/prometheus_exporter_utils.h +++ b/exporters/prometheus/include/opentelemetry/exporters/prometheus/prometheus_exporter_utils.h @@ -7,7 +7,7 @@ # include # include -# include "opentelemetry/sdk/metrics/record.h" +# include "opentelemetry/sdk/_metrics/record.h" # include "prometheus/metric_family.h" namespace metric_sdk = opentelemetry::sdk::metrics; diff --git a/exporters/prometheus/src/prometheus_exporter_utils.cc b/exporters/prometheus/src/prometheus_exporter_utils.cc index 846b6faff2..fcc4615c6b 100644 --- a/exporters/prometheus/src/prometheus_exporter_utils.cc +++ b/exporters/prometheus/src/prometheus_exporter_utils.cc @@ -8,7 +8,7 @@ # include # include "opentelemetry/exporters/prometheus/prometheus_exporter_utils.h" -# include "opentelemetry/sdk/metrics/aggregator/aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/aggregator.h" # include "prometheus/metric_type.h" namespace prometheus_client = ::prometheus; diff --git a/exporters/prometheus/test/prometheus_collector_test.cc b/exporters/prometheus/test/prometheus_collector_test.cc index 662fbf4f3e..263ce875bf 100644 --- a/exporters/prometheus/test/prometheus_collector_test.cc +++ b/exporters/prometheus/test/prometheus_collector_test.cc @@ -8,15 +8,15 @@ # include # include "opentelemetry/exporters/prometheus/prometheus_collector.h" -# include "opentelemetry/metrics/instrument.h" -# include "opentelemetry/sdk/metrics/aggregator/aggregator.h" -# include "opentelemetry/sdk/metrics/aggregator/counter_aggregator.h" -# include "opentelemetry/sdk/metrics/aggregator/exact_aggregator.h" -# include "opentelemetry/sdk/metrics/aggregator/gauge_aggregator.h" -# include "opentelemetry/sdk/metrics/aggregator/histogram_aggregator.h" -# include "opentelemetry/sdk/metrics/aggregator/min_max_sum_count_aggregator.h" -# include "opentelemetry/sdk/metrics/aggregator/sketch_aggregator.h" -# include "opentelemetry/sdk/metrics/record.h" +# include "opentelemetry/_metrics/instrument.h" +# include "opentelemetry/sdk/_metrics/aggregator/aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/counter_aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/exact_aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/gauge_aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/histogram_aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/min_max_sum_count_aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/sketch_aggregator.h" +# include "opentelemetry/sdk/_metrics/record.h" # include "opentelemetry/version.h" using opentelemetry::exporter::prometheus::PrometheusCollector; diff --git a/exporters/prometheus/test/prometheus_exporter_utils_test.cc b/exporters/prometheus/test/prometheus_exporter_utils_test.cc index d48cb0f16b..22ce3f5fd7 100644 --- a/exporters/prometheus/test/prometheus_exporter_utils_test.cc +++ b/exporters/prometheus/test/prometheus_exporter_utils_test.cc @@ -10,12 +10,12 @@ # include # include "opentelemetry/exporters/prometheus/prometheus_exporter_utils.h" -# include "opentelemetry/sdk/metrics/aggregator/counter_aggregator.h" -# include "opentelemetry/sdk/metrics/aggregator/exact_aggregator.h" -# include "opentelemetry/sdk/metrics/aggregator/gauge_aggregator.h" -# include "opentelemetry/sdk/metrics/aggregator/histogram_aggregator.h" -# include "opentelemetry/sdk/metrics/aggregator/min_max_sum_count_aggregator.h" -# include "opentelemetry/sdk/metrics/aggregator/sketch_aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/counter_aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/exact_aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/gauge_aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/histogram_aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/min_max_sum_count_aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/sketch_aggregator.h" using opentelemetry::exporter::prometheus::PrometheusExporterUtils; namespace metric_sdk = opentelemetry::sdk::metrics; diff --git a/sdk/CMakeLists.txt b/sdk/CMakeLists.txt index 3f217544d8..9aa45883e5 100644 --- a/sdk/CMakeLists.txt +++ b/sdk/CMakeLists.txt @@ -20,7 +20,7 @@ endif() set(METRICS_EXCLUDE_PATTERN "") if(NOT WITH_METRICS_PREVIEW) - set(METRICS_EXCLUDE_PATTERN "metrics") + set(METRICS_EXCLUDE_PATTERN "_metrics") endif() install( diff --git a/sdk/include/opentelemetry/sdk/metrics/aggregator/aggregator.h b/sdk/include/opentelemetry/sdk/_metrics/aggregator/aggregator.h similarity index 98% rename from sdk/include/opentelemetry/sdk/metrics/aggregator/aggregator.h rename to sdk/include/opentelemetry/sdk/_metrics/aggregator/aggregator.h index 361b6bd19f..a5ae178ca3 100644 --- a/sdk/include/opentelemetry/sdk/metrics/aggregator/aggregator.h +++ b/sdk/include/opentelemetry/sdk/_metrics/aggregator/aggregator.h @@ -7,7 +7,7 @@ # include # include # include "opentelemetry/common/timestamp.h" -# include "opentelemetry/metrics/instrument.h" +# include "opentelemetry/_metrics/instrument.h" # include "opentelemetry/version.h" namespace metrics_api = opentelemetry::metrics; diff --git a/sdk/include/opentelemetry/sdk/metrics/aggregator/counter_aggregator.h b/sdk/include/opentelemetry/sdk/_metrics/aggregator/counter_aggregator.h similarity index 95% rename from sdk/include/opentelemetry/sdk/metrics/aggregator/counter_aggregator.h rename to sdk/include/opentelemetry/sdk/_metrics/aggregator/counter_aggregator.h index aa5e6bed04..2189dcc934 100644 --- a/sdk/include/opentelemetry/sdk/metrics/aggregator/counter_aggregator.h +++ b/sdk/include/opentelemetry/sdk/_metrics/aggregator/counter_aggregator.h @@ -6,8 +6,8 @@ # include # include -# include "opentelemetry/metrics/instrument.h" -# include "opentelemetry/sdk/metrics/aggregator/aggregator.h" +# include "opentelemetry/_metrics/instrument.h" +# include "opentelemetry/sdk/_metrics/aggregator/aggregator.h" # include "opentelemetry/version.h" namespace metrics_api = opentelemetry::metrics; diff --git a/sdk/include/opentelemetry/sdk/metrics/aggregator/exact_aggregator.h b/sdk/include/opentelemetry/sdk/_metrics/aggregator/exact_aggregator.h similarity index 97% rename from sdk/include/opentelemetry/sdk/metrics/aggregator/exact_aggregator.h rename to sdk/include/opentelemetry/sdk/_metrics/aggregator/exact_aggregator.h index d9853b54a9..cb4e52e71b 100644 --- a/sdk/include/opentelemetry/sdk/metrics/aggregator/exact_aggregator.h +++ b/sdk/include/opentelemetry/sdk/_metrics/aggregator/exact_aggregator.h @@ -4,8 +4,8 @@ #pragma once #ifdef ENABLE_METRICS_PREVIEW -# include "opentelemetry/metrics/instrument.h" -# include "opentelemetry/sdk/metrics/aggregator/aggregator.h" +# include "opentelemetry/_metrics/instrument.h" +# include "opentelemetry/sdk/_metrics/aggregator/aggregator.h" # include "opentelemetry/version.h" # include diff --git a/sdk/include/opentelemetry/sdk/metrics/aggregator/gauge_aggregator.h b/sdk/include/opentelemetry/sdk/_metrics/aggregator/gauge_aggregator.h similarity index 97% rename from sdk/include/opentelemetry/sdk/metrics/aggregator/gauge_aggregator.h rename to sdk/include/opentelemetry/sdk/_metrics/aggregator/gauge_aggregator.h index e953e8c619..809ba98712 100644 --- a/sdk/include/opentelemetry/sdk/metrics/aggregator/gauge_aggregator.h +++ b/sdk/include/opentelemetry/sdk/_metrics/aggregator/gauge_aggregator.h @@ -5,8 +5,8 @@ #ifdef ENABLE_METRICS_PREVIEW # include "opentelemetry/common/timestamp.h" -# include "opentelemetry/metrics/instrument.h" -# include "opentelemetry/sdk/metrics/aggregator/aggregator.h" +# include "opentelemetry/_metrics/instrument.h" +# include "opentelemetry/sdk/_metrics/aggregator/aggregator.h" # include "opentelemetry/version.h" # include diff --git a/sdk/include/opentelemetry/sdk/metrics/aggregator/histogram_aggregator.h b/sdk/include/opentelemetry/sdk/_metrics/aggregator/histogram_aggregator.h similarity index 98% rename from sdk/include/opentelemetry/sdk/metrics/aggregator/histogram_aggregator.h rename to sdk/include/opentelemetry/sdk/_metrics/aggregator/histogram_aggregator.h index 87372a43a8..31c501d96d 100644 --- a/sdk/include/opentelemetry/sdk/metrics/aggregator/histogram_aggregator.h +++ b/sdk/include/opentelemetry/sdk/_metrics/aggregator/histogram_aggregator.h @@ -8,8 +8,8 @@ # include # include # include -# include "opentelemetry/metrics/instrument.h" -# include "opentelemetry/sdk/metrics/aggregator/aggregator.h" +# include "opentelemetry/_metrics/instrument.h" +# include "opentelemetry/sdk/_metrics/aggregator/aggregator.h" # include "opentelemetry/version.h" namespace metrics_api = opentelemetry::metrics; diff --git a/sdk/include/opentelemetry/sdk/metrics/aggregator/min_max_sum_count_aggregator.h b/sdk/include/opentelemetry/sdk/_metrics/aggregator/min_max_sum_count_aggregator.h similarity index 97% rename from sdk/include/opentelemetry/sdk/metrics/aggregator/min_max_sum_count_aggregator.h rename to sdk/include/opentelemetry/sdk/_metrics/aggregator/min_max_sum_count_aggregator.h index 42dbfa367c..55699b208f 100644 --- a/sdk/include/opentelemetry/sdk/metrics/aggregator/min_max_sum_count_aggregator.h +++ b/sdk/include/opentelemetry/sdk/_metrics/aggregator/min_max_sum_count_aggregator.h @@ -4,8 +4,8 @@ #pragma once #ifdef ENABLE_METRICS_PREVIEW -# include "opentelemetry/metrics/instrument.h" -# include "opentelemetry/sdk/metrics/aggregator/aggregator.h" +# include "opentelemetry/_metrics/instrument.h" +# include "opentelemetry/sdk/_metrics/aggregator/aggregator.h" # include "opentelemetry/version.h" # include diff --git a/sdk/include/opentelemetry/sdk/metrics/aggregator/sketch_aggregator.h b/sdk/include/opentelemetry/sdk/_metrics/aggregator/sketch_aggregator.h similarity index 98% rename from sdk/include/opentelemetry/sdk/metrics/aggregator/sketch_aggregator.h rename to sdk/include/opentelemetry/sdk/_metrics/aggregator/sketch_aggregator.h index 27f8c46f9a..6fbd502240 100644 --- a/sdk/include/opentelemetry/sdk/metrics/aggregator/sketch_aggregator.h +++ b/sdk/include/opentelemetry/sdk/_metrics/aggregator/sketch_aggregator.h @@ -11,8 +11,8 @@ # include # include # include -# include "opentelemetry/metrics/instrument.h" -# include "opentelemetry/sdk/metrics/aggregator/aggregator.h" +# include "opentelemetry/_metrics/instrument.h" +# include "opentelemetry/sdk/_metrics/aggregator/aggregator.h" # include "opentelemetry/version.h" namespace metrics_api = opentelemetry::metrics; diff --git a/sdk/include/opentelemetry/sdk/metrics/async_instruments.h b/sdk/include/opentelemetry/sdk/_metrics/async_instruments.h similarity index 96% rename from sdk/include/opentelemetry/sdk/metrics/async_instruments.h rename to sdk/include/opentelemetry/sdk/_metrics/async_instruments.h index bacb4d74c5..09ff75bfb5 100644 --- a/sdk/include/opentelemetry/sdk/metrics/async_instruments.h +++ b/sdk/include/opentelemetry/sdk/_metrics/async_instruments.h @@ -9,10 +9,10 @@ # include # include # include -# include "opentelemetry/metrics/async_instruments.h" -# include "opentelemetry/sdk/metrics/aggregator/counter_aggregator.h" -# include "opentelemetry/sdk/metrics/aggregator/min_max_sum_count_aggregator.h" -# include "opentelemetry/sdk/metrics/instrument.h" +# include "opentelemetry/_metrics/async_instruments.h" +# include "opentelemetry/sdk/_metrics/aggregator/counter_aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/min_max_sum_count_aggregator.h" +# include "opentelemetry/sdk/_metrics/instrument.h" # include "opentelemetry/version.h" namespace metrics_api = opentelemetry::metrics; diff --git a/sdk/include/opentelemetry/sdk/metrics/controller.h b/sdk/include/opentelemetry/sdk/_metrics/controller.h similarity index 93% rename from sdk/include/opentelemetry/sdk/metrics/controller.h rename to sdk/include/opentelemetry/sdk/_metrics/controller.h index 8161ffad03..f0cb1fc841 100644 --- a/sdk/include/opentelemetry/sdk/metrics/controller.h +++ b/sdk/include/opentelemetry/sdk/_metrics/controller.h @@ -9,12 +9,12 @@ # include # include # include -# include "opentelemetry/metrics/instrument.h" +# include "opentelemetry/_metrics/instrument.h" # include "opentelemetry/nostd/unique_ptr.h" -# include "opentelemetry/sdk/metrics/exporter.h" -# include "opentelemetry/sdk/metrics/meter.h" -# include "opentelemetry/sdk/metrics/processor.h" -# include "opentelemetry/sdk/metrics/record.h" +# include "opentelemetry/sdk/_metrics/exporter.h" +# include "opentelemetry/sdk/_metrics/meter.h" +# include "opentelemetry/sdk/_metrics/processor.h" +# include "opentelemetry/sdk/_metrics/record.h" # include "opentelemetry/version.h" namespace metrics_api = opentelemetry::metrics; diff --git a/sdk/include/opentelemetry/sdk/metrics/exporter.h b/sdk/include/opentelemetry/sdk/_metrics/exporter.h similarity index 94% rename from sdk/include/opentelemetry/sdk/metrics/exporter.h rename to sdk/include/opentelemetry/sdk/_metrics/exporter.h index 05e28eda23..3279083d66 100644 --- a/sdk/include/opentelemetry/sdk/metrics/exporter.h +++ b/sdk/include/opentelemetry/sdk/_metrics/exporter.h @@ -6,7 +6,7 @@ # include # include "opentelemetry/sdk/common/exporter_utils.h" -# include "opentelemetry/sdk/metrics/record.h" +# include "opentelemetry/sdk/_metrics/record.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk diff --git a/sdk/include/opentelemetry/sdk/metrics/instrument.h b/sdk/include/opentelemetry/sdk/_metrics/instrument.h similarity index 98% rename from sdk/include/opentelemetry/sdk/metrics/instrument.h rename to sdk/include/opentelemetry/sdk/_metrics/instrument.h index 62707e17e7..b69b550fdc 100644 --- a/sdk/include/opentelemetry/sdk/metrics/instrument.h +++ b/sdk/include/opentelemetry/sdk/_metrics/instrument.h @@ -11,9 +11,9 @@ # include # include # include -# include "opentelemetry/metrics/instrument.h" -# include "opentelemetry/sdk/metrics/aggregator/aggregator.h" -# include "opentelemetry/sdk/metrics/record.h" +# include "opentelemetry/_metrics/instrument.h" +# include "opentelemetry/sdk/_metrics/aggregator/aggregator.h" +# include "opentelemetry/sdk/_metrics/record.h" # include "opentelemetry/version.h" namespace metrics_api = opentelemetry::metrics; diff --git a/sdk/include/opentelemetry/sdk/metrics/meter.h b/sdk/include/opentelemetry/sdk/_metrics/meter.h similarity index 98% rename from sdk/include/opentelemetry/sdk/metrics/meter.h rename to sdk/include/opentelemetry/sdk/_metrics/meter.h index a770584cd3..a045ab93b1 100644 --- a/sdk/include/opentelemetry/sdk/metrics/meter.h +++ b/sdk/include/opentelemetry/sdk/_metrics/meter.h @@ -4,12 +4,12 @@ #pragma once #ifdef ENABLE_METRICS_PREVIEW -# include "opentelemetry/metrics/meter.h" +# include "opentelemetry/_metrics/meter.h" # include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/sdk/metrics/async_instruments.h" -# include "opentelemetry/sdk/metrics/instrument.h" -# include "opentelemetry/sdk/metrics/record.h" -# include "opentelemetry/sdk/metrics/sync_instruments.h" +# include "opentelemetry/sdk/_metrics/async_instruments.h" +# include "opentelemetry/sdk/_metrics/instrument.h" +# include "opentelemetry/sdk/_metrics/record.h" +# include "opentelemetry/sdk/_metrics/sync_instruments.h" # include # include diff --git a/sdk/include/opentelemetry/sdk/metrics/meter_provider.h b/sdk/include/opentelemetry/sdk/_metrics/meter_provider.h similarity index 71% rename from sdk/include/opentelemetry/sdk/metrics/meter_provider.h rename to sdk/include/opentelemetry/sdk/_metrics/meter_provider.h index 59c180bda0..5d74b876b5 100644 --- a/sdk/include/opentelemetry/sdk/metrics/meter_provider.h +++ b/sdk/include/opentelemetry/sdk/_metrics/meter_provider.h @@ -4,9 +4,9 @@ #pragma once #ifdef ENABLE_METRICS_PREVIEW -# include "opentelemetry/metrics/meter_provider.h" +# include "opentelemetry/_metrics/meter_provider.h" # include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/sdk/metrics/meter.h" +# include "opentelemetry/sdk/_metrics/meter.h" # include # include @@ -28,6 +28,16 @@ class MeterProvider final : public opentelemetry::metrics::MeterProvider nostd::string_view library_name, nostd::string_view library_version = "") noexcept override; + /** + * Shutdown the meter provider. + */ + bool Shutdown() noexcept; + + /** + * Force flush the meter provider. + */ + bool ForceFlush(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept; + private: std::shared_ptr meter_; }; diff --git a/sdk/include/opentelemetry/sdk/metrics/processor.h b/sdk/include/opentelemetry/sdk/_metrics/processor.h similarity index 88% rename from sdk/include/opentelemetry/sdk/metrics/processor.h rename to sdk/include/opentelemetry/sdk/_metrics/processor.h index 94822a3e60..b37d63c5fa 100644 --- a/sdk/include/opentelemetry/sdk/metrics/processor.h +++ b/sdk/include/opentelemetry/sdk/_metrics/processor.h @@ -3,9 +3,9 @@ #pragma once #ifdef ENABLE_METRICS_PREVIEW -# include "opentelemetry/metrics/instrument.h" +# include "opentelemetry/_metrics/instrument.h" # include "opentelemetry/nostd/string_view.h" -# include "opentelemetry/sdk/metrics/record.h" +# include "opentelemetry/sdk/_metrics/record.h" # include "opentelemetry/version.h" # include diff --git a/sdk/include/opentelemetry/sdk/metrics/record.h b/sdk/include/opentelemetry/sdk/_metrics/record.h similarity index 92% rename from sdk/include/opentelemetry/sdk/metrics/record.h rename to sdk/include/opentelemetry/sdk/_metrics/record.h index d51349bd05..02d61b7116 100644 --- a/sdk/include/opentelemetry/sdk/metrics/record.h +++ b/sdk/include/opentelemetry/sdk/_metrics/record.h @@ -5,9 +5,9 @@ #ifdef ENABLE_METRICS_PREVIEW # include -# include "opentelemetry/metrics/instrument.h" +# include "opentelemetry/_metrics/instrument.h" # include "opentelemetry/nostd/variant.h" -# include "opentelemetry/sdk/metrics/aggregator/aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/aggregator.h" OPENTELEMETRY_BEGIN_NAMESPACE diff --git a/sdk/include/opentelemetry/sdk/metrics/sync_instruments.h b/sdk/include/opentelemetry/sdk/_metrics/sync_instruments.h similarity index 98% rename from sdk/include/opentelemetry/sdk/metrics/sync_instruments.h rename to sdk/include/opentelemetry/sdk/_metrics/sync_instruments.h index 0c1bd1a245..55890f44f0 100644 --- a/sdk/include/opentelemetry/sdk/metrics/sync_instruments.h +++ b/sdk/include/opentelemetry/sdk/_metrics/sync_instruments.h @@ -9,10 +9,10 @@ # include # include # include -# include "opentelemetry/metrics/sync_instruments.h" -# include "opentelemetry/sdk/metrics/aggregator/counter_aggregator.h" -# include "opentelemetry/sdk/metrics/aggregator/min_max_sum_count_aggregator.h" -# include "opentelemetry/sdk/metrics/instrument.h" +# include "opentelemetry/_metrics/sync_instruments.h" +# include "opentelemetry/sdk/_metrics/aggregator/counter_aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/min_max_sum_count_aggregator.h" +# include "opentelemetry/sdk/_metrics/instrument.h" namespace metrics_api = opentelemetry::metrics; diff --git a/sdk/include/opentelemetry/sdk/metrics/ungrouped_processor.h b/sdk/include/opentelemetry/sdk/_metrics/ungrouped_processor.h similarity index 95% rename from sdk/include/opentelemetry/sdk/metrics/ungrouped_processor.h rename to sdk/include/opentelemetry/sdk/_metrics/ungrouped_processor.h index 4441015d5b..2a12be4270 100644 --- a/sdk/include/opentelemetry/sdk/metrics/ungrouped_processor.h +++ b/sdk/include/opentelemetry/sdk/_metrics/ungrouped_processor.h @@ -5,14 +5,14 @@ #ifdef ENABLE_METRICS_PREVIEW # include -# include "opentelemetry/sdk/metrics/aggregator/counter_aggregator.h" -# include "opentelemetry/sdk/metrics/aggregator/exact_aggregator.h" -# include "opentelemetry/sdk/metrics/aggregator/gauge_aggregator.h" -# include "opentelemetry/sdk/metrics/aggregator/histogram_aggregator.h" -# include "opentelemetry/sdk/metrics/aggregator/min_max_sum_count_aggregator.h" -# include "opentelemetry/sdk/metrics/aggregator/sketch_aggregator.h" -# include "opentelemetry/sdk/metrics/processor.h" -# include "opentelemetry/sdk/metrics/record.h" +# include "opentelemetry/sdk/_metrics/aggregator/counter_aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/exact_aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/gauge_aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/histogram_aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/min_max_sum_count_aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/sketch_aggregator.h" +# include "opentelemetry/sdk/_metrics/processor.h" +# include "opentelemetry/sdk/_metrics/record.h" # include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE diff --git a/sdk/src/CMakeLists.txt b/sdk/src/CMakeLists.txt index 2261454239..1c868a1bf4 100644 --- a/sdk/src/CMakeLists.txt +++ b/sdk/src/CMakeLists.txt @@ -1,7 +1,7 @@ add_subdirectory(common) add_subdirectory(trace) if(WITH_METRICS_PREVIEW) - add_subdirectory(metrics) + add_subdirectory(_metrics) endif() if(WITH_LOGS_PREVIEW) add_subdirectory(logs) diff --git a/sdk/src/metrics/BUILD b/sdk/src/_metrics/BUILD similarity index 91% rename from sdk/src/metrics/BUILD rename to sdk/src/_metrics/BUILD index 8843706817..4b528dda77 100644 --- a/sdk/src/metrics/BUILD +++ b/sdk/src/_metrics/BUILD @@ -15,10 +15,10 @@ package(default_visibility = ["//visibility:public"]) cc_library( - name = "metrics", + name = "metrics_deprecated", srcs = glob(["**/*.cc"]), hdrs = glob(["**/*.h"]), - include_prefix = "src/metrics", + include_prefix = "src/_metrics", deps = [ "//api", "//sdk:headers", diff --git a/sdk/src/metrics/CMakeLists.txt b/sdk/src/_metrics/CMakeLists.txt similarity index 50% rename from sdk/src/metrics/CMakeLists.txt rename to sdk/src/_metrics/CMakeLists.txt index 7ff562b588..286a0f4be1 100644 --- a/sdk/src/metrics/CMakeLists.txt +++ b/sdk/src/_metrics/CMakeLists.txt @@ -1,16 +1,16 @@ -add_library(opentelemetry_metrics meter_provider.cc meter.cc +add_library(opentelemetry_metrics_deprecated meter_provider.cc meter.cc ungrouped_processor.cc) -set_target_properties(opentelemetry_metrics PROPERTIES EXPORT_NAME metrics) +set_target_properties(opentelemetry_metrics_deprecated PROPERTIES EXPORT_NAME metrics_deprecated) -target_link_libraries(opentelemetry_metrics PUBLIC opentelemetry_common) +target_link_libraries(opentelemetry_metrics_deprecated PUBLIC opentelemetry_common) target_include_directories( - opentelemetry_metrics + opentelemetry_metrics_deprecated PUBLIC "$") install( - TARGETS opentelemetry_metrics + TARGETS opentelemetry_metrics_deprecated EXPORT "${PROJECT_NAME}-target" RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/sdk/src/metrics/meter.cc b/sdk/src/_metrics/meter.cc similarity index 99% rename from sdk/src/metrics/meter.cc rename to sdk/src/_metrics/meter.cc index 13e73cbc9e..be5d094022 100644 --- a/sdk/src/metrics/meter.cc +++ b/sdk/src/_metrics/meter.cc @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 #ifdef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/meter.h" +# include "opentelemetry/sdk/_metrics/meter.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk { diff --git a/sdk/src/metrics/meter_provider.cc b/sdk/src/_metrics/meter_provider.cc similarity index 92% rename from sdk/src/metrics/meter_provider.cc rename to sdk/src/_metrics/meter_provider.cc index 903ba76e06..e3da4b686e 100644 --- a/sdk/src/metrics/meter_provider.cc +++ b/sdk/src/_metrics/meter_provider.cc @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 #ifdef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/meter_provider.h" +# include "opentelemetry/sdk/_metrics/meter_provider.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk diff --git a/sdk/src/metrics/ungrouped_processor.cc b/sdk/src/_metrics/ungrouped_processor.cc similarity index 98% rename from sdk/src/metrics/ungrouped_processor.cc rename to sdk/src/_metrics/ungrouped_processor.cc index c36cac2ca5..6d3598b59c 100644 --- a/sdk/src/metrics/ungrouped_processor.cc +++ b/sdk/src/_metrics/ungrouped_processor.cc @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 #ifdef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/ungrouped_processor.h" +# include "opentelemetry/sdk/_metrics/ungrouped_processor.h" OPENTELEMETRY_BEGIN_NAMESPACE diff --git a/sdk/test/CMakeLists.txt b/sdk/test/CMakeLists.txt index 6c9955d23d..445568665a 100644 --- a/sdk/test/CMakeLists.txt +++ b/sdk/test/CMakeLists.txt @@ -1,7 +1,7 @@ add_subdirectory(common) add_subdirectory(trace) if(WITH_METRICS_PREVIEW) - add_subdirectory(metrics) + add_subdirectory(_metrics) endif() if(WITH_LOGS_PREVIEW) add_subdirectory(logs) diff --git a/sdk/test/metrics/BUILD b/sdk/test/_metrics/BUILD similarity index 75% rename from sdk/test/metrics/BUILD rename to sdk/test/_metrics/BUILD index cebe041aff..f6356bd127 100644 --- a/sdk/test/metrics/BUILD +++ b/sdk/test/_metrics/BUILD @@ -4,8 +4,8 @@ cc_test( "controller_test.cc", ], deps = [ - "//exporters/ostream:ostream_metrics_exporter", - "//sdk/src/metrics", + "//exporters/ostream:ostream_metrics_exporter_deprecated", + "//sdk/src/_metrics:metrics_deprecated", "@com_google_googletest//:gtest_main", ], ) @@ -16,7 +16,7 @@ cc_test( "gauge_aggregator_test.cc", ], deps = [ - "//sdk/src/metrics", + "//sdk/src/_metrics:metrics_deprecated", "@com_google_googletest//:gtest_main", ], ) @@ -27,7 +27,7 @@ cc_test( "min_max_sum_count_aggregator_test.cc", ], deps = [ - "//sdk/src/metrics", + "//sdk/src/_metrics:metrics_deprecated", "@com_google_googletest//:gtest_main", ], ) @@ -38,7 +38,7 @@ cc_test( "meter_provider_sdk_test.cc", ], deps = [ - "//sdk/src/metrics", + "//sdk/src/_metrics:metrics_deprecated", "@com_google_googletest//:gtest_main", ], ) @@ -49,7 +49,7 @@ cc_test( "meter_test.cc", ], deps = [ - "//sdk/src/metrics", + "//sdk/src/_metrics:metrics_deprecated", "@com_google_googletest//:gtest_main", ], ) @@ -60,7 +60,7 @@ cc_test( "counter_aggregator_test.cc", ], deps = [ - "//sdk/src/metrics", + "//sdk/src/_metrics:metrics_deprecated", "@com_google_googletest//:gtest_main", ], ) @@ -71,7 +71,7 @@ cc_test( "exact_aggregator_test.cc", ], deps = [ - "//sdk/src/metrics", + "//sdk/src/_metrics:metrics_deprecated", "@com_google_googletest//:gtest_main", ], ) @@ -82,7 +82,7 @@ cc_test( "histogram_aggregator_test.cc", ], deps = [ - "//sdk/src/metrics", + "//sdk/src/_metrics:metrics_deprecated", "@com_google_googletest//:gtest_main", ], ) @@ -93,7 +93,7 @@ cc_test( "metric_instrument_test.cc", ], deps = [ - "//sdk/src/metrics", + "//sdk/src/_metrics:metrics_deprecated", "@com_google_googletest//:gtest_main", ], ) @@ -104,7 +104,7 @@ cc_test( "sketch_aggregator_test.cc", ], deps = [ - "//sdk/src/metrics", + "//sdk/src/_metrics:metrics_deprecated", "@com_google_googletest//:gtest_main", ], ) @@ -115,7 +115,7 @@ cc_test( "ungrouped_processor_test.cc", ], deps = [ - "//sdk/src/metrics", + "//sdk/src/_metrics:metrics_deprecated", "@com_google_googletest//:gtest_main", ], ) diff --git a/sdk/test/metrics/CMakeLists.txt b/sdk/test/_metrics/CMakeLists.txt similarity index 96% rename from sdk/test/metrics/CMakeLists.txt rename to sdk/test/_metrics/CMakeLists.txt index a33ccbf64b..f304c8945b 100644 --- a/sdk/test/metrics/CMakeLists.txt +++ b/sdk/test/_metrics/CMakeLists.txt @@ -12,7 +12,7 @@ foreach( controller_test) add_executable(${testname} "${testname}.cc") target_link_libraries(${testname} ${GTEST_BOTH_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} opentelemetry_metrics) + ${CMAKE_THREAD_LIBS_INIT} opentelemetry_metrics_deprecated) gtest_add_tests( TARGET ${testname} TEST_PREFIX metrics. diff --git a/sdk/test/metrics/controller_test.cc b/sdk/test/_metrics/controller_test.cc similarity index 100% rename from sdk/test/metrics/controller_test.cc rename to sdk/test/_metrics/controller_test.cc diff --git a/sdk/test/metrics/counter_aggregator_test.cc b/sdk/test/_metrics/counter_aggregator_test.cc similarity index 100% rename from sdk/test/metrics/counter_aggregator_test.cc rename to sdk/test/_metrics/counter_aggregator_test.cc diff --git a/sdk/test/metrics/exact_aggregator_test.cc b/sdk/test/_metrics/exact_aggregator_test.cc similarity index 100% rename from sdk/test/metrics/exact_aggregator_test.cc rename to sdk/test/_metrics/exact_aggregator_test.cc diff --git a/sdk/test/metrics/gauge_aggregator_test.cc b/sdk/test/_metrics/gauge_aggregator_test.cc similarity index 100% rename from sdk/test/metrics/gauge_aggregator_test.cc rename to sdk/test/_metrics/gauge_aggregator_test.cc diff --git a/sdk/test/metrics/histogram_aggregator_test.cc b/sdk/test/_metrics/histogram_aggregator_test.cc similarity index 100% rename from sdk/test/metrics/histogram_aggregator_test.cc rename to sdk/test/_metrics/histogram_aggregator_test.cc diff --git a/sdk/test/metrics/meter_provider_sdk_test.cc b/sdk/test/_metrics/meter_provider_sdk_test.cc similarity index 100% rename from sdk/test/metrics/meter_provider_sdk_test.cc rename to sdk/test/_metrics/meter_provider_sdk_test.cc diff --git a/sdk/test/metrics/meter_test.cc b/sdk/test/_metrics/meter_test.cc similarity index 100% rename from sdk/test/metrics/meter_test.cc rename to sdk/test/_metrics/meter_test.cc diff --git a/sdk/test/metrics/metric_instrument_test.cc b/sdk/test/_metrics/metric_instrument_test.cc similarity index 100% rename from sdk/test/metrics/metric_instrument_test.cc rename to sdk/test/_metrics/metric_instrument_test.cc diff --git a/sdk/test/metrics/min_max_sum_count_aggregator_test.cc b/sdk/test/_metrics/min_max_sum_count_aggregator_test.cc similarity index 100% rename from sdk/test/metrics/min_max_sum_count_aggregator_test.cc rename to sdk/test/_metrics/min_max_sum_count_aggregator_test.cc diff --git a/sdk/test/metrics/sketch_aggregator_test.cc b/sdk/test/_metrics/sketch_aggregator_test.cc similarity index 100% rename from sdk/test/metrics/sketch_aggregator_test.cc rename to sdk/test/_metrics/sketch_aggregator_test.cc diff --git a/sdk/test/metrics/ungrouped_processor_test.cc b/sdk/test/_metrics/ungrouped_processor_test.cc similarity index 100% rename from sdk/test/metrics/ungrouped_processor_test.cc rename to sdk/test/_metrics/ungrouped_processor_test.cc From a44407070e2760ee5d311d72a0add5276031b25c Mon Sep 17 00:00:00 2001 From: Lalit Date: Thu, 4 Nov 2021 11:07:28 -0700 Subject: [PATCH 2/8] format --- api/include/opentelemetry/_metrics/provider.h | 2 +- api/test/trace/noop_test.cc | 2 +- examples/metrics_simple/BUILD | 2 +- examples/metrics_simple/main.cc | 2 +- exporters/ostream/CMakeLists.txt | 3 ++- exporters/prometheus/CMakeLists.txt | 5 +++-- exporters/prometheus/test/prometheus_collector_test.cc | 2 +- .../opentelemetry/sdk/_metrics/aggregator/aggregator.h | 2 +- .../sdk/_metrics/aggregator/gauge_aggregator.h | 2 +- sdk/include/opentelemetry/sdk/_metrics/exporter.h | 2 +- sdk/src/_metrics/CMakeLists.txt | 8 +++++--- sdk/test/_metrics/BUILD | 2 +- sdk/test/_metrics/CMakeLists.txt | 5 +++-- 13 files changed, 22 insertions(+), 17 deletions(-) diff --git a/api/include/opentelemetry/_metrics/provider.h b/api/include/opentelemetry/_metrics/provider.h index 0e0c3cae46..e079b34d5f 100644 --- a/api/include/opentelemetry/_metrics/provider.h +++ b/api/include/opentelemetry/_metrics/provider.h @@ -5,9 +5,9 @@ #ifdef ENABLE_METRICS_PREVIEW # include -# include "opentelemetry/common/spin_lock_mutex.h" # include "opentelemetry/_metrics/meter_provider.h" # include "opentelemetry/_metrics/noop.h" +# include "opentelemetry/common/spin_lock_mutex.h" # include "opentelemetry/nostd/shared_ptr.h" OPENTELEMETRY_BEGIN_NAMESPACE diff --git a/api/test/trace/noop_test.cc b/api/test/trace/noop_test.cc index 876aaf7721..b17faf64d4 100644 --- a/api/test/trace/noop_test.cc +++ b/api/test/trace/noop_test.cc @@ -23,7 +23,7 @@ TEST(NoopTest, UseNoopTracers) s1->AddEvent("abc", attributes1); std::vector> attributes2; - s1->AddEvent("abc", attributes2); + s1->AddEvent("abc", attributes2); s1->AddEvent("abc", {{"a", 1}, {"b", "2"}, {"c", 3.0}}); diff --git a/examples/metrics_simple/BUILD b/examples/metrics_simple/BUILD index fa0fee5673..4eb3776934 100644 --- a/examples/metrics_simple/BUILD +++ b/examples/metrics_simple/BUILD @@ -7,6 +7,6 @@ cc_binary( deps = [ "//api", "//exporters/ostream:ostream_metrics_exporter_deprecated", - "//sdk/src/_metrics:metrics_deprecated", + "//sdk/src/_metrics:metrics_deprecated", ], ) diff --git a/examples/metrics_simple/main.cc b/examples/metrics_simple/main.cc index 2ed0981277..e2ab7f09f6 100644 --- a/examples/metrics_simple/main.cc +++ b/examples/metrics_simple/main.cc @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 #ifdef ENABLE_METRICS_PREVIEW -# include "opentelemetry/exporters/ostream/metrics_exporter.h" # include "opentelemetry/_metrics/provider.h" +# include "opentelemetry/exporters/ostream/metrics_exporter.h" # include "opentelemetry/sdk/_metrics/controller.h" # include "opentelemetry/sdk/_metrics/meter.h" # include "opentelemetry/sdk/_metrics/meter_provider.h" diff --git a/exporters/ostream/CMakeLists.txt b/exporters/ostream/CMakeLists.txt index 53b8a4c13e..e83719cce3 100644 --- a/exporters/ostream/CMakeLists.txt +++ b/exporters/ostream/CMakeLists.txt @@ -35,7 +35,8 @@ if(BUILD_TESTING) endif() # BUILD_TESTING if(WITH_METRICS_PREVIEW) - add_library(opentelemetry_exporter_ostream_metrics_deprecated src/metrics_exporter.cc) + add_library(opentelemetry_exporter_ostream_metrics_deprecated + src/metrics_exporter.cc) set_target_properties(opentelemetry_exporter_ostream_metrics_deprecated PROPERTIES EXPORT_NAME ostream_metrics_exporter) target_include_directories( diff --git a/exporters/prometheus/CMakeLists.txt b/exporters/prometheus/CMakeLists.txt index d9148ad5a2..e82094acf9 100644 --- a/exporters/prometheus/CMakeLists.txt +++ b/exporters/prometheus/CMakeLists.txt @@ -22,8 +22,9 @@ target_include_directories( PUBLIC "$" "$") -target_link_libraries(prometheus_exporter_deprecated PUBLIC opentelemetry_metrics_deprecated - prometheus-cpp::core) +target_link_libraries( + prometheus_exporter_deprecated PUBLIC opentelemetry_metrics_deprecated + prometheus-cpp::core) install( TARGETS prometheus_exporter diff --git a/exporters/prometheus/test/prometheus_collector_test.cc b/exporters/prometheus/test/prometheus_collector_test.cc index 263ce875bf..ef6c6023d8 100644 --- a/exporters/prometheus/test/prometheus_collector_test.cc +++ b/exporters/prometheus/test/prometheus_collector_test.cc @@ -7,8 +7,8 @@ # include # include -# include "opentelemetry/exporters/prometheus/prometheus_collector.h" # include "opentelemetry/_metrics/instrument.h" +# include "opentelemetry/exporters/prometheus/prometheus_collector.h" # include "opentelemetry/sdk/_metrics/aggregator/aggregator.h" # include "opentelemetry/sdk/_metrics/aggregator/counter_aggregator.h" # include "opentelemetry/sdk/_metrics/aggregator/exact_aggregator.h" diff --git a/sdk/include/opentelemetry/sdk/_metrics/aggregator/aggregator.h b/sdk/include/opentelemetry/sdk/_metrics/aggregator/aggregator.h index a5ae178ca3..fb90256d76 100644 --- a/sdk/include/opentelemetry/sdk/_metrics/aggregator/aggregator.h +++ b/sdk/include/opentelemetry/sdk/_metrics/aggregator/aggregator.h @@ -6,8 +6,8 @@ # include # include -# include "opentelemetry/common/timestamp.h" # include "opentelemetry/_metrics/instrument.h" +# include "opentelemetry/common/timestamp.h" # include "opentelemetry/version.h" namespace metrics_api = opentelemetry::metrics; diff --git a/sdk/include/opentelemetry/sdk/_metrics/aggregator/gauge_aggregator.h b/sdk/include/opentelemetry/sdk/_metrics/aggregator/gauge_aggregator.h index 809ba98712..e65702843c 100644 --- a/sdk/include/opentelemetry/sdk/_metrics/aggregator/gauge_aggregator.h +++ b/sdk/include/opentelemetry/sdk/_metrics/aggregator/gauge_aggregator.h @@ -4,8 +4,8 @@ #pragma once #ifdef ENABLE_METRICS_PREVIEW -# include "opentelemetry/common/timestamp.h" # include "opentelemetry/_metrics/instrument.h" +# include "opentelemetry/common/timestamp.h" # include "opentelemetry/sdk/_metrics/aggregator/aggregator.h" # include "opentelemetry/version.h" diff --git a/sdk/include/opentelemetry/sdk/_metrics/exporter.h b/sdk/include/opentelemetry/sdk/_metrics/exporter.h index 3279083d66..aae416527f 100644 --- a/sdk/include/opentelemetry/sdk/_metrics/exporter.h +++ b/sdk/include/opentelemetry/sdk/_metrics/exporter.h @@ -5,8 +5,8 @@ #ifdef ENABLE_METRICS_PREVIEW # include -# include "opentelemetry/sdk/common/exporter_utils.h" # include "opentelemetry/sdk/_metrics/record.h" +# include "opentelemetry/sdk/common/exporter_utils.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk diff --git a/sdk/src/_metrics/CMakeLists.txt b/sdk/src/_metrics/CMakeLists.txt index 286a0f4be1..c1717ce892 100644 --- a/sdk/src/_metrics/CMakeLists.txt +++ b/sdk/src/_metrics/CMakeLists.txt @@ -1,9 +1,11 @@ add_library(opentelemetry_metrics_deprecated meter_provider.cc meter.cc - ungrouped_processor.cc) + ungrouped_processor.cc) -set_target_properties(opentelemetry_metrics_deprecated PROPERTIES EXPORT_NAME metrics_deprecated) +set_target_properties(opentelemetry_metrics_deprecated + PROPERTIES EXPORT_NAME metrics_deprecated) -target_link_libraries(opentelemetry_metrics_deprecated PUBLIC opentelemetry_common) +target_link_libraries(opentelemetry_metrics_deprecated + PUBLIC opentelemetry_common) target_include_directories( opentelemetry_metrics_deprecated diff --git a/sdk/test/_metrics/BUILD b/sdk/test/_metrics/BUILD index f6356bd127..5118e1074e 100644 --- a/sdk/test/_metrics/BUILD +++ b/sdk/test/_metrics/BUILD @@ -5,7 +5,7 @@ cc_test( ], deps = [ "//exporters/ostream:ostream_metrics_exporter_deprecated", - "//sdk/src/_metrics:metrics_deprecated", + "//sdk/src/_metrics:metrics_deprecated", "@com_google_googletest//:gtest_main", ], ) diff --git a/sdk/test/_metrics/CMakeLists.txt b/sdk/test/_metrics/CMakeLists.txt index f304c8945b..5d950ffb3f 100644 --- a/sdk/test/_metrics/CMakeLists.txt +++ b/sdk/test/_metrics/CMakeLists.txt @@ -11,8 +11,9 @@ foreach( metric_instrument_test controller_test) add_executable(${testname} "${testname}.cc") - target_link_libraries(${testname} ${GTEST_BOTH_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} opentelemetry_metrics_deprecated) + target_link_libraries( + ${testname} ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} + opentelemetry_metrics_deprecated) gtest_add_tests( TARGET ${testname} TEST_PREFIX metrics. From ae33cb59b3873ad2081b3bf4043f8289f044daf7 Mon Sep 17 00:00:00 2001 From: Lalit Date: Thu, 4 Nov 2021 11:16:05 -0700 Subject: [PATCH 3/8] fix prometheus exporter target --- exporters/prometheus/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/exporters/prometheus/CMakeLists.txt b/exporters/prometheus/CMakeLists.txt index e82094acf9..42371f3fb9 100644 --- a/exporters/prometheus/CMakeLists.txt +++ b/exporters/prometheus/CMakeLists.txt @@ -14,11 +14,11 @@ find_package(prometheus-cpp CONFIG REQUIRED) -add_library(prometheus_exporter src/prometheus_collector.cc - src/prometheus_exporter_utils.cc) +add_library(prometheus_exporter_deprecated src/prometheus_collector.cc + src/prometheus_exporter_utils.cc) target_include_directories( - prometheus_exporter + prometheus_exporter_deprecated PUBLIC "$" "$") @@ -27,7 +27,7 @@ target_link_libraries( prometheus-cpp::core) install( - TARGETS prometheus_exporter + TARGETS prometheus_exporter_deprecated EXPORT "${PROJECT_NAME}-target" RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} From 717272530bbbd01f8a058b21dbeb8ae98169eddd Mon Sep 17 00:00:00 2001 From: Lalit Date: Thu, 4 Nov 2021 11:30:31 -0700 Subject: [PATCH 4/8] fix sdk tests --- sdk/test/_metrics/controller_test.cc | 6 +++--- sdk/test/_metrics/counter_aggregator_test.cc | 2 +- sdk/test/_metrics/exact_aggregator_test.cc | 2 +- sdk/test/_metrics/gauge_aggregator_test.cc | 2 +- sdk/test/_metrics/histogram_aggregator_test.cc | 2 +- sdk/test/_metrics/meter_provider_sdk_test.cc | 4 ++-- sdk/test/_metrics/meter_test.cc | 2 +- sdk/test/_metrics/metric_instrument_test.cc | 4 ++-- sdk/test/_metrics/min_max_sum_count_aggregator_test.cc | 2 +- sdk/test/_metrics/sketch_aggregator_test.cc | 2 +- sdk/test/_metrics/ungrouped_processor_test.cc | 4 ++-- 11 files changed, 16 insertions(+), 16 deletions(-) diff --git a/sdk/test/_metrics/controller_test.cc b/sdk/test/_metrics/controller_test.cc index b90f1d1bcc..aa92c8d040 100644 --- a/sdk/test/_metrics/controller_test.cc +++ b/sdk/test/_metrics/controller_test.cc @@ -2,9 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 #ifdef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/controller.h" -# include "opentelemetry/sdk/metrics/meter.h" -# include "opentelemetry/sdk/metrics/ungrouped_processor.h" +# include "opentelemetry/sdk/_metrics/controller.h" +# include "opentelemetry/sdk/_metrics/meter.h" +# include "opentelemetry/sdk/_metrics/ungrouped_processor.h" # include # include diff --git a/sdk/test/_metrics/counter_aggregator_test.cc b/sdk/test/_metrics/counter_aggregator_test.cc index fe3ab7e036..7ef452e770 100644 --- a/sdk/test/_metrics/counter_aggregator_test.cc +++ b/sdk/test/_metrics/counter_aggregator_test.cc @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 #ifdef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/aggregator/counter_aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/counter_aggregator.h" # include # include diff --git a/sdk/test/_metrics/exact_aggregator_test.cc b/sdk/test/_metrics/exact_aggregator_test.cc index 88ce1a4432..cea9dda535 100644 --- a/sdk/test/_metrics/exact_aggregator_test.cc +++ b/sdk/test/_metrics/exact_aggregator_test.cc @@ -6,7 +6,7 @@ #ifdef ENABLE_METRICS_PREVIEW # include -# include "opentelemetry/sdk/metrics/aggregator/exact_aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/exact_aggregator.h" using namespace opentelemetry::sdk::metrics; diff --git a/sdk/test/_metrics/gauge_aggregator_test.cc b/sdk/test/_metrics/gauge_aggregator_test.cc index b2721b8b51..fb323c33ab 100644 --- a/sdk/test/_metrics/gauge_aggregator_test.cc +++ b/sdk/test/_metrics/gauge_aggregator_test.cc @@ -5,7 +5,7 @@ # include # include -# include "opentelemetry/sdk/metrics/aggregator/gauge_aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/gauge_aggregator.h" using namespace opentelemetry::sdk::metrics; diff --git a/sdk/test/_metrics/histogram_aggregator_test.cc b/sdk/test/_metrics/histogram_aggregator_test.cc index eec00e8360..daf920aa73 100644 --- a/sdk/test/_metrics/histogram_aggregator_test.cc +++ b/sdk/test/_metrics/histogram_aggregator_test.cc @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 #ifdef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/aggregator/histogram_aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/histogram_aggregator.h" # include # include diff --git a/sdk/test/_metrics/meter_provider_sdk_test.cc b/sdk/test/_metrics/meter_provider_sdk_test.cc index 459fbabd8f..2181bb62a2 100644 --- a/sdk/test/_metrics/meter_provider_sdk_test.cc +++ b/sdk/test/_metrics/meter_provider_sdk_test.cc @@ -4,8 +4,8 @@ #ifdef ENABLE_METRICS_PREVIEW # include -# include "opentelemetry/sdk/metrics/meter.h" -# include "opentelemetry/sdk/metrics/meter_provider.h" +# include "opentelemetry/sdk/_metrics/meter.h" +# include "opentelemetry/sdk/_metrics/meter_provider.h" using namespace opentelemetry::sdk::metrics; diff --git a/sdk/test/_metrics/meter_test.cc b/sdk/test/_metrics/meter_test.cc index 3c708fca92..4ee44e6b9b 100644 --- a/sdk/test/_metrics/meter_test.cc +++ b/sdk/test/_metrics/meter_test.cc @@ -5,7 +5,7 @@ # include # include -# include "opentelemetry/sdk/metrics/meter.h" +# include "opentelemetry/sdk/_metrics/meter.h" using namespace opentelemetry::sdk::metrics; namespace metrics_api = opentelemetry::metrics; diff --git a/sdk/test/_metrics/metric_instrument_test.cc b/sdk/test/_metrics/metric_instrument_test.cc index 461d3603f7..089baf1211 100644 --- a/sdk/test/_metrics/metric_instrument_test.cc +++ b/sdk/test/_metrics/metric_instrument_test.cc @@ -9,8 +9,8 @@ # include # include # include -# include "opentelemetry/sdk/metrics/async_instruments.h" -# include "opentelemetry/sdk/metrics/sync_instruments.h" +# include "opentelemetry/sdk/_metrics/async_instruments.h" +# include "opentelemetry/sdk/_metrics/sync_instruments.h" namespace metrics_api = opentelemetry::metrics; diff --git a/sdk/test/_metrics/min_max_sum_count_aggregator_test.cc b/sdk/test/_metrics/min_max_sum_count_aggregator_test.cc index 62b2b6763d..c73ea9aedb 100644 --- a/sdk/test/_metrics/min_max_sum_count_aggregator_test.cc +++ b/sdk/test/_metrics/min_max_sum_count_aggregator_test.cc @@ -5,7 +5,7 @@ # include # include -# include "opentelemetry/sdk/metrics/aggregator/min_max_sum_count_aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/min_max_sum_count_aggregator.h" using namespace opentelemetry::sdk::metrics; diff --git a/sdk/test/_metrics/sketch_aggregator_test.cc b/sdk/test/_metrics/sketch_aggregator_test.cc index c17900e0a6..6dc2fbef38 100644 --- a/sdk/test/_metrics/sketch_aggregator_test.cc +++ b/sdk/test/_metrics/sketch_aggregator_test.cc @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 #ifdef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/aggregator/sketch_aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/sketch_aggregator.h" # include # include diff --git a/sdk/test/_metrics/ungrouped_processor_test.cc b/sdk/test/_metrics/ungrouped_processor_test.cc index 6bfbd0cde3..cfa06e6b06 100644 --- a/sdk/test/_metrics/ungrouped_processor_test.cc +++ b/sdk/test/_metrics/ungrouped_processor_test.cc @@ -2,10 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 #ifdef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/ungrouped_processor.h" +# include "opentelemetry/sdk/_metrics/ungrouped_processor.h" # include # include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/sdk/metrics/aggregator/counter_aggregator.h" +# include "opentelemetry/sdk/_metrics/aggregator/counter_aggregator.h" namespace sdkmetrics = opentelemetry::sdk::metrics; namespace metrics_api = opentelemetry::metrics; From 41b52ee4ea90414f4f04bbe6adee589072c311ce Mon Sep 17 00:00:00 2001 From: Lalit Date: Thu, 4 Nov 2021 11:39:39 -0700 Subject: [PATCH 5/8] revert incorrect commit --- .../opentelemetry/sdk/_metrics/meter_provider.h | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/sdk/include/opentelemetry/sdk/_metrics/meter_provider.h b/sdk/include/opentelemetry/sdk/_metrics/meter_provider.h index 5d74b876b5..da218ceacd 100644 --- a/sdk/include/opentelemetry/sdk/_metrics/meter_provider.h +++ b/sdk/include/opentelemetry/sdk/_metrics/meter_provider.h @@ -28,16 +28,6 @@ class MeterProvider final : public opentelemetry::metrics::MeterProvider nostd::string_view library_name, nostd::string_view library_version = "") noexcept override; - /** - * Shutdown the meter provider. - */ - bool Shutdown() noexcept; - - /** - * Force flush the meter provider. - */ - bool ForceFlush(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept; - private: std::shared_ptr meter_; }; From 68e0fe34c7a2315779da09150f3f49552537856c Mon Sep 17 00:00:00 2001 From: Lalit Date: Thu, 4 Nov 2021 12:25:54 -0700 Subject: [PATCH 6/8] prometheus build --- exporters/prometheus/CMakeLists.txt | 1 + exporters/prometheus/test/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/exporters/prometheus/CMakeLists.txt b/exporters/prometheus/CMakeLists.txt index 42371f3fb9..6d3289243a 100644 --- a/exporters/prometheus/CMakeLists.txt +++ b/exporters/prometheus/CMakeLists.txt @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +include_directories(include) find_package(prometheus-cpp CONFIG REQUIRED) add_library(prometheus_exporter_deprecated src/prometheus_collector.cc diff --git a/exporters/prometheus/test/CMakeLists.txt b/exporters/prometheus/test/CMakeLists.txt index 4168c6d3e4..11f0d2999d 100644 --- a/exporters/prometheus/test/CMakeLists.txt +++ b/exporters/prometheus/test/CMakeLists.txt @@ -2,7 +2,7 @@ foreach(testname prometheus_collector_test prometheus_exporter_utils_test) add_executable(${testname} "${testname}.cc") target_link_libraries( ${testname} ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} - prometheus_exporter prometheus-cpp::pull) + prometheus_exporter_deprecated prometheus-cpp::pull) gtest_add_tests( TARGET ${testname} TEST_PREFIX exporter. From e15000f2c28401d381bc198b0d2b39db7d33e61f Mon Sep 17 00:00:00 2001 From: Lalit Date: Thu, 4 Nov 2021 16:04:35 -0700 Subject: [PATCH 7/8] update README for metrics specs --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ac866ec985..d4433eaa9f 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,11 @@ The C++ [OpenTelemetry](https://opentelemetry.io/) client. | Signal | Status | Project | | ------- | ---------------------- | ------------------------------------------------------------------------ | -| Traces | Public Release | N/A | -| Metrics | Development paused [1] | N/A | +| Traces | Public Release | N/A | +| Metrics | Development [1] | N/A | | Logs | Experimental [2] | N/A | -* [1]: The development of the metrics API and SDK has paused due to limited development resources, prioritization of a stable Traces release, and waiting for availability of stable Metrics (API + SDK) design from the OpenTelemetry specification. The current implementation can be included in build by setting `ENABLE_METRICS_PREVIEW` preprocessor macro. +* [1]: The development of the metrics API and SDK based on new stable specification is ongoing. The timelines would be updated in release milestone. The earlier implementation (based on old specification) can be included in build by setting `ENABLE_METRICS_PREVIEW` preprocessor macro, and is included under `*/_metrics/*` directory. * [2]: The current Log Signal Implementation is Experimental, and will change as the current OpenTelemetry Log specification matures. The current implementation can be included in build by setting `ENABLE_LOGS_PREVIEW` preprocessor macro. ## OpenTelemetry Specification Compatibility Matrix From 8aa27a4d445b981c02795c2c60f81c44cdfa745a Mon Sep 17 00:00:00 2001 From: Lalit Date: Thu, 4 Nov 2021 16:11:20 -0700 Subject: [PATCH 8/8] more doc update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d4433eaa9f..0bd75448b9 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ The C++ [OpenTelemetry](https://opentelemetry.io/) client. | Metrics | Development [1] | N/A | | Logs | Experimental [2] | N/A | -* [1]: The development of the metrics API and SDK based on new stable specification is ongoing. The timelines would be updated in release milestone. The earlier implementation (based on old specification) can be included in build by setting `ENABLE_METRICS_PREVIEW` preprocessor macro, and is included under `*/_metrics/*` directory. +* [1]: The development of the metrics API and SDK based on new stable specification is ongoing. The timelines would be available in release milestone. The earlier implementation (based on old specification) can be included in build by setting `ENABLE_METRICS_PREVIEW` preprocessor macro, and is included under `*/_metrics/*` directory. This would be eventually removed once the ongoing implemetation is stable. * [2]: The current Log Signal Implementation is Experimental, and will change as the current OpenTelemetry Log specification matures. The current implementation can be included in build by setting `ENABLE_LOGS_PREVIEW` preprocessor macro. ## OpenTelemetry Specification Compatibility Matrix