-
Notifications
You must be signed in to change notification settings - Fork 648
ref(aiohttp): Move crumbs to integration #7135
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
Open
sentrivana
wants to merge
26
commits into
master
Choose a base branch
from
ivana/move-http-crumbs-1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+290
−54
Open
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
07a3ea3
ref(subprocess): Create breadcrumbs directly in integration
sentrivana 2f91234
.
sentrivana c3aea86
ref: Move Redis breadcrumbs to integration
sentrivana 15d2e2f
.
sentrivana 53ab7f0
really mypy?
sentrivana 0ea13df
.
sentrivana 2f54487
move even earlier
sentrivana 8e6087f
.
sentrivana 91fe6a4
.
sentrivana 5858c87
.
sentrivana 906838b
Merge branch 'master' into ivana/move-breadcrumbs-to-integrations
sentrivana 4e093aa
.
sentrivana 040f223
Merge branch 'ivana/move-breadcrumbs-to-integrations' into ivana/move…
sentrivana 7472af9
remove extra guards
sentrivana 8ace993
Merge branch 'master' into ivana/move-redis-breadcrumbs-to-integration
sentrivana f492ba4
ref(aiohttp): Move breadcrumb capture to integration
sentrivana 8e3adaf
exclude the spans
sentrivana 2a172c1
.
sentrivana 1239d84
.
sentrivana 9adbede
Merge branch 'master' into ivana/move-http-crumbs-1
sentrivana abdc32b
.
sentrivana d03072b
.
sentrivana 689d9d1
fix type annotation
sentrivana 8bfb879
defensive access
sentrivana 405fb12
Merge branch 'master' into ivana/move-http-crumbs-1
sentrivana 58c435a
Merge branch 'master' into ivana/move-http-crumbs-1
sentrivana File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -210,10 +210,25 @@ def record_sql_queries( | |
| yield span | ||
|
|
||
|
|
||
| def add_http_breadcrumb(status_code: "Optional[int]", data: "dict[str, Any]") -> None: | ||
| level = None | ||
| if status_code: | ||
| if 500 <= status_code <= 599: | ||
| level = "error" | ||
| elif 400 <= status_code <= 499: | ||
| level = "warning" | ||
|
|
||
| kwargs: "dict[str, Any]" = {"type": "http", "category": "httplib", "data": data} | ||
| if level: | ||
| kwargs["level"] = level | ||
|
|
||
| sentry_sdk.add_breadcrumb(**kwargs) | ||
|
|
||
|
|
||
| def maybe_create_breadcrumbs_from_span( | ||
| scope: "sentry_sdk.Scope", span: "sentry_sdk.tracing.Span" | ||
| ) -> None: | ||
| if span.op == OP.HTTP_CLIENT: | ||
| if span.op == OP.HTTP_CLIENT and span.origin not in ("auto.http.aiohttp",): | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is just here to make sure we're not creating breadcrumbs the old way in transaction-based tracing anymore. Once all HTTP client integrations have been migrated, the whole function will go away |
||
| level = None | ||
| status_code = span._data.get(SPANDATA.HTTP_STATUS_CODE) | ||
| if status_code: | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
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.
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.
This had to be moved after the PII redaction, because even if we don't want to create a span, we do want to create a breadcrumb, and we need to apply the same PII redacting logic to breadcrumbs.