Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move old metrics implementation to different directory, and rename targets to *_deprecated #1053

Merged
merged 10 commits into from
Nov 5, 2021
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#pragma once
#ifdef ENABLE_METRICS_PREVIEW

# include "instrument.h"
# include "observer_result.h"
# include "opentelemetry/_metrics/instrument.h"
ThomsonTan marked this conversation as resolved.
Show resolved Hide resolved
# include "opentelemetry/_metrics/observer_result.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace metrics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#ifdef ENABLE_METRICS_PREVIEW
# include <mutex>

# include "opentelemetry/_metrics/meter_provider.h"
# include "opentelemetry/_metrics/noop.h"
# include "opentelemetry/common/spin_lock_mutex.h"
# include "opentelemetry/metrics/meter_provider.h"
# include "opentelemetry/metrics/noop.h"
# include "opentelemetry/nostd/shared_ptr.h"

OPENTELEMETRY_BEGIN_NAMESPACE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#pragma once
#ifdef ENABLE_METRICS_PREVIEW

# include "instrument.h"
# include "opentelemetry/_metrics/instrument.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace metrics
Expand Down
2 changes: 1 addition & 1 deletion api/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#ifdef ENABLE_METRICS_PREVIEW
# include <gtest/gtest.h>
# include "opentelemetry/metrics/provider.h"
# include "opentelemetry/_metrics/provider.h"
# include "opentelemetry/nostd/shared_ptr.h"

using opentelemetry::metrics::Meter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# include <map>
# include <string>

# include "opentelemetry/metrics/noop.h"
# include "opentelemetry/_metrics/noop.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace metrics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

#ifdef ENABLE_METRICS_PREVIEW
# include <gtest/gtest.h>
# 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 <array>
# include <memory>
Expand Down
4 changes: 2 additions & 2 deletions examples/metrics_simple/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
],
)
4 changes: 2 additions & 2 deletions examples/metrics_simple/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
10 changes: 5 additions & 5 deletions examples/metrics_simple/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
// SPDX-License-Identifier: Apache-2.0

#ifdef ENABLE_METRICS_PREVIEW
# include "opentelemetry/_metrics/provider.h"
# 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/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;
Expand Down
6 changes: 3 additions & 3 deletions exporters/ostream/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ cc_test(
)

cc_library(
name = "ostream_metrics_exporter",
name = "ostream_metrics_exporter_deprecated",
srcs = [
"src/metrics_exporter.cc",
],
Expand All @@ -33,15 +33,15 @@ cc_library(
],
strip_include_prefix = "include",
deps = [
"//sdk/src/metrics",
"//sdk/src/_metrics:metrics_deprecated",
],
)

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",
],
)
Expand Down
15 changes: 8 additions & 7 deletions exporters/ostream/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,17 @@ 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 "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>")
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}
Expand All @@ -56,7 +57,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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

# include <iostream>
# include <string>
# 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;
Expand Down
14 changes: 7 additions & 7 deletions exporters/ostream/test/ostream_metrics_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 <iostream>

Expand Down
14 changes: 8 additions & 6 deletions exporters/prometheus/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,23 @@
# 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 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 "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>"
"$<INSTALL_INTERFACE:include>")

target_link_libraries(prometheus_exporter PUBLIC opentelemetry_metrics
prometheus-cpp::core)
target_link_libraries(
prometheus_exporter_deprecated PUBLIC opentelemetry_metrics_deprecated
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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# include <mutex>
# include <vector>

# 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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# include <string>
# include <vector>

# include "opentelemetry/sdk/metrics/record.h"
# include "opentelemetry/sdk/_metrics/record.h"
# include "prometheus/metric_family.h"

namespace metric_sdk = opentelemetry::sdk::metrics;
Expand Down
2 changes: 1 addition & 1 deletion exporters/prometheus/src/prometheus_exporter_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# include <vector>

# 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;
Expand Down
2 changes: 1 addition & 1 deletion exporters/prometheus/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
18 changes: 9 additions & 9 deletions exporters/prometheus/test/prometheus_collector_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
# include <map>
# include <thread>

# include "opentelemetry/_metrics/instrument.h"
# 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/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;
Expand Down
12 changes: 6 additions & 6 deletions exporters/prometheus/test/prometheus_exporter_utils_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

# include <opentelemetry/version.h>
# 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;
Expand Down
2 changes: 1 addition & 1 deletion sdk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

# include <mutex>
# include <vector>
# include "opentelemetry/_metrics/instrument.h"
# include "opentelemetry/common/timestamp.h"
# include "opentelemetry/metrics/instrument.h"
# include "opentelemetry/version.h"

namespace metrics_api = opentelemetry::metrics;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

# include <mutex>
# include <vector>
# 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;
Expand Down
Loading