feat(configuration): add sampler parsing#6409
Open
MikeGoldsmith wants to merge 8 commits intoopen-telemetry:mainfrom
Open
feat(configuration): add sampler parsing#6409MikeGoldsmith wants to merge 8 commits intoopen-telemetry:mainfrom
MikeGoldsmith wants to merge 8 commits intoopen-telemetry:mainfrom
Conversation
- Add type models: ProbabilitySampler, CompositeSampler, RuleBasedSampler - Implement YAML sampler parsing in FileConfigFactory.parseSampler() - Implement env var parsing (OTEL_TRACES_SAMPLER, OTEL_TRACES_SAMPLER_ARG) - Add tests for always_on, always_off, traceidratio, parentbased samplers - Support probability/development and composite/development sampler types Fixes open-telemetry#6290
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6409 +/- ##
==========================================
+ Coverage 95.59% 95.62% +0.03%
==========================================
Files 361 361
Lines 11595 11688 +93
Branches 2683 2719 +36
==========================================
+ Hits 11084 11177 +93
Misses 511 511
🚀 New features to boost your workflow:
|
- Convert null values to undefined for always_on/always_off samplers - Ensures consistent behavior with existing defaults - YAML 'always_on:' (no value) → undefined, matching initializeDefaultTracerProviderConfiguration() Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…o mike/parse-samplers
- Add probability sampler type (non-development) - Make CompositeSampler.samplers optional - Expand RuleBasedSamplerRule with full spec fields - Recursively parse samplers in rule_based rules - Update kitchen-sink test expectations
- Add unknown sampler type warning test - Add parentbased_always_off env var test - Add composite sampler with samplers array test - Add composite sampler with rule_based full features test - Coverage: EnvironmentConfigFactory 98.89%, FileConfigFactory 99.82%
…o mike/parse-samplers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which problem is this PR solving?
Fixes #6290
RC3 spec requires sampler configuration via YAML files and environment variables. Currently missing:
probability/developmentandcomposite/developmentsamplersShort description of the changes
Type Models (tracerProviderModel.ts):
ProbabilitySampler,CompositeSampler,RuleBasedSamplerinterfacesSamplerunion withprobability/developmentandcomposite/developmentYAML Parsing (FileConfigFactory.ts):
parseSampler()function supporting all sampler typessetTracerProvider()Environment Variable Parsing (EnvironmentConfigFactory.ts):
setSampler()function supporting:always_on,always_off,traceidratioparentbased_always_on,parentbased_always_off,parentbased_traceidratioOTEL_TRACES_SAMPLER_ARGfor ratio valuesTests:
Type of change
How Has This Been Tested?
Checklist: