Skip to main content

A Pyramid plugin for integrating Sentry monitoring and error tracking

Project description

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 do config.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": True setting, 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_logger if 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

h_pyramid_sentry-1.0.20191018.174823.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

h_pyramid_sentry-1.0.20191018.174823-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file h_pyramid_sentry-1.0.20191018.174823.tar.gz.

File metadata

  • Download URL: h_pyramid_sentry-1.0.20191018.174823.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for h_pyramid_sentry-1.0.20191018.174823.tar.gz
Algorithm Hash digest
SHA256 c2e6bb99a2a7f02886e4993a6c0f710f8ece895ea81bd28a41f845f8597e5f73
MD5 c777beaeb6c7ad32d1dac876642c7e59
BLAKE2b-256 bd189dcac04c0282ece8baa86d6d96b10c4854126e70605950ff950775fdbaed

See more details on using hashes here.

File details

Details for the file h_pyramid_sentry-1.0.20191018.174823-py3-none-any.whl.

File metadata

  • Download URL: h_pyramid_sentry-1.0.20191018.174823-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for h_pyramid_sentry-1.0.20191018.174823-py3-none-any.whl
Algorithm Hash digest
SHA256 cdca726af01a52277759120eb3d3c1fc4618daa86527112d3a6e3973001f5d42
MD5 8c5132e82de434b71921de0d414b93f1
BLAKE2b-256 2e5f9af33258fd9deda2ae72c673b7a82374e557ceba35b2dcdb41041d970f12

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page