Skip to content

feat(integrations): New SysExitIntegration#3401

Merged
szokeasaurusrex merged 6 commits into
masterfrom
szokeasaurusrex/sys_exit-integration
Aug 27, 2024
Merged

feat(integrations): New SysExitIntegration#3401
szokeasaurusrex merged 6 commits into
masterfrom
szokeasaurusrex/sys_exit-integration

Conversation

@szokeasaurusrex
Copy link
Copy Markdown
Member

@szokeasaurusrex szokeasaurusrex commented Aug 7, 2024

The SysExitIntegration reports SystemExit exceptions raised by calls made to sys.exit with a value indicating unsuccessful program termination – that is, any value other than 0 or None. Optionally, by setting capture_successful_exits=True, the SysExitIntegration can also report SystemExit exceptions resulting from sys.exit calls with successful values.

You need to manually enable this integration if you wish to use it.

Closes #2636

Docs issue: getsentry/sentry-docs#11043

The `SysExitIntegration` reports `SystemExit` exceptions raised by calls made to `sys.exit` with a value indicating unsuccessful program termination – that is, any value other than `0` or `None`. Optionally, by setting `capture_successful_exits=True`, the `SysExitIntegration` can also report `SystemExit` exceptions resulting from `sys.exit` calls with successful values.

You need to manually enable this integration if you wish to use it.

Closes #2636
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/sys_exit-integration branch from 8600ea2 to a91d342 Compare August 7, 2024 09:44
@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 7, 2024

❌ 4 Tests Failed:

Tests completed Failed Passed Skipped
11474 4 11470 1635
View the top 3 failed tests by shortest run time
tests.integrations.aws_lambda.test_aws test_init_error[python3.11]
Stack Traces | 10.3s run time
.../integrations/aws_lambda/test_aws.py:334: in test_init_error
    (event,) = envelope_items
E   ValueError: not enough values to unpack (expected 1, got 0)
tests.integrations.aws_lambda.test_aws test_init_error[python3.12]
Stack Traces | 11.6s run time
.../integrations/aws_lambda/test_aws.py:334: in test_init_error
    (event,) = envelope_items
E   ValueError: not enough values to unpack (expected 1, got 0)
tests.integrations.aws_lambda.test_aws test_init_error[python3.9]
Stack Traces | 15.9s run time
.../integrations/aws_lambda/test_aws.py:334: in test_init_error
    (event,) = envelope_items
E   ValueError: not enough values to unpack (expected 1, got 0)

To view individual test run time comparison to the main branch, go to the Test Analytics Dashboard

@szokeasaurusrex
Copy link
Copy Markdown
Member Author

I still need to write docs for this

Copy link
Copy Markdown
Contributor

@antonpirker antonpirker left a comment

Choose a reason for hiding this comment

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

Very cool!

We need to add this to the docs though

Comment thread sentry_sdk/integrations/sys_exit.py Outdated
@szokeasaurusrex
Copy link
Copy Markdown
Member Author

Docs issue: getsentry/sentry-docs#11043

szokeasaurusrex added a commit to getsentry/sentry-docs that referenced this pull request Aug 27, 2024
Add documentation for the sys.exit integration, introduced in getsentry/sentry-python#3401.

Closes #11043
szokeasaurusrex added a commit to getsentry/sentry-docs that referenced this pull request Aug 27, 2024
Add documentation for the sys.exit integration, introduced in getsentry/sentry-python#3401.

Closes #11043
@szokeasaurusrex szokeasaurusrex enabled auto-merge (squash) August 27, 2024 12:53
@szokeasaurusrex
Copy link
Copy Markdown
Member Author

Gonna go ahead with merging this, the docs PR is in review

@szokeasaurusrex szokeasaurusrex merged commit a7d2469 into master Aug 27, 2024
@szokeasaurusrex szokeasaurusrex deleted the szokeasaurusrex/sys_exit-integration branch August 27, 2024 13:02
szokeasaurusrex added a commit to getsentry/sentry-docs that referenced this pull request Sep 9, 2024
* docs(python): Document sys.exit integration

Add documentation for the sys.exit integration, introduced in getsentry/sentry-python#3401.

Closes #11043

* Apply suggestions from code review

Co-authored-by: vivianyentran <20403606+vivianyentran@users.noreply.github.com>

---------

Co-authored-by: vivianyentran <20403606+vivianyentran@users.noreply.github.com>
@staticmethod
def setup_once():
# type: () -> None
SysExitIntegration._patch_sys_exit()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

you could use classmethod instead. then you would not need to know name of current class.

    @classmethod
    def setup_once(cls):
        # type: () -> None
        cls._patch_sys_exit()

arjennienhuis pushed a commit to arjennienhuis/sentry-python that referenced this pull request Sep 30, 2024
* feat(integrations): New `SysExitIntegration`

The `SysExitIntegration` reports `SystemExit` exceptions raised by calls made to `sys.exit` with a value indicating unsuccessful program termination – that is, any value other than `0` or `None`. Optionally, by setting `capture_successful_exits=True`, the `SysExitIntegration` can also report `SystemExit` exceptions resulting from `sys.exit` calls with successful values.

You need to manually enable this integration if you wish to use it.

Closes getsentry#2636

* Update sentry_sdk/integrations/sys_exit.py

Co-authored-by: Anton Pirker <anton.pirker@sentry.io>

---------

Co-authored-by: Anton Pirker <anton.pirker@sentry.io>
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.

SystemExit not capturable

3 participants