Skip to content

feat(wsgi): Migrate to span first#5988

Merged
sentrivana merged 33 commits intomasterfrom
ivana/migrate-wsgi-to-span-first
Apr 14, 2026
Merged

feat(wsgi): Migrate to span first#5988
sentrivana merged 33 commits intomasterfrom
ivana/migrate-wsgi-to-span-first

Conversation

@sentrivana
Copy link
Copy Markdown
Contributor

@sentrivana sentrivana commented Apr 13, 2026

Description

Make the WSGI integration span first ready.

Also, set an additional attribute (user.ip_address) in ASGI.

Recommended to review with Ignore whitespace on.

Issues

Reminders

Base automatically changed from ivana/migrate-asgi-event-processor to master April 13, 2026 13:41
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 13, 2026

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


This PR will not appear in the changelog.


🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 13, 2026

Codecov Results 📊

13 passed | Total: 13 | Pass Rate: 100% | Execution Time: 6.83s

All tests are passing successfully.

❌ Patch coverage is 7.81%. Project has 15327 uncovered lines.

Files with missing lines (3)
File Patch % Lines
scope.py 65.78% ⚠️ 297 Missing and 74 partials
wsgi.py 17.84% ⚠️ 152 Missing
_asgi_common.py 13.70% ⚠️ 63 Missing

Generated by Codecov Action

@github-actions
Copy link
Copy Markdown
Contributor

Codecov Results 📊

49 passed | ⏭️ 3 skipped | Total: 52 | Pass Rate: 94.23% | Execution Time: 12.36s

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

❌ Patch coverage is 7.81%. Project has 15640 uncovered lines.
❌ Project coverage is 26.7%. Comparing base (base) to head (head).

Files with missing lines (5)
File Patch % Lines
scope.py 61.75% ⚠️ 332 Missing and 73 partials
asgi.py 15.38% ⚠️ 176 Missing
wsgi.py 20.65% ⚠️ 123 Missing
_wsgi_common.py 23.75% ⚠️ 122 Missing
_asgi_common.py 13.70% ⚠️ 63 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    26.75%    26.70%    -0.05%
==========================================
  Files          191       191         —
  Lines        21281     21336       +55
  Branches      7006      7036       +30
==========================================
+ Hits          5692      5696        +4
- Misses       15589     15640       +51
- Partials       490       490         —

Generated by Codecov Action

return event_processor


def _get_request_attributes(
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 is essentially a port of the event processor

self, custom_sampling_context: "dict[str, Any]"
) -> None:
self.get_active_propagation_context()._set_custom_sampling_context(
self.get_current_scope().get_active_propagation_context()._set_custom_sampling_context(
Copy link
Copy Markdown
Contributor Author

@sentrivana sentrivana Apr 14, 2026

Choose a reason for hiding this comment

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

This change was necessary as we're now always starting spans, regardless of type (segment or child), on the current scope instead of the isolation scope, so we also need to use the propagation context from there.

@linear-code
Copy link
Copy Markdown

linear-code bot commented Apr 14, 2026

@sentrivana sentrivana marked this pull request as ready for review April 14, 2026 10:02
@sentrivana sentrivana requested a review from a team as a code owner April 14, 2026 10:02
Copy link
Copy Markdown

@cursor cursor bot left a comment

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 54064a5. Configure here.

@sentrivana sentrivana merged commit 822b244 into master Apr 14, 2026
167 of 169 checks passed
@sentrivana sentrivana deleted the ivana/migrate-wsgi-to-span-first branch April 14, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate wsgi to span first

2 participants