# 👨💻 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)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ca00854b48b4f4959a0b973db6a608afbef96e538998e54f364ce6a84dc45f7
|
|
| MD5 |
6f1b33d1ed4a267094a3cfe2e46f7b83
|
|
| BLAKE2b-256 |
ee56fab34a73351d28d8847108a6444bc632d34690907e1cdd5272d2d3fde995
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5665b2036044659a7c230ce29a921eeb9b0d09e7b46cd72499fc31555ab09e6
|
|
| MD5 |
7a49eb44e2e3bb04c1850f8b197280b5
|
|
| BLAKE2b-256 |
b7f4d523c7316d937974c1c2d14eb3013e0acf9ea68fcfe7bea7751098fb4dd3
|