Skip to content

OTel: Sampling support #190

@khvn26

Description

@khvn26

Currently, the OTel integration (#189) uses the default ParentBasedAlwaysOn sampler — 100% of traces are captured. This is fine for initial rollout but we should add configurable sampling for production use.

Options to consider

  1. Collector-side tail-based sampling — keep errors and slow requests, drop routine 200s. No code changes needed, just collector config. This should be the first approach, and implies no code changes.
  2. SDK-side head sampling — e.g. TraceIdRatioBased(0.1) for 10% sampling. Reduces overhead on the API process. Useful at very high request volumes.
  3. Per-route sampling — different rates for different endpoints (e.g. 100% for webhooks, 1% for feature flags evaluation).

Context

  • The BatchSpanProcessor is lightweight, so SDK-side sampling is unlikely to be needed until high request volumes.
  • Health/readiness endpoints are already excluded via OTEL_TRACING_EXCLUDED_URL_PATHS.
  • This is also relevant for eventually replacing Sentry SDK tracing with OTel-native tracing.

Related: #182

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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