docs: @sentry_sdk.trace
and static/class method decorator ordering
#8831
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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.