gufo.err.middleware.sentry¶
Sentry integration middleware.
SentryMiddleware
¶
Bases: BaseMiddleware
Sentry integration.
SentryMiddleware
is the wrapper around sentry_sdk
to seamless integration into Gufo Err.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dsn |
Optional[str]
|
URL of the sentry installation. If not provided,
use |
None
|
debug |
bool
|
Turns debug mode on and off. |
False
|
release |
Optional[str]
|
Set current version explicitly. Sentry will try to determine the version automatically if not set. |
None
|
before_send |
Optional[Callable[[Dict[str, Any], Dict[str, Any]], Optional[Dict[str, Any]]]]
|
The function accepting sentry event object and returning modified event object or nothing to stop processing. |
None
|
Examples:
To configure the SentryMiddleware:
from gufo.err import err
from gufo.err.middleware.sentry import SentryMiddleware
err.setup()
err.add_middleware(
SentryMiddleware("http://127.0.0.1:1000/", debug=True)
)
__before_send(event, hint)
¶
Enrich event with user-defined information and fingerprint.
Call user-defined before_send
and add additional
fingerprint information.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event |
Dict[str, Any]
|
Sentry event object. |
required |
hint |
Dict[str, Any]
|
Error hints. |
required |
Returns:
Type | Description |
---|---|
Optional[Dict[str, Any]]
|
Event object |