Skip to main content

minisentry

A Django reusable app to extend sentry-sdk with ability to collect errors in local database rather than send to sentry. An admin panel is provided to browse grouped issues.

This app is useful when for some reason you cannot use sentry.io interface, maybe you can't send data to third party vendors, maybe you can't have a self-hosted version.

This is a very simple app, it hooks into sentry_sdk.init.before_send function, serializes the events into json and stores them in the database.

Thjs app is written in rush to get first working version out, I test the app in my application and only maybe will add automatic tests if it gets used.

I analysed the datastructures emitted by sentry-sdk and hae some confidence that I didn't miss anything. The app will store the raw event as a whole, so if I missed anything, corrections to the main template should be enough. It is a recoverbale mistake.

This app will obviously only work for errors that don't relate to database connection itself. You have to have working django and connection to store them.

Versioning: calver, I only care for the most recent version of sentry-sdk, python and django, but likely it will work with some lower versions.

I start with implementing only what I need, with time I will add more stuff.

install

pip install django-minisentry

# settings.py
INSTALLED_APPS = [
    ...,
    'minisentry'
]

# urls.py
urlpatterns = [
    ...
    path('minisentry/', include('minisentry.urls')),
    ...
]

# wherever you setup sentry_sdk
from minisentry import store
sentry_sdk.init(
    ...,
    before_send = store(
        send=False,            # default
        event_callback=print,  # maybe for debug
        hint_callback=print,   # maybe for debug
        ignore_errors=(ZeroDivisionError, KeyboardInterrupt)
    )
)

develop

git clone https://github.com/bartekbrak/django-minisentry
pip install -e django-minisentry

legal

Dear Sentry, please don't sue me. This project is for people who cannot use your wonderful, best-in-class product. I'm your biggest fan and evangelise your paid version where I can. This all is in good faith, but it does abuse your SDK, you didn't build it so that we can store your events elsewhere. Thanks.

todo

  • tests
  • backlinks, in admin, in browse
  • search
  • graph on issue list
  • x minutes ago
  • permissions?
  • colours
  • stringify2 needs to escape html
  • management commands to delete old
  • storage information, sizes
  • clean css
  • prettify sql

based on

build and release (to myself)

pip install -e .
pip install -U setuptools wheel build twine
# change "version = ????????" in setup.cfg
rm dist/* && python -m build --wheel &&  twine check dist/* && twine upload dist/*

changelog

  • 2024-02-06 'dict' object has no attribute 'tags'
  • 2023-08-24 handle logger.error
  • 2023-08-17 display tags set via sentry_sdk.set_tag("sth", "sth")
  • 2023-08-11 ignore_errors, expand README
  • 2023-08-10 rename to minisentry
  • 2023-08-04 first rushed alpha version

Metadata

Release files for django-minisentry 20240206.1

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

Built distribution (wheel)

Table of built distributions (wheels) for django-minisentry 20240206.1
File Interpreter ABI Platform Actions
django_minisentry-20240206.1-py3-none-any.whl Python 3 none any Details for django_minisentry-20240206.1-py3-none-any.whl

Release files / django_minisentry-20240206.1-py3-none-any.whl

Download URL django_minisentry-20240206.1-py3-none-any.whl
Size 12.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8f5c07a9196edd5aba5e8d8d43e76d47d9981f9fa6c7919997a050b35756b6f0
BLAKE2b-256 checksum
How to use checksums
d8794b34f268a8df2925788c7bd9366d9d1a1b3d3adb36655b4edf069c1caa63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Security for django-minisentry 20240206.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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