Skip to content

Conversation

@ysolomchenko
Copy link
Contributor

Why

Towards #4394
Extracted and refactored from #4270

What

File based configuration for propagators

Tests

CI

Checklist

  • CHANGELOG.md is updated.
  • Documentation is updated.
  • New features are covered by tests.

@ysolomchenko ysolomchenko requested a review from a team as a code owner September 29, 2025 10:50
[YamlMember(Alias = "composite_list")]
public string? CompositeList { get; set; }

public IReadOnlyList<Propagator> GetEnabledPropagators()
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. Distinct() already does the HashSet logic for you, no need to be explicit.

  2. return early >

if (Composite is null && string.IsNullOrEmpty(CompositeList))
{
    return Array.Empty<Propagator>();
}
  1. ToLowerInvariant() adds extra string allocation. Maybe you can reuse StringComparison.InvariantCultureIgnoreCase based logic.

  2. Try to verify the list and not to copy it's contents over to another.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed in a19d41f

ToLowerInvariant() adds extra string allocation. Maybe you can reuse StringComparison.InvariantCultureIgnoreCase based logic.

I made it case-sensitive, as it was done in OTEL_PROPAGATORS.

{
var config = new PropagatorConfiguration
{
CompositeList = "invalid,b3multi"
Copy link
Contributor

Choose a reason for hiding this comment

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

Empty test here?

Suggested change
CompositeList = "invalid,b3multi"
CompositeList = "invalid,b3multi,"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Refactored test with load to settings 62af6ff

Constants.ConfigurationValues.Propagators.W3CBaggage => Propagator.W3CBaggage,
Constants.ConfigurationValues.Propagators.B3Multi => Propagator.B3Multi,
Constants.ConfigurationValues.Propagators.B3Single => Propagator.B3Single,
_ => null
Copy link
Contributor

Choose a reason for hiding this comment

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

is this legal? what is the result, NoOpPropagator etc?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it is legal.
Added a test for the Noop Propagator 62af6ff

@Kielek Kielek merged commit 2d1494d into open-telemetry:main Oct 8, 2025
47 checks passed
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.

4 participants