Skip to content

Commit 13e6083

Browse files
authored
docs: recommend trace sampling in production (#85)
1 parent ef142f7 commit 13e6083

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎readme.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ Authentication is intentionally omitted: pick the scheme that fits your project
3131
just --list
3232
```
3333

34+
## Tracing in production
35+
Setting `OPENTELEMETRY_ENDPOINT` turns tracing on, and by default every request is traced. In a benchmark of `GET /api/decks/{id}/`, that cut throughput by about 40%. Sampling with the standard OpenTelemetry variables brings that down to about 20%:
36+
37+
```bash
38+
OTEL_TRACES_SAMPLER=parentbased_traceidratio
39+
OTEL_TRACES_SAMPLER_ARG=0.1
40+
```
41+
42+
This keeps one trace in ten, and follows the caller's decision when a request arrives with a trace context. Errors still reach Sentry when `SENTRY_DSN` is set.
43+
3444
## 📝 [License](https://github.com/modern-python/fastapi-sqlalchemy-template/blob/main/LICENSE)
3545

3646
## Part of `modern-python`

0 commit comments

Comments
 (0)