Skip to content

fix: processor-level config takes precedence over top-level settings#984

Open
lazureykis wants to merge 1 commit into
open-telemetry:mainfrom
lazureykis:fix/976-processor-exporter-config-override
Open

fix: processor-level config takes precedence over top-level settings#984
lazureykis wants to merge 1 commit into
open-telemetry:mainfrom
lazureykis:fix/976-processor-exporter-config-override

Conversation

@lazureykis
Copy link
Copy Markdown

Summary

Fixes #976.

When both traces_exporter (or bsp_* settings) and processor-level config are set, the processor-level config was silently overridden by the top-level value. For example:

application:set_env(opentelemetry, processors, [
    {otel_batch_processor, #{exporter => {my_exporter, #{}}}}
]),
application:set_env(opentelemetry, traces_exporter, {other_exporter, #{}}),

The batch processor would end up using other_exporter instead of my_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 of BATCH_PROCESSOR_DEFAULTS/SIMPLE_PROCESSOR_DEFAULTS. Defaults are already applied via maps:merge in merge_processor_config/4, so pre-populating was redundant and prevented the merge logic from distinguishing user-set values from defaults.
  • Removed the now-unused is_default/3 helper.

New precedence order

processor opts > top-level/env config > BATCH_PROCESSOR_DEFAULTS

Tests

Added processor_exporter_not_overridden (12 assertions) and processor_config_precedence_with_os_env (4 assertions) covering:

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
@lazureykis lazureykis marked this pull request as ready for review May 8, 2026 16:39
@lazureykis lazureykis requested a review from a team as a code owner May 8, 2026 16:39
@yordis yordis requested a review from tsloughter May 8, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Batch processor app env config: user-provided exporter overridden by BATCH_PROCESSOR_DEFAULTS merge

1 participant