Skip to content

[CONFIGURATION] SDK default component builder libraries and example - #4367

Merged
dbarker merged 27 commits into
open-telemetry:mainfrom
dbarker:config_create_sdk_signal_builders
Aug 11, 2026
Merged

[CONFIGURATION] SDK default component builder libraries and example#4367
dbarker merged 27 commits into
open-telemetry:mainfrom
dbarker:config_create_sdk_signal_builders

Conversation

@dbarker

@dbarker dbarker commented Aug 5, 2026

Copy link
Copy Markdown
Member

Contributes to #4352

Create configuration builder libraries per signal and update SdkBuilder to use them.

This brings a breaking change to how users create a default registry populated with SDK component builders.

// before this PR
auto registry = std::make_shared<sdk::configuration::Registry>();

// with this PR
auto registry = sdk::configuration::RegistryFactory::Create();

Changes

  • creates the per-signal builder libraries
    • opentelemetry-cpp::configuration_logs_builders (9846e83)
    • opentelemetry-cpp::configuration_metrics_builders (f3328f3)
    • opentelemetry-cpp::configuration_trace_builders (7977068)
  • creates the registry factory to create a fully populated registry with the default builders
    • openetelemetry-cpp::configuration_registry_factory (d077f5f)
  • updates the SdkBuilder to get the new builders from the registry (3c1ba5a)
  • enables the batch processor tests in the programmatic configuration test suite (a3442f3)
  • updates the sdk and configuration component install tests (d4c7101)
  • adds new yaml example (sdk-default.yaml) and test for builds without exporters (69b55ec, 3d02037)
  • Adds a CompositeSampler to the model and breaks out composable samplers from the SamplerConfigurationVisttor

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

@dbarker dbarker mentioned this pull request Aug 5, 2026
3 tasks
@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.64151% with 116 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.18%. Comparing base (768d04d) to head (ebe7b08).

Files with missing lines Patch % Lines
sdk/src/configuration/logs_builders.cc 44.71% 47 Missing ⚠️
sdk/src/configuration/sdk_builder.cc 73.30% 47 Missing ⚠️
sdk/src/configuration/trace_builders.cc 86.09% 16 Missing ⚠️
sdk/src/configuration/metrics_builders.cc 76.20% 5 Missing ⚠️
sdk/src/configuration/registry_factory.cc 85.72% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4367      +/-   ##
==========================================
+ Coverage   82.11%   82.18%   +0.07%     
==========================================
  Files         494      501       +7     
  Lines       19670    19847     +177     
==========================================
+ Hits        16151    16310     +159     
- Misses       3519     3537      +18     
Files with missing lines Coverage Δ
...tion/composable_always_off_sampler_configuration.h 100.00% <ø> (ø)
...ation/composable_always_on_sampler_configuration.h 100.00% <ø> (ø)
...omposable_parent_threshold_sampler_configuration.h 100.00% <ø> (ø)
...ion/composable_probability_sampler_configuration.h 100.00% <ø> (ø)
...figuration/composable_rule_based_sampler_builder.h 100.00% <ø> (ø)
...tion/composable_rule_based_sampler_configuration.h 100.00% <ø> (ø)
...k/configuration/composable_sampler_configuration.h 100.00% <100.00%> (ø)
...uration/composable_sampler_configuration_visitor.h 100.00% <100.00%> (ø)
...etry/sdk/configuration/composite_sampler_builder.h 100.00% <100.00%> (ø)
...dk/configuration/composite_sampler_configuration.h 100.00% <100.00%> (ø)
... and 15 more

... and 6 files 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 changed the title [CONFIGURATION] Adds per signal SDK component builders and integration with SdkBuilder [CONFIGURATION] SDK default component builder libraries and example Aug 5, 2026
@dbarker
dbarker marked this pull request as ready for review August 6, 2026 00:10
@dbarker
dbarker requested a review from a team as a code owner August 6, 2026 00:10
Comment thread examples/configuration/extensions.yaml Outdated
Comment thread examples/configuration/CMakeLists.txt Outdated
endif()

if(BUILD_TESTING)
add_test(NAME examples.example_yaml COMMAND "$<TARGET_FILE:example_yaml>")

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The example is now tested here against three different yaml files covering all the default builders, extension builders, and composite sampler. These tests now fail on non-zero returns (thanks to the --test arg) or if the example logs an error.

Comment thread examples/configuration/custom_log_record_exporter.cc Outdated
@dbarker

dbarker commented Aug 7, 2026

Copy link
Copy Markdown
Member Author

For smooth integration - this PR depends on several others and review/merge of these should be completed first:

  1. [SDK] make global log level atomic #4368
  2. [CONFIGURATION] validate and update config files to yaml schema 1.1.0 #4374
  3. [CONFIGURATION] Build composable samplers from file configuration #4366

PRIVATE opentelemetry-cpp::prometheus_exporter_builder)
endif()

if(DEFINED OPENTELEMETRY_BUILD_DLL)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The DLL build is not supported or tested for OTLP or Configuration classes (most are missing the required exports). Removing this to make the example easier to understand by moving the important config targets to the top of the file.

dbarker added 2 commits August 7, 2026 17:38
…ite sampler builder and use it in the sdk builder. Enforce a max sampler depth for composable samplers
dbarker added 2 commits August 9, 2026 09:37
…e sampler config class and separating the composable config vistor from the top level sampler config visitor. cleanup the sdk builder to use the new composable config visitor.
Comment thread sdk/include/opentelemetry/sdk/configuration/sdk_builder.h
{
public:
// Returns a Registry pre-populated with all default signal builders.
static std::shared_ptr<Registry> Create();

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.

nit: a Create() method should return a unique_ptr, not a shared_ptr. It is then to the caller to assign this unique_ptr to a shared_ptr if it wants it shared.

@dbarker dbarker Aug 11, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks I'll follow up with this one separately. It will impact all the call sites to the SdkBuilder and ConfiguredSdk::Create.

@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.

See minor nit, ok to merge.

@dbarker
dbarker merged commit 04a8ddd into open-telemetry:main Aug 11, 2026
72 of 73 checks passed
@dbarker
dbarker deleted the config_create_sdk_signal_builders branch August 11, 2026 04:13
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