Skip to main content

Sentry Integration for Muffin framework

Project description

Muffin-SentrySentry Integration for Muffin framework

Tests Status PYPI Version Python Versions

Requirements

  • python >= 3.9

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")

# Setup custom request processors (coroutines are not supported)
@sentry.processor
def user_scope(event, hint, request):
    if request.user:
        event['user'] = request.user.email
    return event

# 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

Name

Default value

Desctiption

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

[ResponseError, ResponseRedirect]

Exception Types to Ignore

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 insensitive

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-1.11.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

muffin_sentry-1.11.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file muffin_sentry-1.11.0.tar.gz.

File metadata

  • Download URL: muffin_sentry-1.11.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.12.3 Linux/6.8.0-1017-azure

File hashes

Hashes for muffin_sentry-1.11.0.tar.gz
Algorithm Hash digest
SHA256 fbeaadb3d6501216c1de0a31939805e5e1e5ba26bd92afbf08c6089f89f741be
MD5 5e16be3680536d074e0d8d39e53bdb91
BLAKE2b-256 d18132907dd5a521745654fe32466e3b58ed6118162c72cb8206f4bc09057405

See more details on using hashes here.

File details

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

File metadata

  • Download URL: muffin_sentry-1.11.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.12.3 Linux/6.8.0-1017-azure

File hashes

Hashes for muffin_sentry-1.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 70800e47ed88b6756f1e11e697097c5f67d9df0664c1e3c5ae05e8834da79ca6
MD5 3ce01922ebd5f0b967280a2eea00ff3a
BLAKE2b-256 92552cde94f1e76a487366472164f5ea00dd7d31ba6e4e2419a36f0f41f897cd

See more details on using hashes here.

Supported by

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