fix: processor-level config takes precedence over top-level settings#984
Open
lazureykis wants to merge 1 commit into
Open
fix: processor-level config takes precedence over top-level settings#984lazureykis wants to merge 1 commit into
lazureykis wants to merge 1 commit into
Conversation
Previously, explicitly setting `traces_exporter` or `bsp_*` options at the top level would silently override the same keys in processor-level config. This meant a user who configured `exporter` directly in their processor opts could have it replaced by a top-level `traces_exporter` value without warning. The fix ensures processor opts always take precedence: top-level and environment variable settings only fill in keys that are absent from the processor config. The `span_processor` shorthand (`batch`/`simple`) now starts with empty opts instead of pre-populated defaults, since defaults are already applied via `maps:merge` in `merge_processor_config`. Closes open-telemetry#976
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.
Summary
Fixes #976.
When both
traces_exporter(orbsp_*settings) and processor-level config are set, the processor-level config was silently overridden by the top-level value. For example:The batch processor would end up using
other_exporterinstead ofmy_exporter.Changes
merge_processor_config_/4: Simplified to always respect processor-level config — if a key already exists in processor opts, top-level/env values don't override it.transform(span_processor, batch|simple): Returns empty#{}instead ofBATCH_PROCESSOR_DEFAULTS/SIMPLE_PROCESSOR_DEFAULTS. Defaults are already applied viamaps:mergeinmerge_processor_config/4, so pre-populating was redundant and prevented the merge logic from distinguishing user-set values from defaults.is_default/3helper.New precedence order
processor opts > top-level/env config > BATCH_PROCESSOR_DEFAULTS
Tests
Added
processor_exporter_not_overridden(12 assertions) andprocessor_config_precedence_with_os_env(4 assertions) covering:traces_exporternoneexporter preservedbsp_*/ssp_*settings don't override processor-level equivalentsbsp_*/ssp_*still apply when keys are absent from processor optsOTEL_TRACES_EXPORTER) doesn't override processor-level exporter