Skip to content

[bug] Tracing Custom Sampler ShouldSample Execute Before Custom Propagator #6772

@yehaotian

Description

@yehaotian

Package

OpenTelemetry

Package Version

Package Name Version
OpenTelemetry.Api 1.12.0
OpenTelemetry 1.12.0
TBD TBD

Runtime Version

net8.0

Description

Tracing Custom Sampler ShouldSample Execute Before Custom Propagator

Steps to Reproduce

steps to reproduce

.SetSampler(new ParentBasedSampler(
                        rootSampler: new CustomSampler(samplingRate)
                        ))

...

var propagators = new List<TextMapPropagator>
        {
            new TestContextPropagator(),
            new BaggagePropagator(),
            new CustomPropagator(),
        };

        Sdk.SetDefaultTextMapPropagator(new CompositeTextMapPropagator(propagators));

Add logs in the CustomSampler and CustomPropagator and you can see CustomSampler.ShouldSample run before CustomPropagator.

Expected Result

All propagator should run before Sampler so that we can use propagated info in SamplingParameters to do advanced sampling logic

Actual Result

Add logs in the CustomSampler and CustomPropagator and you can see CustomSampler.ShouldSample run before CustomPropagator.

Additional Context

No response

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-triageNew issues which have not been classified or triaged by a community memberpkg:OpenTelemetryIssues related to OpenTelemetry NuGet package

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions