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,
}
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 unfazed_sentry-0.0.2.tar.gz.
File metadata
- Download URL: unfazed_sentry-0.0.2.tar.gz
- Upload date:
- Size: 42.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b8e2e4cd3da741261ea5a50bd2299e2ee044dfaee5f80803a139a32f78ae835
|
|
| MD5 |
f3f5507f06ab975731fb507f2bffd4aa
|
|
| BLAKE2b-256 |
fd904cd6e39ab771e67ce0b754a282017604d1d825089e055cadc3a286f217f4
|
File details
Details for the file unfazed_sentry-0.0.2-py2.py3-none-any.whl.
File metadata
- Download URL: unfazed_sentry-0.0.2-py2.py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
282c5e757fa695bbf9f45241359188bfae03e5bfafd3fbf6a5c512c33e0e2fe6
|
|
| MD5 |
f5fa4dc8c8fd1a6e21b6dc56cc233c8a
|
|
| BLAKE2b-256 |
8be8560ef7afea3d844c5ba67cd7bda15324f1354790f1f9577601ce750c3da5
|