Skip to content

Commit

Permalink
ostream metrics cmake (#1344)
Browse files Browse the repository at this point in the history
  • Loading branch information
esigo authored Apr 21, 2022
1 parent 7fde3bc commit bf8f433
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

1 comment on commit bf8f433

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'OpenTelemetry-cpp sdk Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: bf8f433 Previous: 7fde3bc Ratio
BM_BaselineBuffer/1 21346502.30407715 ns/iter 488180.5882058851 ns/iter 43.73
BM_LockFreeBuffer/1 3488210.439682007 ns/iter 413985.41943456914 ns/iter 8.43

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.