Skip to content

feat(session): Add unhandled session status type #4939

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
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

ryan953
Copy link
Member

@ryan953 ryan953 commented Jul 14, 2025

This is in service of this project: https://www.notion.so/sentry/RFC-Session-Status-unhandled-2308b10e4b5d801d9805fece61533ac5#2308b10e4b5d80e9b312ecbea27a4af3

TL/DR:
We're adding a new enum value to split up the existing crashed release health metric into two more specific metrics:

  • Unhandled
  • Crashed
    For cases like Flutter: a Dart error will not crash the running process, while a native error will. We want to be clearer about this when we report errors to sentry users.

This PR
This PR will allow us to properly count session and sessions envelopes that contain the new value. When a session envelope arrives that has the new value: status: unhandled we want the SessionLike metric to handle that the same way we handle status: abnormal or status: crashed. We'll subtract 1 from the errors count and return 1 from unhandled_count().

Similarly, for sessions envelopes we need to implement the unhandled_count() function.

Finally, we have to implement the if-statements that will get the new count from the session, session.unhandled_count() and push the value into the list.

Fixes REPLAY-549

Copy link

linear bot commented Jul 22, 2025

@ryan953 ryan953 force-pushed the ryan953/session-type-unhandled branch from c54dd86 to 92e3074 Compare July 22, 2025 17:48
@ryan953 ryan953 marked this pull request as ready for review July 22, 2025 18:03
@ryan953 ryan953 requested a review from a team as a code owner July 22, 2025 18:03
@ryan953 ryan953 requested a review from cmanallen July 22, 2025 20:08
Copy link
Member

@Dav1dde Dav1dde left a comment

Choose a reason for hiding this comment

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

We have some session integration tests in test_session.py, would be great if you can add/modify them to also test the new codepaths.

@ryan953
Copy link
Member Author

ryan953 commented Jul 23, 2025

@Dav1dde I don't think that test_session.py is testing any of the properties of the session envelope, it looks like it's only testing for the filter rules that accept/deny envelopes.

instead i'll add some tests at the bottom of session.rs and mod.rs. The existing tests are not comprehensive to test all the session state types, but i'll expand them as best i can.

@Dav1dde
Copy link
Member

Dav1dde commented Jul 23, 2025

It would be good to still have a single integration test in Python, you're right it seems like the tests in test_session mostly focus on dropping sessions, we do have some that test metric conversions (when searching for usages for send_session) which can work as a template.

I generally want at least one integration test for every protocol change, just to show it works, especially since integration tests very easily can setup a 'Relay chain' to make sure, the protocol change also works when interacting with multiple different types of Relays. A Rust unittest, can unfortunately not do that.

On a side note, I am now seeing that these tests are pretty worthless, as Relay stopped supporting producing to a sessions topic over a year ago :(

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.

3 participants