Repository navigation
docs: recommend trace sampling in production - #85
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a short README section on sampling traces in production. It's docs only, because the sampler can already be set without code: lite-bootstrap passes
sampler=NonetoTracerProvider, and the SDK then readsOTEL_TRACES_SAMPLERandOTEL_TRACES_SAMPLER_ARG(lite-bootstrap ADR-0008).Measurements
I ran
GET /api/decks/1/through the full app: lite-bootstrap tracing, the ASGI server span and the SQLAlchemy spans, 6 spans per request. The OTLP exporter was patched to encode each batch to protobuf and then drop it, so there was no network export. Each run was inside the template's compose container withSERVICE_DEBUG=false, and each number is the median of 5 runs, averaged over two interleaved rounds. Results are in req/s, with the change against no tracing:parentbased_always_on(default)parentbased_traceidratio, 0.1parentbased_traceidratio, 0.01parentbased_always_offGoing below 10% gains little. About 20% stays even with
always_off, because the ASGI middleware and the SQLAlchemy hooks still run when a span is not recorded. The fastapi no-tracing baseline varied by about 11% between rounds, so treat those percentages as approximate.The trade-off is that head sampling drops 90% of traces, failed requests included. Sentry still gets every error.