Skip to content

[BUILD] Narrow ext:headers to public API and create internal targets - #4634

Open
ParthibanRajasekaran wants to merge 6 commits into
open-telemetry:mainfrom
ParthibanRajasekaran:fix/4625-narrow-ext-headers
Open

ParthibanRajasekaran wants to merge 6 commits into
open-telemetry:mainfrom
ParthibanRajasekaran:fix/4625-narrow-ext-headers

Conversation

@ParthibanRajasekaran

Copy link
Copy Markdown

Summary

This PR narrows the public Bazel target //ext:headers to match CMakeLists.txt's explicit install list, addressing issue #4625. The split creates separate internal targets for implementation details, improving build system consistency and preventing accidental API surface expansion.

Changes

  1. Narrow public API (//ext:headers): 4 stable headers only

    • http_client.h
    • http_client_factory.h
    • http_client_factory_curl.h
    • url_parser.h
  2. Create internal targets:

    • //ext/src/http/client/curl:implementation_headers - Curl internals (used by curl client, tests, w3c server)
    • //ext:http_client_detail - Factory helper (used by exporters)
    • //ext:server_headers - Server infrastructure (used by tests and examples)
  3. Update 13+ dependents: All targets updated to use correct internal targets

  4. Document breaking change: v2.0.0 CHANGELOG entry with migration examples

Verification

  • All 13+ direct dependents build on Linux, macOS, Windows
  • Transitive dependencies verified (zipkin case through test_common)
  • examples/custom_http_client builds unchanged (public surface complete)
  • No circular dependencies introduced
  • Platform-specific linkage (ws2_32) properly isolated

Breaking Changes

This is a v2.0.0 major version bump (not backward compatible). The 6 headers below are no longer exposed in the public API:

  • opentelemetry/ext/http/client/curl/http_client_curl.h
  • opentelemetry/ext/http/client/curl/http_operation_curl.h
  • opentelemetry/ext/http/client/curl/http_time_util.h
  • opentelemetry/ext/http/client/detail/default_factory.h
  • opentelemetry/ext/http/server/http_server.h
  • opentelemetry/ext/http/server/socket_tools.h

Migration: Use internal targets instead (see CHANGELOG.md for examples)

Alignment

Closes #4625

Replace glob pattern with explicit list of stable headers that form
the public HTTP client API. Aligns Bazel with CMakeLists.txt which
has maintained this narrower surface for 2+ years.

Public surface:
- http_client.h
- http_client_factory.h
- http_client_factory_curl.h
- url_parser.h

These are the only headers users should depend on directly. Internal
headers (curl, detail, server) are implementation details that may
change and are moved to internal targets.

Fixes issue open-telemetry#4625. See CHANGELOG.md for breaking change notice in v2.0.0.
Curl client internals (http_client_curl.h, http_operation_curl.h,
http_time_util.h) are implementation details reached through the
public http_client_factory_curl.h abstraction. Move to internal target.

Used by:
- ext/src/http/client/curl library
- ext/test/http tests
- ext/test/w3c_tracecontext_http_test_server

Adds ws2_32 linkage on Windows (required by http_operation_curl.h).

Part of v2.0.0 breaking change to align Bazel with CMake.
Embedded HTTP server headers (http_server.h, socket_tools.h) are
test and example infrastructure, not part of the public API.

Move to internal target with limited visibility. These headers should
eventually move to test_common per issue open-telemetry#4332.

Adds ws2_32 linkage on Windows (required by socket_tools.h).

Part of v2.0.0 breaking change.
All 13 direct dependents updated to use correct internal targets:
- ext/test/http, ext/test/w3c_tracecontext_http_test_server depend on
  curl:implementation_headers and server:server_headers
- examples/http depends on server:server_headers
- exporters/otlp (4 locations), exporters/elasticsearch, exporters/zipkin
  depend on http_client_detail for factory helper
- examples/custom_http_client and test_common unchanged (use public only)

Verified:
- All 13+ targets build on Linux, macOS, Windows
- Transitive dependencies correct (zipkin through test_common)
- examples/custom_http_client builds unchanged (public surface complete)

Part of v2.0.0 breaking change to align Bazel with CMake.
Bazel target //ext:headers narrowed to 4 public headers, matching
CMakeLists.txt's install manifest for 2+ years. Internal headers
(curl, detail, server) moved to separate targets.

This aligns Bazel with CMake and prevents accidental exposure of
implementation details.

Users depending on removed headers must migrate to new internal
targets. See CHANGELOG.md for upgrade path.

Fixes issue open-telemetry#4625.
@ParthibanRajasekaran
ParthibanRajasekaran requested a review from a team as a code owner September 23, 2026 19:32
@linux-foundation-easycla

linux-foundation-easycla Bot commented Sep 23, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

@ParthibanRajasekaran

Copy link
Copy Markdown
Author

@thc1006 @dbarker - Ready for review on this one. Narrowed ext:headers to match what CMakeLists.txt has been doing for a while now. Created separate internal targets for the curl/server/detail headers.

All 13 direct dependents updated and verified. examples/custom_http_client still builds with just the public 4 headers - that's the proof the surface is right.

Let me know if anything needs adjusting.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUILD] Bazel //ext:headers exposes headers the CMake install excludes

1 participant