Skip to content

Add file configuration types for Tracer, Meter, and Logger#3920

Open
UMMAN2005 wants to merge 2 commits intoopen-telemetry:mainfrom
UMMAN2005:feature/file-config-tracer-meter-logger
Open

Add file configuration types for Tracer, Meter, and Logger#3920
UMMAN2005 wants to merge 2 commits intoopen-telemetry:mainfrom
UMMAN2005:feature/file-config-tracer-meter-logger

Conversation

@UMMAN2005
Copy link

@UMMAN2005 UMMAN2005 commented Mar 8, 2026

Fixes #3915

Summary

Implements the file configuration types for Tracer, Meter, and Logger as described in #3915.

Changes

  • 9 new configuration model headers: ExperimentalTracerConfig, ExperimentalTracerMatcherAndConfig, ExperimentalTracerConfigurator (and their Meter/Logger equivalents), following the project's one-class-per-header convention.
  • Updated provider configurations: Replaced FIXME comments in TracerProviderConfiguration, MeterProviderConfiguration, and LoggerProviderConfiguration with the new configurator fields.
  • YAML parsing: Added parsing support for the tracer_configurator/development, meter_configurator/development, and logger_configurator/development sections in ConfigurationParser.
  • SDK builder wiring: Implemented CreateTracerConfigurator, CreateMeterConfigurator, CreateLoggerConfigurator in SdkBuilder to construct ScopeConfigurator<T> objects from parsed configuration, including wildcard name matching (? and *).
  • Unit tests: Added tests for each signal's configurator parsing in yaml_trace_test.cc, yaml_metrics_test.cc, and yaml_logs_test.cc.

Types implemented

ExperimentalTracerConfig
ExperimentalTracerConfigurator
ExperimentalTracerMatcherAndConfig
ExperimentalMeterConfig
ExperimentalMeterConfigurator
ExperimentalMeterMatcherAndConfig
ExperimentalLoggerConfig
ExperimentalLoggerConfigurator
ExperimentalLoggerMatcherAndConfig

Test plan

  • Added unit tests for parsing configurator sections (no configurator, default only, default + matchers)
  • CI builds and tests pass on all supported platforms

@UMMAN2005 UMMAN2005 requested a review from a team as a code owner March 8, 2026 17:04
@codecov
Copy link

codecov bot commented Mar 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.06%. Comparing base (739862d) to head (c0f21af).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3920   +/-   ##
=======================================
  Coverage   90.06%   90.06%           
=======================================
  Files         226      226           
  Lines        7223     7223           
=======================================
  Hits         6505     6505           
  Misses        718      718           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@UMMAN2005 UMMAN2005 force-pushed the feature/file-config-tracer-meter-logger branch from 61e4ad7 to d71a591 Compare March 9, 2026 08:11
Implement ExperimentalTracerConfig, ExperimentalTracerConfigurator,
ExperimentalTracerMatcherAndConfig and their Meter/Logger equivalents
as defined in the declarative configuration spec.

- Add 9 new configuration model headers (Config, MatcherAndConfig,
  Configurator for each signal)
- Wire configurator fields into TracerProviderConfiguration,
  MeterProviderConfiguration, and LoggerProviderConfiguration
- Implement YAML parsing for the new configuration types in
  ConfigurationParser
- Add ScopeConfigurator creation with wildcard name matching in
  SdkBuilder
- Add unit tests for parsing the new configurator sections

Resolves open-telemetry#3915
@UMMAN2005 UMMAN2005 force-pushed the feature/file-config-tracer-meter-logger branch from d71a591 to a6ad72d Compare March 9, 2026 08:13

std::unique_ptr<opentelemetry::sdk::instrumentationscope::ScopeConfigurator<
opentelemetry::sdk::trace::TracerConfig>>
SdkBuilder::CreateTracerConfigurator(
Copy link
Member

@lalitb lalitb Mar 9, 2026

Choose a reason for hiding this comment

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

CreateTracerConfigurator, CreateMeterConfigurator, and CreateLoggerConfigurator are nearly identical. Not a blocker, as this follows the existing code pattern we have, but good to see if we can use the template helper to reduce this duplication.

}

return model;
}
Copy link
Member

Choose a reason for hiding this comment

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

These 3 methods are mostly identical with their metrics and logs equivalent. Good to see if we can reduce the duplication with the templatised versions.

namespace configuration
{

static bool WildcardMatch(const std::string &pattern, const std::string &text)
Copy link
Member

@lalitb lalitb Mar 9, 2026

Choose a reason for hiding this comment

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

WildcardMatch is file-scoped static, making it impossible to directly unit-test or reuse. Please move it to a shared utility header (e.g., sdk/src/configuration/wildcard_match.h) and add dedicated unit tests covering the edge cases.

namespace configuration
{

// YAML-SCHEMA: schema/meter_provider.yaml
Copy link
Member

Choose a reason for hiding this comment

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

the meter config here says// YAML-SCHEMA: schema/meter_provider.yaml while tracer/logger headers say .json. Should be consistent across all three signals.

Copy link
Member

Choose a reason for hiding this comment

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

It should be yaml everywhere.

Copy link
Member

@marcalff marcalff left a comment

Choose a reason for hiding this comment

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

Nice work, which fits into the existing code.

See preliminary comments.

Comment on lines +170 to +171
ExperimentalLoggerConfigConfiguration ParseExperimentalLoggerConfigConfiguration(
const std::unique_ptr<DocumentNode> &node) const;
Copy link
Member

Choose a reason for hiding this comment

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

Some global naming comments, that apply everywhere:

The yaml schema type is ExperimentalFoo, but the corresponding C++ code should not say Experimental all the time.

Please change:

  • the file names
  • the classes names
  • the method names

to remove the Experimental part.

class ExperimentalLoggerConfigConfiguration
{
public:
bool disabled{false};
Copy link
Member

Choose a reason for hiding this comment

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

The yaml attribute has been renamed to enabled in the spec, in a recent change:

Rename to enabled.

namespace configuration
{

// YAML-SCHEMA: schema/meter_provider.yaml
Copy link
Member

Choose a reason for hiding this comment

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

It should be yaml everywhere.

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.

[CONFIGURATION] File configuration - Tracer/Meter/Logger config

3 participants