Skip to main content

Unfazed Sentry

Installation

pip install unfazed-sentry

Quickstart

Add Sentry settings to your project

# settings.py

UNFAZED_SENTRY_SETTINGS = {
    "DSN": "https://public@sentry.example.com/1",
    "ENVIRONMENT": "test",
    "SAMPLE_RATE": 1.0,
    
}

see other settings in unfazed-sentry

Add Sentry Lifespan and Middleware to your project settings

UNFAZED_SETTINGS = {
    "MIDDLEWARE": [
        "unfazed_sentry.middleware.common.SentryMiddleware",
    ],
    "LIFESPAN": ["unfazed_sentry.lifespan.UnfazedSentryLifeSpan"],
    # ... other settings
}

after these settings, unfazed-sentry will automatically capture exceptions in every request and send them to Sentry.

Customize capture exceptions

from unfazed_sentry import capture_exception

def my_function():
    try:
        raise Exception("test")
    except Exception as e:
        capture_exception(e)
        raise e

Scope handlers

unfazed-sentry provides a class to customize the tags of the exception.

import typing as t

from sentry_sdk import Scope


class BaseHandler:
    def __call__(self, scope: Scope, **kwargs: t.Any) -> None:
        if "foo" in kwargs:
            scope.set_tag("foo", kwargs["foo"])

then add this handler to the SCOPE_HANDLERS setting.

UNFAZED_SENTRY_SETTINGS = {
    "DSN": "https://public@sentry.example.com/1",
    "ENVIRONMENT": "test",
    "SAMPLE_RATE": 1.0,
    "CLIENT_CLASS": "unfazed_sentry.settings.UnfazedSentrySettings",
    "SCOPE_HANDLERS": ["your_project.handler.BaseHandler"],
    
}

Metadata

Release files for unfazed-sentry 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for unfazed-sentry 0.0.2
File Size Uploaded
unfazed_sentry-0.0.2.tar.gz 42.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for unfazed-sentry 0.0.2
File Interpreter ABI Platform
unfazed_sentry-0.0.2-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 47.0 kB

Release files / unfazed_sentry-0.0.2.tar.gz

Download URL unfazed_sentry-0.0.2.tar.gz
Size 42.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2b8e2e4cd3da741261ea5a50bd2299e2ee044dfaee5f80803a139a32f78ae835
BLAKE2b-256 checksum
How to use checksums
fd904cd6e39ab771e67ce0b754a282017604d1d825089e055cadc3a286f217f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.14

Release files / unfazed_sentry-0.0.2-py2.py3-none-any.whl

Download URL unfazed_sentry-0.0.2-py2.py3-none-any.whl
Size 4.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
282c5e757fa695bbf9f45241359188bfae03e5bfafd3fbf6a5c512c33e0e2fe6
BLAKE2b-256 checksum
How to use checksums
8be8560ef7afea3d844c5ba67cd7bda15324f1354790f1f9577601ce750c3da5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.14

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release 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