Skip to content

ref(stdlib): Move crumbs to integration - #7161

Open
sentrivana wants to merge 14 commits into
ivana/move-http-crumbs-3from
ivana/move-http-crumbs-4
Open

ref(stdlib): Move crumbs to integration#7161
sentrivana wants to merge 14 commits into
ivana/move-http-crumbs-3from
ivana/move-http-crumbs-4

Conversation

@sentrivana

@sentrivana sentrivana commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Description

Migrate http.client breadcrumbs from maybe_create_breadcrumbs_from_span directly to the StdlibIntegration.

As the flow is scattered (one point where a request starts, but multiple points where it might end), we save the breadcrumb data alongside the span and emit a breadcrumb whenever we detect a response is finished.

Also:

  • Add tests to both the standard library test suite and requests.

Issues

Part of #7067

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Codecov Results 📊

105335 passed | ⏭️ 6687 skipped | Total: 112022 | Pass Rate: 94.03% | Execution Time: 366m 34s

📊 Comparison with Base Branch

Metric Change
Total Tests 📈 +1361
Passed Tests 📈 +1351
Failed Tests
Skipped Tests 📈 +10

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 2490 uncovered lines.
❌ Project coverage is 90.13%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
sentry_sdk/integrations/stdlib.py 100.00% ⚠️ 4 partials
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    90.15%    90.13%    -0.02%
==========================================
  Files          193       193         —
  Lines        25147     25229       +82
  Branches      9136      9178       +42
==========================================
+ Hits         22669     22739       +70
- Misses        2478      2490       +12
- Partials      1431      1436        +5

Generated by Codecov Action

_complete_span(span)
if (
breadcrumb
and "getresponse() got an unexpected keyword argument 'buffering'"

@sentrivana sentrivana Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This exception is basically used for control flow/compatibility in old urllib3. getresponse() will be called again afterwards without the extra arg, which is when we'll emit the breadcrumb. If this extra check were not here, we'd emit one crumb too many.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Also, we can get rid of this once we drop 3.6, it's only really a problem in super old requests on Python 3.6.)

@sentrivana
sentrivana marked this pull request as ready for review August 11, 2026 08:56
@sentrivana
sentrivana requested a review from a team as a code owner August 11, 2026 08:56

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2e0281a. Configure here.

Comment thread sentry_sdk/integrations/stdlib.py
Comment thread sentry_sdk/tracing.py
@sentrivana
sentrivana marked this pull request as draft August 11, 2026 09:03
@sentrivana
sentrivana marked this pull request as ready for review August 11, 2026 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants