getsentry / getsentry/sentry-python

Utility function/decorator to mark things as Sentry-patched

Đang mở
#3,375 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Improvement Python Quality Improvement
Ngôn ngữ chính
Python
Star
2.2k
Fork
669
Merge trung bình
1 ngày 1 giờ
Pull request đã merge (30 ngày)
213

Mô tả

While reviewing #3358, I had the idea that we might want to make it easier to detect when the SDK has already patched something. This came up because with the `@ensure_integration_enabled` decorator, the function's `__name__` (and similar attributes) are overwritten to make the function look like the original function, so we cannot use these attributes to detect that a function has been patched by Sentry. I originally thought adding this would be necessary for that PR to work, but turns out we don't need it, so I am documenting this idea here, instead.

We could add this to the `@ensure_integration_enabled` decorator and/or make a separate decorator. The decorator would set an attribute called something like `_sentry_patched` on the patched function/class/etc. We could set this attribute simply to `True`, or if we want to make it more informative, maybe we can include some information about what patched the function (maybe the integration class/identifier – we can think about what would be the most helpful).

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.