-
Notifications
You must be signed in to change notification settings - Fork 68
Description
Related Problems?
Today the Rust SDK exposes the three standard sampling decisions (Drop, RecordOnly, RecordAndSample), but the built-in samplers only ever return Drop or RecordAndSample.
There are valid use cases (e.g. span-to-metrics pipelines, local tail sampling) where you want all spans to be recording, even when they’re not marked Sampled.
Right now users must roll their own wrapper sampler to downgrade Drop → RecordOnly.
What component are you working with?
No response
Describe the solution you'd like:
Add a small utility sampler (e.g. RecordOnlyOnDrop) in opentelemetry-contrib/src/trace/ that wraps an inner sampler and converts any Drop decision into RecordOnly.
use opentelemetry_sdk::trace::{Sampler, SdkTracerProvider};
use opentelemetry_contrib::trace::RecordOnlyOnDrop;
let base = Sampler::ParentBased(Box::new(Sampler::TraceIdRatioBased(0.05)));
let sampler = RecordOnlyOnDrop::new(base);
let provider = SdkTracerProvider::builder()
.with_config(opentelemetry_sdk::trace::Config {
sampler: Box::new(sampler),
..Default::default()
})
.build();
Considered Alternatives
No response
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.