-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Summary
Add more sophisticated sampling strategies beyond the current simple ratio-based sampling. This enables cost-effective telemetry while ensuring important data is captured.
Proposed Sampling Strategies
1. Error-Biased Sampling
Always capture errors at 100%, sample successes at a lower rate.
config.Sampling = new ErrorBiasedSampler(
errorSampleRate: 1.0, // 100% of errors
successSampleRate: 0.1 // 10% of successes
);2. Adaptive Sampling
Automatically adjust rate based on volume to stay within a target throughput.
config.Sampling = new AdaptiveSampler(
targetSpansPerMinute: 1000,
minSampleRate: 0.01,
maxSampleRate: 1.0
);3. Per-Operation Sampling
Different rates for different operation types.
config.Sampling = new PerOperationSampler(new Dictionary<string, double>
{
["CommandExecution"] = 1.0, // Always capture commands
["DocumentChange"] = 0.01, // Rare for noisy events
["*"] = 0.1 // Default for others
});4. Parent-Based Sampling
Respect parent span's sampling decision for distributed traces.
config.Sampling = new ParentBasedSampler(
rootSampler: new RatioSampler(0.1)
);Implementation Notes
- Implement
Samplerbase class withShouldSample()method - Integrate with OpenTelemetry's sampler pipeline
- Add sampling decision to span attributes for debugging
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request