Skip to main content
# 👨‍💻 Flaxon Sentry Plugin

<p align="center">
  <img src="https://raw.githubusercontent.com/aldanedev-create/Flaxon-Backend-Framework/main/assets/flaxon.png" alt="Flaxon Logo" width="200"/>
</p>

<p align="center">
  <a href="https://pypi.org/project/flaxon/"><img src="https://img.shields.io/pypi/v/flaxon.svg" alt="PyPI version"></a>
  <a href="https://github.com/aldanedev-create/Flaxon-Backend-Framework/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
  <a href="https://github.com/astral-sh/ruff"><img src="https://img.shields.io/badge/code%20style-ruff-000000.svg" alt="Code style: ruff"></a>
</p>

**Sentry error tracking and performance monitoring for Flaxon framework.**

## Table of Contents

- [Installation](#installation)
- [Quick Start](#quick-start)
- [Features](#features)
- [Configuration](#configuration)
  - [Environment Variables](#environment-variables)
  - [With Flaxon Config](#with-flaxon-config)
- [Advanced Usage](#advanced-usage)
  - [User Context](#user-context)
  - [Manual Exception Capture](#manual-exception-capture)
  - [Adding Breadcrumbs](#adding-breadcrumbs)
- [License](#license)

## Installation

```bash
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.2.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.2-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: flaxon_sentry-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 3ca00854b48b4f4959a0b973db6a608afbef96e538998e54f364ce6a84dc45f7
MD5 6f1b33d1ed4a267094a3cfe2e46f7b83
BLAKE2b-256 ee56fab34a73351d28d8847108a6444bc632d34690907e1cdd5272d2d3fde995

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flaxon_sentry-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d5665b2036044659a7c230ce29a921eeb9b0d09e7b46cd72499fc31555ab09e6
MD5 7a49eb44e2e3bb04c1850f8b197280b5
BLAKE2b-256 b7f4d523c7316d937974c1c2d14eb3013e0acf9ea68fcfe7bea7751098fb4dd3

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.3

2 files

This release

0.1.2 This release

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