Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,23 @@ Increment the:

Breaking changes:

* [BUILD] Install an explicit list of ext headers instead of the whole
directory
[#4327](https://github.com/open-telemetry/opentelemetry-cpp/pull/4327)
* The `ext_common` component installed `include/opentelemetry/ext` with a
`*.h` glob. It now installs a named list, and these five headers are no
longer part of the package:
* `opentelemetry/ext/http/client/curl/http_client_curl.h`
* `opentelemetry/ext/http/client/curl/http_operation_curl.h`
* `opentelemetry/ext/http/client/detail/default_factory.h`
* `opentelemetry/ext/http/server/http_server.h`
* `opentelemetry/ext/http/server/socket_tools.h`
* Code that included any of them from an installed package will no longer
compile. A curl client is created through `http_client_factory_curl.h`,
which needs only the abstract `http_client_factory.h`. The two server
headers are an embedded test server; moving them out of `ext` is tracked
in #4332.

* [METRICS SDK] Rename Base2 Exponential Histogram Aggregation config field
[#4253](https://github.com/open-telemetry/opentelemetry-cpp/pull/4253)
* The public configuration member `max_buckets_` was renamed to `max_size_` to
Expand Down
3 changes: 3 additions & 0 deletions examples/http/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ if(WITH_HTTP_CLIENT_CURL)
http_server
PRIVATE opentelemetry-cpp::trace opentelemetry-cpp::http_client_curl
opentelemetry-cpp::ostream_span_exporter)
if(WIN32)
target_link_libraries(http_server PRIVATE ws2_32)
endif()
endif()
6 changes: 6 additions & 0 deletions exporters/otlp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1014,6 +1014,9 @@ if(BUILD_TESTING)
nlohmann_json::nlohmann_json
protobuf::libprotobuf
opentelemetry_test_common)
if(WIN32)
target_link_libraries(otlp_http_exporter_test ws2_32)
endif()
gtest_add_tests(
TARGET otlp_http_exporter_test
TEST_PREFIX exporter.otlp.
Expand Down Expand Up @@ -1041,6 +1044,9 @@ if(BUILD_TESTING)
opentelemetry_http_client_nosend
nlohmann_json::nlohmann_json
opentelemetry_test_common)
if(WIN32)
target_link_libraries(otlp_http_log_record_exporter_test ws2_32)
endif()
gtest_add_tests(
TARGET otlp_http_log_record_exporter_test
TEST_PREFIX exporter.otlp.
Expand Down
3 changes: 3 additions & 0 deletions exporters/zipkin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ if(BUILD_TESTING)
opentelemetry_resources
opentelemetry_http_client_nosend
CURL::libcurl)
if(WIN32)
target_link_libraries(zipkin_exporter_test ws2_32)
endif()

gtest_add_tests(
TARGET zipkin_exporter_test
Expand Down
37 changes: 28 additions & 9 deletions ext/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,21 @@ target_include_directories(
set_target_properties(opentelemetry_ext PROPERTIES EXPORT_NAME "ext")
target_link_libraries(opentelemetry_ext INTERFACE opentelemetry_api)

# The embedded HTTP server headers (socket_tools.h) call Winsock, so declare the
# dependency on the interface target. MSVC also autolinks via #pragma
# comment(lib), but MinGW/GCC ignore that, so consumers there would otherwise
# fail to resolve inet_pton/WSAStartup.
if(WIN32)
target_link_libraries(opentelemetry_ext INTERFACE ws2_32)
endif()

# client/detail/default_factory.h is an internal helper included by exporter
# sources rather than by any public header. client/curl/http_client_curl.h and
# client/curl/http_operation_curl.h are the curl implementation, reached through
# http_client_factory_curl.h, which depends on the abstract
# http_client_factory.h alone. server/http_server.h and server/socket_tools.h
# are the embedded server used by tests and the http example.
#
# The two directory excludes are what keeps client/detail and server out of the
# install tree entirely: install(DIRECTORY) creates a destination directory for
# every source directory it walks, so filtering on file names alone would leave
# both behind, empty.
#
# TODO: the embedded server headers do not belong beside the user facing ones
# under ext/include. Move them to an internal location such as test_common, see
# #4332.
otel_add_component(
COMPONENT
ext_common
Expand All @@ -29,7 +36,19 @@ otel_add_component(
"include/opentelemetry"
FILES_MATCHING
PATTERN
"*.h")
"http_client.h"
PATTERN
"http_client_factory.h"
PATTERN
"http_client_factory_curl.h"
PATTERN
"url_parser.h"
PATTERN
"detail"
EXCLUDE
PATTERN
"server"
EXCLUDE)

add_subdirectory(src)

Expand Down
11 changes: 8 additions & 3 deletions ext/test/http/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ if(WITH_HTTP_CLIENT_CURL)
${FILENAME}
PRIVATE ${GMOCK_LIB} ${GTEST_BOTH_LIBRARIES} opentelemetry_http_client_curl
opentelemetry_common CURL::libcurl)
if(WIN32)
target_link_libraries(${FILENAME} PRIVATE ws2_32)
endif()
gtest_add_tests(
TARGET ${FILENAME}
TEST_PREFIX ext.http.curl.
Expand All @@ -18,9 +21,11 @@ set(SOCKET_TOOLS_FILENAME socket_tools_test)
add_executable(${SOCKET_TOOLS_FILENAME} ${SOCKET_TOOLS_FILENAME}.cc)
target_link_libraries(${SOCKET_TOOLS_FILENAME} opentelemetry_ext ${GMOCK_LIB}
${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
# ws2_32 is now an interface dependency of opentelemetry_ext, so it is inherited
# here; the test thus verifies the public target's usage requirements rather
# than papering over them locally.
# socket_tools.h calls Winsock, and the ext interface target no longer carries
# that link because it is only needed where the embedded server is compiled.
if(WIN32)
target_link_libraries(${SOCKET_TOOLS_FILENAME} ws2_32)
endif()
gtest_add_tests(
TARGET ${SOCKET_TOOLS_FILENAME}
TEST_PREFIX ext.http.sockettools.
Expand Down
3 changes: 3 additions & 0 deletions ext/test/w3c_tracecontext_http_test_server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ if(WITH_HTTP_CLIENT_CURL)
PRIVATE ${CMAKE_THREAD_LIBS_INIT} opentelemetry_trace
opentelemetry_http_client_curl opentelemetry_exporter_ostream_span
CURL::libcurl nlohmann_json::nlohmann_json)
if(WIN32)
target_link_libraries(w3c_tracecontext_http_test_server PRIVATE ws2_32)
endif()
endif()
8 changes: 4 additions & 4 deletions install/test/cmake/examples_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ if("exporters_etw" IN_LIST OPENTELEMETRY_CPP_COMPONENTS_INSTALLED)
set(WITH_ETW ON)
endif()

if("ext_http_curl" IN_LIST OPENTELEMETRY_CPP_COMPONENTS_INSTALLED)
set(WITH_EXAMPLES_HTTP ON)
set(WITH_HTTP_CLIENT_CURL ON)
endif()
# The http example uses the embedded server headers, which the package no longer
# installs. The ext headers it does use are covered by
# install/test/src/test_ext_*.cc.
set(WITH_EXAMPLES_HTTP OFF)

if("configuration" IN_LIST OPENTELEMETRY_CPP_COMPONENTS_INSTALLED)
set(WITH_CONFIGURATION ON)
Expand Down
Loading