Repository navigation
feat: drop the ASGI send/receive spans from traces - #64
Merged
Merged
Conversation
Sets opentelemetry_exclude_spans=["receive", "send"], so a traced request records its server span and database spans only.
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.
Upgrades lite-bootstrap to 1.13.0 and sets
opentelemetry_exclude_spans=["receive", "send"]inapi_bootstrapper_config. This is the Litestar counterpart of modern-python/fastapi-sqlalchemy-template#86. lite-bootstrap 1.13.0 added the option for Litestar in modern-python/lite-bootstrap#288.Upgrade, 1.9.2 to 1.13.0
pyproject.tomlnow requireslite-bootstrap[litestar-all]>=1.13, because the setting doesn't exist in earlier versions. The lock moves only lite-bootstrap. The upgrade includes two breaking changes:OpenTelemetryPlugin.The suite passed on the upgrade alone, before any other change.
Why drop the spans
A traced
GET /api/decks/{id}/records 6 spans: the server span, 2http sendspans,connectand 2SELECT. The send spans rarely matter for a JSON API, and dropping them is cheap. Same harness as #63, medians of 3 runs, in req/s:The README notes the setting and says to remove it if those spans are needed.
Tests
The tracing test now also checks that, apart from SQLAlchemy spans, a traced request records only the SERVER span. Without the setting it fails, because two INTERNAL event spans appear.
I added this check to the existing test instead of writing a second one. A second traced test would call
build_app()with tracing again in the same process, and lite-bootstrap 1.13 warns that aTracerProvideris already installed (lite-bootstrap#264).