Hypothesis Pyramid Sentry Extension
At the moment the library is mostly being used as an experimental testing ground and therefore is not recommended for general use.
This is a Pyramid extension that wraps sentry-sdk's Pyramid integration and adds some additional customization and features.
Features
-
Initializes sentry-sdk with its Pyramid integration for you. Your app just has to set any
"h_pyramid_sentry.*"settings that you want and then doconfig.include("h_pyramid_sentry")(see instructions below for details). -
Prevents retryable exceptions from being reported to Sentry if your app is using pyramid_retry and the request is going to be retried (requires the
"h_pyramid_sentry.retry_support": Truesetting, see below).Retryable exceptions will still be reported to Sentry if the request is not going to be retried again because it has run out of retry attempts or because one of the retries fails with a non-retryable exception. When this happens only the exception from the request's final attempt is reported to Sentry, so you get a single Sentry event per request not multiple, but information about the previous failed attempts' exceptions is added to the single Sentry event.
-
Ignores errors logged by
exc_loggerif your app is using pyramid_exclog.pyramid_exclog logs all exceptions with log-level ERROR, and these all get picked up by sentry_sdk's enabled-by-default logging integration. This would mean that all exceptions in Sentry appear to come from exc_logger, and that some handled exceptions that wouldn't normally be reported to Sentry now would get reported. This extension prevents the interference by telling sentry_sdk to ignore exc_logger.
-
Provides a convenient method for apps to register their own filters for exceptions and logged errors that they don't want to be reported to Sentry. See the
"h_pyramid_sentry.filters"setting below.
Usage
config.add_settings({...}) # See below for available settings.
config.include("h_pyramid_sentry")
Filters
In your Pyramid configuration you can provide a list of filter functions in the
setting h_pyramid_sentry.filters.
These functions are passed Event objects which
they can inspect. If the function returns True, then the event is not sent to
Sentry.
For example to prevent reporting of ValueErrors:
config.add_settings({
"h_pyramid_sentry.filters": [
lambda event: instanceof(event.exception, ValueError)
],
})
Settings
The extension will listen to the following Pyramid deployment settings:
| Pyramid setting | Effect |
|---|---|
h_pyramid_sentry.init |
A dict of any options understood by sentry_sdk.init() |
h_pyramid_sentry.filters |
A list of functions to apply as filters |
h_pyramid_sentry.retry_support |
Enable retry detection and filtering |
As per the Sentry docs, the
environment variable SENTRY_DSN will be automatically read if set, although this can
also be passed along with any other Sentry SDK options via h_pyramid_sentry.init.
Release files for h-pyramid-sentry 1.0.20191018.145638
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| h_pyramid_sentry-1.0.20191018.145638.tar.gz | 8.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| h_pyramid_sentry-1.0.20191018.145638-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.6 kB
Release files / h_pyramid_sentry-1.0.20191018.145638.tar.gz
| Download URL | h_pyramid_sentry-1.0.20191018.145638.tar.gz |
|---|---|
| Size | 8.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
66e33f26704f908fb3a0aa8921cef31b8c39c0ee26daf817b05b33e8636d4eef
|
|
BLAKE2b-256 checksum How to use checksums |
bf73a18a86e7647205715de83574dd3aae7ee9931bcbf8cb4fa14bd9b88af4e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.9
|
Release files / h_pyramid_sentry-1.0.20191018.145638-py3-none-any.whl
| Download URL | h_pyramid_sentry-1.0.20191018.145638-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
69bd1c876ccd1349ace3782aab8595475e94852709c7af039099d355059f52cb
|
|
BLAKE2b-256 checksum How to use checksums |
dec93962faab45db92a7b2f8a554b1715d64faee95d88fe9d82091e30821e081
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.9
|