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

docs: @sentry_sdk.trace and static/class method decorator ordering #8831

Merged

Conversation

szokeasaurusrex
Copy link
Member

Pre-merge checklist

If you work at Sentry, you're able to merge your own PR without review, but please don't unless there's a good reason.

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs
  • PR was reviewed and approved by a member of the Sentry docs team

Description of changes

This PR updates the Sentry Python SDK tracing docs to inform users that when tracing a static or class method using the @sentry_sdk.trace decorator, the decorator must be placed after the @staticmethod or @classmethod decorator.

Failing to adhere to this ordering will break the function (specifically when it is called on an instance rather than on the class), due to how static and class methods work in the Python language (see getsentry/sentry-python#2525). Unfortunately, because of how static and class methods work in Python it is probably impossible to change the @sentry_sdk.trace decorator to allow a flipped ordering, so alerting users in the documentation is likely the best solution.

@szokeasaurusrex szokeasaurusrex self-assigned this Jan 8, 2024
Copy link

vercel bot commented Jan 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
sentry-docs ✅ Ready (Inspect) Visit Preview Jan 8, 2024 4:45pm
1 Ignored Deployment
Name Status Preview Updated (UTC)
sentry-docs-next ⬜️ Ignored (Inspect) Jan 8, 2024 4:45pm

Copy link
Contributor

@shanamatthews shanamatthews left a comment

Choose a reason for hiding this comment

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

LGTM!

@szokeasaurusrex szokeasaurusrex merged commit e3af171 into master Jan 9, 2024
9 checks passed
@szokeasaurusrex szokeasaurusrex deleted the szokeasaurusrex/staticmethod-tracing-python branch January 9, 2024 09:12
@github-actions github-actions bot locked and limited conversation to collaborators Jan 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants