-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable ASGI send/receive spans by default #371
Merged
Merged
Conversation
This file contains 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
Deploying logfire-docs with Cloudflare Pages
|
alexmojaki
commented
Aug 8, 2024
# Instrument an app with request hooks to make sure that they work. | ||
# We make a new app here instead of using the fixtures because the same app can't be instrumented twice. | ||
# Then make a request to it to generate spans. | ||
# The tests then check that the spans are in the right place both with and without send/receive spans. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #371 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 126 127 +1
Lines 9256 9303 +47
Branches 1206 1211 +5
=========================================
+ Hits 9256 9303 +47 ☔ View full report in Codecov by Sentry. |
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.
A user reported that generating many
http receive
spans significantly slowed down requests: https://pydanticlogfire.slack.com/archives/C06EDRBSAH3/p1722626116726899In addition to these spans adding overhead in user code, they will eventually have a significant cost, since we will be charging based on the number of spans. This is out of proportion with the value they provide, especially since they're hidden by default in the UI.
So by default we're now preventing them from being created. The user can still opt in with
record_send_receive=True
ininstrument_fastapi/starlette
, in which case they will still have the debug log level.We might want to eventually move the logic in
processor_wrapper.py
that sets the log level and span name to the newTweakAsgiSpansTracer
. This will improve performance in general by avoiding checking whether we need to tweak every span on both start and end. But this will mean that the tweaking only works when going throughinstrument_*
methods. At the very least this requires creatinginstrument_asgi
.