Skip to content

[SDK] Support TracerConfigurator updates#4065

Open
dbarker wants to merge 7 commits into
open-telemetry:mainfrom
dbarker:feature_tracer_configurator_updates
Open

[SDK] Support TracerConfigurator updates#4065
dbarker wants to merge 7 commits into
open-telemetry:mainfrom
dbarker:feature_tracer_configurator_updates

Conversation

@dbarker
Copy link
Copy Markdown
Member

@dbarker dbarker commented May 7, 2026

Add support for updating the TracerConfigurator at runtime and provide an example.

The TracerProvider configuration includes the TracerConfigurator. SDKs may support updating the TracerConfigurator and resulting TracerConfig objects at runtime provided it is applied to previously created tracers. This feature allows dynamic enabling of tracers to turn tracing on or off without restarting the application.

https://opentelemetry.io/docs/specs/otel/trace/sdk/#configuration

The TracerProvider MAY provide methods to update the configuration. If configuration is updated (e.g., adding a SpanProcessor), the updated configuration MUST also apply to all already returned Tracers (i.e. it MUST NOT matter whether a Tracer was obtained from the TracerProvider before or after the configuration change).

Changes

  • Add SDK TracerProvider::UpdateTracerConfigurator method and tests
  • Change SDK Tracer::tracer_config_ to be an atomic shared pointer that will support dynamic updates including growth beyond the enabled bool.
  • Add example showing runtime changes to the tracer configurator to enable/disable tracers.

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

@codecov
Copy link
Copy Markdown

codecov Bot commented May 7, 2026

Codecov Report

❌ Patch coverage is 90.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.00%. Comparing base (e0c6c33) to head (7bf4ca3).

Files with missing lines Patch % Lines
sdk/src/trace/tracer_context.cc 60.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4065      +/-   ##
==========================================
+ Coverage   81.99%   82.00%   +0.01%     
==========================================
  Files         385      386       +1     
  Lines       16023    16043      +20     
==========================================
+ Hits        13137    13155      +18     
- Misses       2886     2888       +2     
Files with missing lines Coverage Δ
sdk/include/opentelemetry/sdk/trace/tracer.h 100.00% <ø> (ø)
...k/include/opentelemetry/sdk/trace/tracer_context.h 100.00% <ø> (ø)
sdk/src/trace/tracer.cc 87.02% <100.00%> (+0.91%) ⬆️
sdk/src/trace/tracer_provider.cc 90.91% <100.00%> (+1.33%) ⬆️
sdk/src/trace/tracer_context.cc 80.65% <60.00%> (-3.97%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dbarker dbarker marked this pull request as ready for review May 7, 2026 22:53
@dbarker dbarker requested a review from a team as a code owner May 7, 2026 22:53
Comment thread sdk/src/trace/tracer_provider.cc
Comment thread sdk/src/trace/tracer.cc Outdated
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.

2 participants