This module contains reusable methods that are used to configure sentry on different installations.
Table of Contents:
This function does not allow logging of database transactions generated by celery workers on sentry. It also reduces transactions logged for device checksum and monitoring views.
Usage:
from ow_sentry_utils import traces_sampler
sentry_sdk.init(
# ...
traces_sampler=traces_sampler,
# ...
)
This function filters errors logged on sentry based on
SENTRY_IGNORE_ERRORS
.
Usage:
from ow_sentry_utils import before_send
sentry_sdk.init(
# ...
before_send=before_send,
# ...
)
You can also tweak the value of SENTRY_IGNORE_ERRORS
as shown below
from ow_sentry_utils import before_send, SENTRY_IGNORE_ERRORS
SENTRY_IGNORE_ERRORS.update(
{
# logger-name
"multiprocessing": [
# List of regex against which the error will matched.
# If a match is found, the error will not be sent to
# sentry.
r"os.writeError"
]
}
)
# Note that there is no change in the syntax for using the "before_send"
# function even if SENTRY_IGNORE_ERRORS is updated.
sentry_sdk.init(
# ...
before_send=before_send,
# ...
)