Skip to main content

👨‍💻 Flaxon Sentry Plugin

Flaxon Logo

PyPI version License: MIT Code style: ruff

Sentry error tracking and performance monitoring for Flaxon framework.

Table of Contents

Installation

pip install flaxon-sentry

Quick Start

from flaxon import Flaxon
from flaxon_sentry import SentryPlugin

app = Flaxon("my-app")

# Load Sentry plugin
await app.plugins.load_plugin(SentryPlugin(
    dsn="https://your-sentry-dsn",
    environment="production",
    release="1.0.0",
))

@app.get("/")
async def home():
    return {"message": "Hello with Sentry!"}

Features

  • Error capture — Automatically captures exceptions and sends to Sentry
  • Request context — Adds request data to Sentry events (method, path, user, etc.)
  • Performance tracking — Transaction timing for routes
  • User tracking — Associates errors with users
  • Custom tags — Add custom tags to events
  • Ignore patterns — Configure which errors to ignore

Configuration

Environment Variables

export SENTRY_DSN=https://your-sentry-dsn
export SENTRY_ENVIRONMENT=production
export SENTRY_RELEASE=1.0.0
export SENTRY_SAMPLE_RATE=1.0
export SENTRY_TRACES_SAMPLE_RATE=0.1

With Flaxon Config

app = Flaxon("my-app", config={
    "SENTRY_DSN": "https://your-sentry-dsn",
    "ENV": "production",
})

plugin = SentryPlugin.from_config(app.config)
await app.plugins.load_plugin(plugin)

Advanced Usage

User Context

def get_user_from_request(request):
    return {
        "id": request.user.id,
        "email": request.user.email,
        "username": request.user.username,
    }

plugin = SentryPlugin(dsn="...")
plugin.set_user_getter(get_user_from_request)
await app.plugins.load_plugin(plugin)

Manual Exception Capture

@app.post("/users")
async def create_user(request):
    try:
        # Some operation
        pass
    except Exception as e:
        app.state.sentry_plugin.capture_exception(e, request)
        return {"error": "Failed to create user"}

Adding Breadcrumbs

@app.get("/process")
async def process(request):
    app.state.sentry_plugin.add_breadcrumb(
        "Starting process",
        category="process",
        level="info",
        data={"user_id": 123}
    )

    # Process...

License

MIT

Download files

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

Source Distribution

flaxon_sentry-0.1.3.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

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

flaxon_sentry-0.1.3-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file flaxon_sentry-0.1.3.tar.gz.

File metadata

  • Download URL: flaxon_sentry-0.1.3.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.3

File hashes

Hashes for flaxon_sentry-0.1.3.tar.gz
Algorithm Hash digest
SHA256 67b867bc32c9c58d8a85ff4c74399c6c1920e0529ce93414919061d101eb3a39
MD5 8e929c8ead1872fcda13aed566da30a2
BLAKE2b-256 ba2a6a0928a10ebf65146aecf2293936facc547e104003b0fd5efce92bfcdc87

See more details on using hashes here.

File details

Details for the file flaxon_sentry-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: flaxon_sentry-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.3

File hashes

Hashes for flaxon_sentry-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5c10d45b0130c4bee1a0b7cc6b97be11f6929bb29642b34102ebd85d69646bdb
MD5 14fd0de99a06628d3d7ae8256cf5ba3b
BLAKE2b-256 e1d14828d1164bc36cb53f26ada1b4395f367ee0f32229cb11e31680cd02b226

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page