-
Notifications
You must be signed in to change notification settings - Fork 44
Description
How should I perform head sampling to ensure that only a subset of traces get sampled?
With tracing + tracing-opentelemetry, you can use Sampler::ParentBased combined with Sampler::TraceIdRatioBased to sample a percentage of root spans without any parent, or 100% of child spans if the parent is sampled.
Fastrace seems to set sampled: true on every new span created with SpanContext::random.
I was considering having a new_root function in our code which would be a wrapper around Span::root which changes .sampled depending on some criteria (e.g. coin toss). However, that wouldn't work since we don't have control over all usages of Span::root. Some are in fastrace-tonic for example.
A solution to this is a blocker for us to adopt fastrace, since on high QPS services we could only capture a miniscule percentage of traces.