Skip to main content

Sentry client for Unfazed

Project description

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,
    "CLIENT_CLASS": "unfazed_sentry.settings.UnfazedSentrySettings",
    
}

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"],
    
}

Project details


Download files

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

Source Distribution

unfazed_sentry-0.0.1.tar.gz (42.0 kB view details)

Uploaded Source

Built Distribution

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

unfazed_sentry-0.0.1-py2.py3-none-any.whl (4.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file unfazed_sentry-0.0.1.tar.gz.

File metadata

  • Download URL: unfazed_sentry-0.0.1.tar.gz
  • Upload date:
  • Size: 42.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.8

File hashes

Hashes for unfazed_sentry-0.0.1.tar.gz
Algorithm Hash digest
SHA256 55e704aee3de7fbec20a9cec56ea0935791432a839e2f0be8f79fff85c7cbc50
MD5 de7e43653b751c37df10e1ebacf480eb
BLAKE2b-256 e7ab45334d93c774de4a890f4a832326186683635649307f0c464951e970d7e5

See more details on using hashes here.

File details

Details for the file unfazed_sentry-0.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for unfazed_sentry-0.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 455054438ae9e0fd6f197d45cba629e33a6ddaf78eea2974eddd68b9cfd715de
MD5 21a779baa38be7865b776c1604c65b91
BLAKE2b-256 1d11a73683194467eefc7c8f8e12dbde0ecdd82640cd6c3879bbd5e22b6b3868

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page