Skip to content

[SDK] Support TracerConfigurator updates - #4065

Merged
marcalff merged 24 commits into
open-telemetry:mainfrom
dbarker:feature_tracer_configurator_updates
Jun 7, 2026
Merged

marcalff merged 24 commits into
open-telemetry:mainfrom
dbarker:feature_tracer_configurator_updates

Conversation

@dbarker

@dbarker dbarker commented May 7, 2026 •

Copy link
Copy Markdown
Member

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
  • Add mutex for the SDK Tracer::tracer_config_ 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

codecov Bot commented May 7, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.60870% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.01%. Comparing base (af27cc9) to head (4fe523d).

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

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4065      +/-   ##
==========================================
- Coverage   82.02%   82.01%   -0.01%     
==========================================
  Files         385      385              
  Lines       16071    16093      +22     
==========================================
+ Hits        13181    13197      +16     
- Misses       2890     2896       +6     
Files with missing lines Coverage Δ
...etry/sdk/instrumentationscope/scope_configurator.h 100.00% <ø> (ø)
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.35% <100.00%> (+1.24%) ⬆️
sdk/src/trace/tracer_context.cc 80.65% <60.00%> (-3.97%) ⬇️
sdk/src/trace/tracer_provider.cc 87.94% <80.00%> (-1.65%) ⬇️

... 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 Resolved
Comment thread sdk/src/trace/tracer.cc Resolved
Comment thread sdk/src/trace/tracer_provider.cc Resolved
Comment thread sdk/src/trace/tracer_provider.cc Resolved
Comment thread sdk/src/trace/tracer.cc Resolved

@marcalff marcalff left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

See suggestion for Enabled().

Comment thread examples/tracer_configurator/main.cc Resolved

@marcalff marcalff left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Excellent work.

Thanks in particular for the examples, and thorough unit tests.

@marcalff
marcalff merged commit 4352a63 into open-telemetry:main Jun 7, 2026
71 checks passed
@dbarker
dbarker deleted the feature_tracer_configurator_updates branch June 7, 2026 15:52
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.

3 participants