Sentry Integration for Muffin framework
Project description
Muffin-Sentry – Sentry Integration for Muffin framework
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.setup(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.setup(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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for muffin_sentry-0.5.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a1a340fe425f21d1cbf8a80a02a4e8c859828258e184bbf1c880958403f23ae |
|
MD5 | 74de3d3e75d210e4fe8ea29f1c377cc5 |
|
BLAKE2b-256 | 5ce036a176f4eeedf1e22272f5f9dae6e2612160d54448aa3e3f75e191f088b3 |