Skip to content

openwisp/openwisp-sentry-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenWISP Sentry Utils

This module contains reusable methods that are used to configure sentry on different installations.



Utility functions bundled in ow_sentry_utils

traces_sampler

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,
    # ...
)

before_send

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,
    # ...
)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages