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

ref(arq): Use new scopes API #2878

Merged
merged 6 commits into from
Mar 25, 2024
Merged

Conversation

sentrivana
Copy link
Contributor


General Notes

Thank you for contributing to sentry-python!

Please add tests to validate your changes, and lint your code using tox -e linters.

Running the test suite on your PR might require maintainer approval. Some tests (AWS Lambda) additionally require a maintainer to add a special label to run and will fail if the label is not present.

For maintainers

Sensitive test suites require maintainer review to ensure that tests do not compromise our secrets. This review must be repeated after any code revisions.

Before running sensitive test suites, please carefully check the PR. Then, apply the Trigger: tests using secrets label. The label will be removed after any code changes to enforce our policy requiring maintainers to review all code revisions before running sensitive tests.

sentry_sdk/integrations/arq.py Outdated Show resolved Hide resolved
sentry_sdk/integrations/arq.py Outdated Show resolved Hide resolved
return await coroutine(ctx, *args, **kwargs)

hub.scope.add_event_processor(
Scope.get_current_scope().add_event_processor(
Copy link
Member

Choose a reason for hiding this comment

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

Are we sure this event processor belongs on the scope, and not the isolation scope?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This I wasn't sure about. Thinking about it again, I think isolation scope makes more sense. Will change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's also another current_scope a bit up. I think this is what confused me. It feels like both should be isolation scopes. What do you think @szokeasaurusrex @antonpirker?

Copy link
Member

Choose a reason for hiding this comment

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

I think event processors should be on the isolation scope, because they should be valid for the whole request.

Copy link
Member

Choose a reason for hiding this comment

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

I think what @antonpirker said makes sense

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tried it out now and changing either of them (or both) to work with the isolation scope makes the tests fail. 🙃 Investigating...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok this works: 9d197a3

  • the current transaction is saved on the current scope, so all scopes in the arq integration that try to update transaction attrs also have to go to the current scope
  • the event processor itself is now on the isolation scope

@sentrivana sentrivana marked this pull request as draft March 25, 2024 08:50
@sentrivana sentrivana marked this pull request as ready for review March 25, 2024 11:46
@sentrivana sentrivana merged commit fa17f3b into sentry-sdk-2.0 Mar 25, 2024
110 checks passed
@sentrivana sentrivana deleted the ivana/2.0/arq-new-scopes branch March 25, 2024 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants