Coder Social home page Coder Social logo

muffin-sentry's Introduction

Muffin-Sentry

Muffin-Sentry -- Sentry Integration for Muffin framework

Tests Status PYPI Version Python Versions
  • python >= 3.8

Muffin-Sentry should be installed using pip:

pip install muffin-sentry
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': '[email protected]'})
    sentry.capture_exception(Exception())
    return 'OK'
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

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

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

  • klen (Kirill Klenov)

Licensed under a MIT license.

muffin-sentry's People

Contributors

dependabot[bot] avatar klen avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.