The issue is that since the builder is a a static instance. When adding the ApplicationInsightsExporter it also calls the very same SetSampler which can be seen here.
This results in the overriding of the original sampling instance.
Steps to Reproduce
Create an OTel Trace Exporter and set sampling.
Create an Application Insights Exporter with a different sampling ratio.
Observer the Application Insights Sampling is used for all sampling.
Expected Result
The original sampler instance should not be overridden when ApplicationInsightsSampler is added.
Actual Result
The original sampler instance is overridden by the ApplicationInsightsSampler.
This is best reported in Application Insights repo. There is nothing to be done in this repo to address this!.
Closing. Feel free to reopen, if you believe this repo has something to do about this.
Package
OpenTelemetry
Package Version
Runtime Version
net6.0, net8.0
Description
The static class TracerProviderBuilderExtensions, contains a method called
SetSampler
which takes an instance ofTracerProviderBuilder
and calls TracerProviderBuilderSdk.SetSampler to set itssampler
instance to the providedsampler
.The issue is that since the builder is a a static instance. When adding the ApplicationInsightsExporter it also calls the very same
SetSampler
which can be seen here.This results in the overriding of the original sampling instance.
Steps to Reproduce
Expected Result
The original sampler instance should not be overridden when ApplicationInsightsSampler is added.
Actual Result
The original sampler instance is overridden by the ApplicationInsightsSampler.
Additional Context
No response