Skip to content
Open
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
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,22 @@ Increment the:

## [Unreleased]

* [BUILD] Narrow the `//ext:headers` Bazel target to the four headers the
CMake package installs, and add internal targets for the rest
[#4634](https://github.com/open-telemetry/opentelemetry-cpp/pull/4634)
* `//ext:headers` now exposes only the four that `ext/CMakeLists.txt`
installs: `http/client/http_client.h`,
`http/client/http_client_factory.h`,
`http/client/curl/http_client_factory_curl.h` and
`http/common/url_parser.h`.
* Code that included any of the other six moves to an internal target:
`//ext:curl_implementation_headers` or `//ext:http_client_detail` in
`implementation_deps`, and `//ext:server_headers` for tests and examples.
* CMake narrowed to the same four in #4327, which first shipped in 1.29.0.
A CMake consumer of the other six lost them there, so this change brings
the Bazel surface in line rather than removing anything CMake still
installs.

* [SDK] Release provider mutexes before construction-failure diagnostics so
custom log handlers can retrieve cached or noop tracers, loggers, and meters
from the same provider without deadlocking.
Expand Down
1 change: 1 addition & 0 deletions examples/http/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ cc_binary(
"//api",
"//exporters/ostream:ostream_span_exporter",
"//ext:headers",
"//ext:server_headers",
"//sdk/src/trace",
],
)
3 changes: 3 additions & 0 deletions exporters/elasticsearch/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ cc_library(
"include/opentelemetry/exporters/elasticsearch/es_log_record_exporter.h",
"include/opentelemetry/exporters/elasticsearch/es_log_recordable.h",
],
implementation_deps = [
"//ext:http_client_detail",
],
linkopts = select({
"//bazel:windows": [
"-DEFAULTLIB:advapi32.lib",
Expand Down
4 changes: 4 additions & 0 deletions exporters/otlp/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ cc_library(
copts = [
"-DCURL_STATICLIB",
],
implementation_deps = [
"//ext:http_client_detail",
],
linkopts = select({
"//bazel:windows": [
"-DEFAULTLIB:advapi32.lib",
Expand Down Expand Up @@ -798,6 +801,7 @@ cc_test(
deps = [
":otlp_http_exporter",
"//api",
"//ext:server_headers",
"//sdk/src/metrics",
"//test_common/src/http/client/nosend:http_client_nosend",
"@com_google_googletest//:gtest_main",
Expand Down
4 changes: 4 additions & 0 deletions exporters/zipkin/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ cc_library(
copts = [
"-DCURL_STATICLIB",
],
implementation_deps = [
"//ext:http_client_detail",
],
strip_include_prefix = "include",
tags = ["zipkin"],
deps = [
Expand Down Expand Up @@ -68,6 +71,7 @@ cc_test(
deps = [
":zipkin_exporter",
":zipkin_recordable",
"//ext:curl_implementation_headers",
"//test_common/src/http/client/nosend:http_client_nosend",
"@com_google_googletest//:gtest_main",
],
Expand Down
74 changes: 72 additions & 2 deletions ext/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,83 @@ load("@rules_cc//cc:cc_library.bzl", "cc_library")

package(default_visibility = ["//visibility:public"])

# Headers installed by CMake and exposed to Bazel consumers
cc_library(
name = "headers",
hdrs = glob(["include/**/*.h"]),
hdrs = [
"include/opentelemetry/ext/http/client/curl/http_client_factory_curl.h",
"include/opentelemetry/ext/http/client/http_client.h",
"include/opentelemetry/ext/http/client/http_client_factory.h",
"include/opentelemetry/ext/http/common/url_parser.h",
],
strip_include_prefix = "include",
deps = [
"//api",
],
)

# Internal: curl implementation headers
# Used by: the curl client itself, its tests, and the w3c test server
# These are implementation details and are not installed by CMake
cc_library(
name = "curl_implementation_headers",
hdrs = [
"include/opentelemetry/ext/http/client/curl/http_client_curl.h",
"include/opentelemetry/ext/http/client/curl/http_operation_curl.h",
"include/opentelemetry/ext/http/client/curl/http_time_util.h",
],
strip_include_prefix = "include",
visibility = [
"//exporters/zipkin:__pkg__",
"//ext/src/http/client/curl:__pkg__",
"//ext/test/http:__pkg__",
"//ext/test/w3c_tracecontext_http_test_server:__pkg__",
],
deps = [
":headers",
"@curl",
],
)

# Internal: Detail headers for factory implementations
# Used by: exporters/otlp, exporters/elasticsearch, exporters/zipkin
cc_library(
name = "http_client_detail",
hdrs = [
"include/opentelemetry/ext/http/client/detail/default_factory.h",
],
strip_include_prefix = "include",
visibility = [
"//exporters/elasticsearch:__pkg__",
"//exporters/otlp:__pkg__",
"//exporters/zipkin:__pkg__",
],
deps = [
":headers",
],
)

# Internal: Embedded HTTP server headers (test and example use only)
# TODO: Move to test_common per issue #4332
# These are test infrastructure, not part of the public API
cc_library(
name = "server_headers",
hdrs = [
"include/opentelemetry/ext/http/server/http_server.h",
"include/opentelemetry/ext/http/server/socket_tools.h",
],
linkopts = select({
# socket_tools.h calls Winsock; declare it on the interface so consumers link it too.
"//bazel:windows": ["-DEFAULTLIB:Ws2_32.lib"],
"//conditions:default": [],
}),
strip_include_prefix = "include",
visibility = [
"//examples/http:__pkg__",
"//exporters/otlp:__pkg__",
"//ext/test/http:__pkg__",
"//ext/test/w3c_tracecontext_http_test_server:__pkg__",
],
deps = [
"//api",
],
)
3 changes: 3 additions & 0 deletions ext/src/http/client/curl/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ cc_library(
defines = [
"ENABLE_HTTP_CLIENT_CURL",
],
implementation_deps = [
"//ext:curl_implementation_headers",
],
include_prefix = "src/http/client/curl",
linkopts = select({
"//bazel:windows": [
Expand Down
5 changes: 3 additions & 2 deletions ext/test/http/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ cc_test(
srcs = [
"socket_tools_test.cc",
],
# ws2_32 is an interface linkopt of //ext:headers, so it is inherited here rather than
# relinked, which also lets the test verify the public target's usage requirements.
tags = ["test"],
deps = [
"//ext:headers",
"//ext:server_headers",
"@com_google_googletest//:gtest_main",
],
)
Expand All @@ -24,7 +23,9 @@ cc_test(
],
tags = ["test"],
deps = [
"//ext:curl_implementation_headers",
"//ext:headers",
"//ext:server_headers",
"//ext/src/http/client/curl:http_client_curl",
"//sdk/src/trace",
"@com_google_googletest//:gtest_main",
Expand Down
2 changes: 2 additions & 0 deletions ext/test/w3c_tracecontext_http_test_server/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ cc_binary(
deps = [
"//api",
"//exporters/ostream:ostream_span_exporter",
"//ext:curl_implementation_headers",
"//ext:headers",
"//ext:server_headers",
"//ext/src/http/client/curl:http_client_curl",
"//sdk/src/trace",
"@curl",
Expand Down