Skip to content

[SDK] Support TracerConfigurator updates#4065

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

[SDK] Support TracerConfigurator updates#4065
dbarker wants to merge 12 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 91.30435% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.01%. Comparing base (8fbe81e) to head (9b3d78b).
⚠️ Report is 1 commits behind head on main.

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   82.00%   82.01%   +0.02%     
==========================================
  Files         385      385              
  Lines       16030    16052      +22     
==========================================
+ Hits        13143    13163      +20     
- Misses       2887     2889       +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.35% <100.00%> (+1.24%) ⬆️
sdk/src/trace/tracer_provider.cc 91.38% <100.00%> (+1.80%) ⬆️
sdk/src/trace/tracer_context.cc 80.65% <60.00%> (-3.97%) ⬇️
🚀 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 Outdated
Comment thread sdk/src/trace/tracer.cc Outdated
Comment thread sdk/src/trace/tracer_provider.cc
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