getsentry / getsentry/sentry-python
Utility function/decorator to mark things as Sentry-patched
- Lingua principale
- Python
- Stelle
- 2.2k
- Fork
- 669
- Merge medio
- 1g 40m
- PR unite (30g)
- 212
Descrizione
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).
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Start by reviewing the existing `ensure_integration_enabled` decorator and the context in #3358. Decide whether the marker belongs in that decorator or a separate decorator, and what information it should store. Done means patched functions or classes can be reliably identified without losing their original attributes.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- devtools
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100