Skip to content

[SDK] Support independent programmatic configuration#4240

Draft
dbarker wants to merge 10 commits into
open-telemetry:mainfrom
dbarker:sdk_configuration_core_and_tests
Draft

[SDK] Support independent programmatic configuration#4240
dbarker wants to merge 10 commits into
open-telemetry:mainfrom
dbarker:sdk_configuration_core_and_tests

Conversation

@dbarker

@dbarker dbarker commented Jul 11, 2026

Copy link
Copy Markdown
Member

Fixes #4134 and follow up from ##3655 (review)

Break out the programmatic configuration to its own library so it can be used without the ryml dependency.

Changes

  • Creates the programmatic configuration target (configuration_core)
  • Adds configuration_core to the CMake install tests
  • Adds programmatic_configuration_test.cc
  • Fix issues found with the new test
    • LoggerConfigurator supporting min severity and trace based fields
    • Initialize members of config classes to the spec default constants.
    • Set the default parent based root sampler to always_on
    • Set the default sampler to parent based always on
    • Set all batch processor options that the user configured
    • Handle default metric stream aggregation
  • Fix the cppcoreguidelines-pro-type-member-init warnings in configuration and sdk files used by the tests.
  • Update INSTALL doc for the configuration targets

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 Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.96907% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 81.22%. Comparing base (c79fa3b) to head (d45f229).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
sdk/src/configuration/sdk_builder.cc 90.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4240      +/-   ##
==========================================
+ Coverage   77.91%   81.22%   +3.31%     
==========================================
  Files         439      443       +4     
  Lines       18592    18670      +78     
==========================================
+ Hits        14485    15163     +678     
+ Misses       4107     3507     -600     
Files with missing lines Coverage Δ
...ntial_bucket_histogram_aggregation_configuration.h 100.00% <ø> (+100.00%) ⬆️
...uration/batch_log_record_processor_configuration.h 100.00% <ø> (+100.00%) ⬆️
...configuration/batch_span_processor_configuration.h 100.00% <ø> (+100.00%) ⬆️
...figuration/boolean_attribute_value_configuration.h 0.00% <ø> (ø)
...ion/composable_probability_sampler_configuration.h 100.00% <ø> (ø)
...de/opentelemetry/sdk/configuration/configuration.h 100.00% <100.00%> (ø)
...e/opentelemetry/sdk/configuration/configured_sdk.h 100.00% <ø> (+100.00%) ⬆️
...ation/console_push_metric_exporter_configuration.h 0.00% <ø> (ø)
...de/opentelemetry/sdk/configuration/document_node.h 100.00% <ø> (ø)
...nfiguration/double_attribute_value_configuration.h 0.00% <ø> (ø)
... and 18 more

... and 34 files with indirect coverage changes

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

…scale, test crash due to setting global providers to null, missing targets and files in the fetch content test
}

// Zero values indicate the field is not set.
std::size_t max_scale{0};

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.

This is a case where zero is a valid value for the option so it is not a great way to indicate "not set". Instead of using zero in all these config structs to indicate not set, we may consider either setting the spec defaults (which the SDK/exporter options structs also do) or bring in an std::optional/nostd::optional type.

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 spec seems clear on the in memory configuration model.

https://opentelemetry.io/docs/specs/otel/configuration/sdk/#in-memory-configuration-model

If a property is present and the value is null, Create MUST use the nullBehavior, or defaultBehavior if nullBehavior is not set.

Changes:

  • Updated the config files to define and initialize to the default values provided by the configuration schema as defaultBehavior .
  • Updated the parser to use the config class defaults.
  • Added TODOs where the current implementation defaults differed from the schema.

@dbarker dbarker added the pr:do-not-merge This PR is not ready to be merged. label Jul 12, 2026
@dbarker

dbarker commented Jul 13, 2026

Copy link
Copy Markdown
Member Author

This PR will be broken up into multiple PRs (will edit with PR links).

  1. Tests for SdkBuilder, ConfiguredSdk, and integration tests for programmatic configuration along with fixes to the SdkBuilder they exposed.
  2. Move spec defaults from the configuration_parser.cc to each configuration struct.
  3. CMake separation of configuration_core and configuration
  4. CMake component cleanup and deprecation of the "builder" components since the sdk will now include the builder interfaces.

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

Labels

pr:do-not-merge This PR is not ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Programmatic Configuration without YAML dependencies

1 participant