Skip to content
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

feat(sdk-crash-detection): Call code in post processing #49170

Merged
merged 22 commits into from
May 30, 2023

Conversation

philipphofmann
Copy link
Member

@philipphofmann philipphofmann commented May 16, 2023

If you are not @getsentry/ingest you can skip this PR.

Merging master into feature branches accidentally requested a review from almost all teams at Sentry. I'm sorry about this.

PR Details

Call SDK crash detection code in post-processing. I had to adapt the code a bit, cause I tested it with a dictionary instead of a stored event. I adapted the tests to use the same approach as the post-processing tests. The logic of the tests didn't change. I refactored all of them to work with stored events.

The next step is to store the SDK crash event to a specific sentry project with #46177

I wasn't able to get parameterized tests working with test mixin approach. Does anybody know if that's possible?

Fixes GH-46175

@philipphofmann philipphofmann requested review from jjbayer and a team and removed request for a team May 16, 2023 08:45
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label May 16, 2023
@philipphofmann philipphofmann requested review from a team as code owners May 16, 2023 08:53
@philipphofmann philipphofmann requested a review from a team May 16, 2023 08:53
@philipphofmann philipphofmann removed the Scope: Frontend Automatically applied to PRs that change frontend components label May 22, 2023
@philipphofmann philipphofmann changed the title feat(sdk-crash-monitoring): Call code in post processing feat(sdk-crash-detection): Call code in post processing May 22, 2023
@philipphofmann
Copy link
Member Author

philipphofmann commented May 25, 2023

Hey, @getsentry/ingest, I would love to get a review on this PR, please 😃 .

Copy link
Member

@jjbayer jjbayer left a comment

Choose a reason for hiding this comment

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

I wasn't able to get parameterized tests working with test mixin approach. Does anybody know if that's possible?

pytest.mark.parametrize does not work in combination with unittest.TestCase, unfortunately: pytest-dev/pytest#541

Why are you moving from standalone (pytest) functions to class-based tests, if I may ask?

src/sentry/utils/sdk_crashes/sdk_crash_detection.py Outdated Show resolved Hide resolved
src/sentry/utils/sdk_crashes/sdk_crash_detection.py Outdated Show resolved Hide resolved
src/sentry/utils/sdk_crashes/event_stripper.py Outdated Show resolved Hide resolved
src/sentry/utils/sdk_crashes/event_stripper.py Outdated Show resolved Hide resolved
Co-authored-by: Joris Bayer <joris.bayer@sentry.io>
@philipphofmann
Copy link
Member Author

Why are you moving from standalone (pytest) functions to class-based tests, if I may ask?

So I can apply the same approach for creating an event in test_post_process. I didn't manage to use the same approach with functions, @jjbayer.

@loewenheim loewenheim self-requested a review May 30, 2023 11:19
@jjbayer
Copy link
Member

jjbayer commented May 30, 2023

Why are you moving from standalone (pytest) functions to class-based tests, if I may ask?

So I can apply the same approach for creating an event in test_post_process. I didn't manage to use the same approach with functions, @jjbayer.

Yeah so AFAIK you have to chose between using either @pytest.mark.parametrize or class-based testing with manual parameterization, whichever you prefer.

src/sentry/utils/sdk_crashes/event_stripper.py Outdated Show resolved Hide resolved
src/sentry/utils/sdk_crashes/event_stripper.py Outdated Show resolved Hide resolved
@philipphofmann philipphofmann merged commit ed415e4 into feat/sdk-crash-monitoring May 30, 2023
@philipphofmann philipphofmann deleted the feat/add-to-post-processing branch May 30, 2023 13:08
@asottile-sentry
Copy link
Member

Why are you moving from standalone (pytest) functions to class-based tests, if I may ask?

So I can apply the same approach for creating an event in test_post_process. I didn't manage to use the same approach with functions, @jjbayer.

Yeah so AFAIK you have to chose between using either @pytest.mark.parametrize or class-based testing with manual parameterization, whichever you prefer.

of note, TestCase and class based tests are soft deprecated -- please try and write function tests moving forward (pytest has already begun to remove / unsupport functionality there over time -- the compat layer is only meant as a migration helper)

@philipphofmann
Copy link
Member Author

Thanks for pointing that out, @asottile-sentry. I created an issue to change the tests to function tests #50061.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Call code in post processing
3 participants