Skip to main content

Sentry Integration for Muffin framework

Project description

Muffin-SentrySentry Integration for Muffin framework

Tests Status PYPI Version

Requirements

  • python >= 3.8

Installation

Muffin-Sentry should be installed using pip:

pip install muffin-sentry

Usage

from muffin import Application
import muffin_sentry

# Create Muffin Application
app = Application('example')

# Initialize the plugin
# As alternative: jinja2 = Jinja2(app, **options)
sentry = muffin_sentry.Plugin()
sentry.init(app, dsn="DSN_URL")

# Use it inside your handlers

# The exception will be send to Sentry
@app.route('/unhandled')
async def catch_exception(request):
    raise Exception('unhandled')

# Capture a message by manual
@app.route('/capture_message')
async def message(request):
    sentry.capture_message('a message from app')
    return 'OK'

# Capture an exception by manual
@app.route('/capture_exception')
async def exception(request):
    sentry.capture_exception(Exception())
    return 'OK'

# Update Sentry Scope
@app.route('/update_user')
async def user(request):
    scope = sentry.current_scope.get()
    scope.set_user({'id': 1, 'email': 'example@example.com'})
    sentry.capture_exception(Exception())
    return 'OK'

Options

Format: Name – Description (default value)

dsn – Sentry DSN for your application ('')

sdk_options – Additional options for Sentry SDK Client ({}). See https://docs.sentry.io/platforms/python/configuration/options/

ignore_errors – Exception Types to Ignore ([muffin.ResponseRedirect, muffin.ResponseError])

You are able to provide the options when you are initiliazing the plugin:

sentry.init(app, dsn='DSN_URL')

Or setup it inside Muffin.Application config using the SENTRY_ prefix:

SENTRY_DSN = 'DSN_URL'

Muffin.Application configuration options are case insensetive

Bug tracker

If you have any suggestions, bug reports or annoyances please report them to the issue tracker at https://github.com/klen/muffin-sentry/issues

Contributing

Development of Muffin-Sentry happens at: https://github.com/klen/muffin-sentry

Contributors

  • klen (Kirill Klenov)

License

Licensed under a MIT license.

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

muffin-sentry-0.4.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

muffin_sentry-0.4.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file muffin-sentry-0.4.0.tar.gz.

File metadata

  • Download URL: muffin-sentry-0.4.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.9.0

File hashes

Hashes for muffin-sentry-0.4.0.tar.gz
Algorithm Hash digest
SHA256 8a44fb4e9d7ec6e9f3b94c4f1fe3c6e31aaceb72a39e99c3b2f0b1813650af31
MD5 278c271913c4e5375fb1e3e122a9e1a6
BLAKE2b-256 8805f232b4581b3310ab75ccb7e87a98fcf1268da57cc84d1b703d58d9fad1d4

See more details on using hashes here.

File details

Details for the file muffin_sentry-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: muffin_sentry-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.9.0

File hashes

Hashes for muffin_sentry-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2ace1f17c15675fe30e0369477e1c60bfe2111ac5a30b457cb82af8bf4ba0ddd
MD5 da3a9db83ffc600eb4e0f4ec16535acc
BLAKE2b-256 a98abae1f48c95c6d182dd38f88c077e905dc7d699f8aea3ad869bdc48efb196

See more details on using hashes here.

Supported by

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