Skip to content

Conversation

@ysolomchenko
Copy link
Contributor

Why

Towards #4394

What

File Based Configuration for Sampler

Note

Original PR created by Ai Codex
ysolomchenko#1

Tests

Ci

Checklist

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

@ysolomchenko ysolomchenko marked this pull request as ready for review October 24, 2025 09:54
@ysolomchenko ysolomchenko requested a review from a team as a code owner October 24, 2025 09:54
exporter:
console:

# Configure the sampler. If omitted, parent based sampler with a root of always_on is used.
Copy link
Member

Choose a reason for hiding this comment

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

Need to more examples how to configure other samplers, on only parent based.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added more examples to configuration in d1d1605

Comment on lines 12 to 25
[YamlMember(Alias = "root")]
public SamplerConfig? Root { get; set; }

[YamlMember(Alias = "remote_parent_sampled")]
public SamplerConfig? RemoteParentSampled { get; set; }

[YamlMember(Alias = "remote_parent_not_sampled")]
public SamplerConfig? RemoteParentNotSampled { get; set; }

[YamlMember(Alias = "local_parent_sampled")]
public SamplerConfig? LocalParentSampled { get; set; }

[YamlMember(Alias = "local_parent_not_sampled")]
public SamplerConfig? LocalParentNotSampled { get; set; }
Copy link
Member

Choose a reason for hiding this comment

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

Are you sure that we should support parent_based within ParentBased? With this structure it is possible. I think that you need separatte Config for all these subsections.

What is more, traceid ratio should be possible to use only on the root

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OTEL .NET SDK allows this, so I’d like to keep current solution and give users full freedom and responsibility for configuring the sampler

Copy link
Member

Choose a reason for hiding this comment

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

Manual object structure building is something different than pre-configured options.
In such cases, IMO we should allow only valid options, especially in terms of the specification.

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 0282066

}

[Fact]
public void LoadFile_ConfiguresParentBasedSampler()
Copy link
Member

Choose a reason for hiding this comment

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

Whats about other combinations?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added more test cases in 53fd6c9

Copy link
Member

Choose a reason for hiding this comment

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

There should probably be a test for using the traceid ratio sampler under the root option, especially since that is one of the scenarios that we are documenting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Test Case Added in beab7af

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.

3 participants