Skip to content

Proper way to perform head sampling? #129

Description

@ArniDagur

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions