shy-sentry
sentry-sdk but silent
Shh.
Extending getsentry/sentry-python, this package provides the following customizations we found useful in multiple projects:
- default integrations that have a silent
AtexitIntegration.callback - a
Guard()context manager / decorator which provides quite sentry feedback on errors for parts of code that cannot let exceptions rock all the way up to killing the process. This is intended for use in our legacy cgi scripts, where console output is undesired. - loading certain
sentry_sdk.initkwargs (dsn,environment,release) from json by default. - restores
sentry_sdk.serializer.MAX_DATABAG_DEPTHand expandssentry_sdk.serializer.MAX_DATABAG_BREADTHfor more complete debugging information. This is intended for use in our legacy cgi scripts, where code complexity per function can be higher then desired in non-legacy code.
Table of contents
Badges
master
develop
Install
$ pip install shy-sentry
Usage
Create a JSON configuration file with keys, used to configure sentry sdk:
{
"SENTRY_DSN": "https://client_key@sentry.io/project_id",
"SENTRY_ENVIRONMENT": "dev",
"SENTRY_RELEASE_STRING": "project:branch@version"
}
Then, setup shy-sentry in the desired entry point and guard your entry point using Guard as a context manager or as a
decorator.
as context manager
import shy_sentry
def main():
print(1/0)
if __name__ == "__main__":
shy_sentry.init(config_path="./sentry_config.json")
with shy_sentry.Guard():
main()
as decorator
import shy_sentry
@shy_sentry.Guard()
def main():
print(1/0)
if __name__ == "__main__":
shy_sentry.init(config_path="./sentry_config.json")
main()
Exceptions outside of Guard() will get you ZeroDivisionError issue/event in Sentry AND a traceback in your console,
when using default integrations.
import shy_sentry
def main():
print(1/0)
if __name__ == "__main__":
shy_sentry.init(config_path="./sentry_config.json")
main()
If Guard() can't get a sentry_sdk.client.Client instance, it will reraise exceptions instead of ignoring them.
If there are certain exceptions you want reraised from Guard(), you'll need a sub-class like this:
from shy_sentry import Guard
class MyGuard(Guard):
def __exit__(self, exc_type, exc_val, exc_tb):
if not super().__exit__(exc_type, exc_val, exc_tb):
# super intends to ignore, do we want to ignore?
if isinstance(exc_type, OSError):
return True
return False
Metadata
Release files for shy-sentry 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| shy-sentry-1.2.0.tar.gz | 4.9 kB | Without provenance | Details for shy-sentry-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| shy_sentry-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for shy_sentry-1.2.0-py3-none-any.whl |
Total release size: 10.3 kB
Release files / shy-sentry-1.2.0.tar.gz
| Download URL | shy-sentry-1.2.0.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6b433aecc555ce58850eb308203969692860837809a719058dc4d0693056da87
|
|
BLAKE2b-256 checksum How to use checksums |
7e4ef39367325498c2fff3b284b72280530b20291f5a57a04ec26b53444abe1b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.8
|
Release files / shy_sentry-1.2.0-py3-none-any.whl
| Download URL | shy_sentry-1.2.0-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a599e552ba3d0677842800701a0c47b2eaefbf39f0d1370e639750b54afe568f
|
|
BLAKE2b-256 checksum How to use checksums |
3d345527231776a15b388502d604c452c907f9226ae25e65908bfc22d6d9f1cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.8
|
Security for shy-sentry 1.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.