Sentry (Crash Reporting)

The Sentry observer integrates Raven with your application to record tracebacks for crashes to Sentry.


Make sure your service calls configure_observers() during application startup and then add the following to your configuration file to enable and configure the Sentry observer.



# required to enable the observer
# the DSN provided by Sentry for your project
sentry.dsn = https://decaf:face@sentry.local/123

# optional: string to identify this client installation = my site

# optional: the environment this application is running in
sentry.environment = staging

# optional: comma-delimited list of module prefixes to ignore when
# determining where an error came from
sentry.exclude_paths = foo, bar

# optional: comma-delimited list of module prefixes to include for
# consideration when drilling down into an exception
sentry.include_paths = foo, bar

# optional: comma-delimited list of fully qualified names of exception
# classes (potentially with * globs) to not report.
sentry.ignore_exceptions = my_service.UninterestingException

# optional: percent chance that a given error will be reported
# (defaults to 100%)
sentry.sample_rate = 37%

# optional: comma-delimited list of fully qualified names of processor
# classes to apply to events before sending to Sentry. defaults to
# raven.processors.SanitizePasswordsProcessor
sentry.processors = my_service.SanitizeTokenProcessor



Any unexpected exceptions that cause the request to crash (including outside request context) will be reported to Sentry. The Trace ID of the current request will be included in the context reported to Sentry.

Direct Use

When enabled, the error reporting observer also adds a raven.Client object as an attribute named sentry to the RequestContext:

def my_handler(request):
    except Exception: