Flagsmith / Flagsmith/flagsmith-common

OTel: Sampling support

Open
#190 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
2
Forks
4
Avg merge
2d 9h
Merged PRs (30d)
10

Description

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.