Skip to content

Commit

Permalink
Merge branch 'main' into prometheus-exporter
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitb authored Apr 25, 2022
2 parents 021a1ee + bf8f433 commit abe26ce
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 8 deletions.
4 changes: 1 addition & 3 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ endif()
add_subdirectory(plugin)
add_subdirectory(simple)
add_subdirectory(batch)
if(WITH_METRICS_PREVIEW)
add_subdirectory(metrics_simple)
endif()
add_subdirectory(metrics_simple)
add_subdirectory(multithreaded)
add_subdirectory(multi_processor)
add_subdirectory(http)
1 change: 1 addition & 0 deletions examples/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ add_subdirectory(foo_library)
if(WITH_LOGS_PREVIEW)
add_subdirectory(logs_foo_library)
endif()
add_subdirectory(metrics_foo_library)
2 changes: 2 additions & 0 deletions examples/common/metrics_foo_library/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
add_library(common_metrics_foo_library foo_library.h foo_library.cc)
target_link_libraries(common_metrics_foo_library PUBLIC opentelemetry_api)
17 changes: 12 additions & 5 deletions examples/metrics_simple/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
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_deprecated
opentelemetry_exporter_ostream_metrics_deprecated)
if(WITH_METRICS_PREVIEW)
add_executable(simple_metrics main.cc)
target_link_libraries(
simple_metrics ${CMAKE_THREAD_LIBS_INIT} opentelemetry_metrics_deprecated
opentelemetry_exporter_ostream_metrics_deprecated)
else()
add_executable(metrics_ostream_example metrics_ostream.cc)
target_link_libraries(
metrics_ostream_example ${CMAKE_THREAD_LIBS_INIT} opentelemetry_metrics
opentelemetry_exporter_ostream_metrics opentelemetry_resources
common_metrics_foo_library)
endif()
29 changes: 29 additions & 0 deletions exporters/ostream/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,35 @@ if(WITH_METRICS_PREVIEW)
TEST_PREFIX exporter.
TEST_LIST ostream_metrics_test)
endif()
else()
add_library(opentelemetry_exporter_ostream_metrics src/metric_exporter.cc)
set_target_properties(opentelemetry_exporter_ostream_metrics
PROPERTIES EXPORT_NAME ostream_metrics_exporter)
target_include_directories(
opentelemetry_exporter_ostream_metrics
PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>")
target_link_libraries(opentelemetry_exporter_ostream_metrics
PUBLIC opentelemetry_metrics)
install(
TARGETS opentelemetry_exporter_ostream_metrics
EXPORT "${PROJECT_NAME}-target"
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(
DIRECTORY include/opentelemetry/exporters/ostream
DESTINATION include/opentelemetry/exporters
PATTERN "metric_exporter.h")
if(BUILD_TESTING)
add_executable(ostream_metric_test test/ostream_metric_test.cc)
target_link_libraries(
ostream_metric_test ${GTEST_BOTH_LIBRARIES}
opentelemetry_exporter_ostream_metrics opentelemetry_resources)
gtest_add_tests(
TARGET ostream_metric_test
TEST_PREFIX exporter.
TEST_LIST ostream_metric_test)
endif()
endif()

if(WITH_LOGS_PREVIEW)
Expand Down

0 comments on commit abe26ce

Please sign in to comment.