Skip to content

feat(asgi): Migrate away from event processor in span first#5920

Draft
sentrivana wants to merge 18 commits intomasterfrom
ivana/migrate-asgi-event-processor
Draft

feat(asgi): Migrate away from event processor in span first#5920
sentrivana wants to merge 18 commits intomasterfrom
ivana/migrate-asgi-event-processor

Conversation

@sentrivana
Copy link
Copy Markdown
Contributor

Description

In span first, there are no event processors. Therefore, we need to be able to set the data we were setting in event processors in some other way.

As we migrate our integrations one by one, this will be an exercise in whether it's possible to achieve this without some sort of callback/lifecycle hooks. So far, in ASGI, it seems we can get by by simply using scope.set_attribute() for setting request related data, and updating the segment name/source just before the span ends.

Adding this enables us to actually test the new functionality.

Issues

Reminders

@linear-code
Copy link
Copy Markdown

linear-code bot commented Mar 30, 2026

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 30, 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.

1 similar comment
@github-actions
Copy link
Copy Markdown
Contributor

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 Mar 30, 2026

Codecov Results 📊

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

All tests are passing successfully.

❌ Patch coverage is 7.41%. Project has 14885 uncovered lines.

Files with missing lines (4)
File Patch % Lines
traces.py 35.71% ⚠️ 198 Missing
asgi.py 15.61% ⚠️ 173 Missing
_wsgi_common.py 30.53% ⚠️ 91 Missing and 1 partials
_asgi_common.py 14.08% ⚠️ 61 Missing

Generated by Codecov Action

return request_data


def _get_request_attributes(asgi_scope: "Any") -> "dict[str, Any]":
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 an attributes based copy of _get_request_data just above


return name, source

def _get_segment_name_and_source(
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 a copy of _get_transaction_name_and_source above, just adapted for segments

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.

Event processor replacement for streamed spans

1 participant