Skip to main content

SaloPulse SDK for Django — error, performance and SQL monitoring.

Project description

SaloPulse Django SDK

Error, performance and SQL monitoring for Django apps. Byte-compatible wire protocol with the SaloPulse Ruby SDK.

Install

pip install salopulse-django

Quickstart

Add the middleware to settings.py (as early as possible, ideally first):

MIDDLEWARE = [
    "salopulse_django.middleware.SalopulseMiddleware",
    # ... your other middleware ...
]

Initialize the SDK at startup (e.g. in settings.py, wsgi.py or your app's AppConfig.ready):

import os
import salopulse_django

salopulse_django.init(dsn=os.environ["SALOPULSE_DSN"])

That's it. Requests now emit a performance event (with span_count), captured SQL queries (with N+1 detection), and unhandled exceptions automatically.

Optional: auto-init via INSTALLED_APPS

Instead of calling init yourself, add the app and set SALOPULSE_DSN in the environment or settings:

INSTALLED_APPS = [
    # ...
    "salopulse_django",
]

Configuration

salopulse_django.init(
    dsn=os.environ["SALOPULSE_DSN"],
    release="v1.2.3",
    environment="production",
    service="checkout-api",
    sample_rate=1.0,
)

When dsn is omitted, the SDK reads SALOPULSE_DSN from the environment or Django settings. The DSN format is https://<api_key>@host[:port].

API

import salopulse_django

salopulse_django.capture_exception(err)
salopulse_django.capture_message("something happened", level="warning")
salopulse_django.set_user(id=123, email="a@b.com")
salopulse_django.flush()   # flush buffered events now
salopulse_django.close()   # stop the background flusher (called on exit)

The SDK never raises into your app: a missing or invalid DSN makes every call a safe no-op.

License

MIT — see LICENSE.

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

salopulse_django-1.0.0.tar.gz (18.3 kB view details)

Uploaded Source

Built Distribution

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

salopulse_django-1.0.0-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

Details for the file salopulse_django-1.0.0.tar.gz.

File metadata

  • Download URL: salopulse_django-1.0.0.tar.gz
  • Upload date:
  • Size: 18.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for salopulse_django-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3f7f43aa86d0d5a0ac155ca545c3908f08392488fa6a14db24f7ebb203ae2ec7
MD5 bc4092cc371952a971545ebc4c7bc653
BLAKE2b-256 75cfb0a2be70b84ac5fa27d3050b96df9fb55d6a7283c9cea682b1172610f28a

See more details on using hashes here.

File details

Details for the file salopulse_django-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for salopulse_django-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cbb53de36b8b8fa6a0291a439212ef983ca6fd6a99940c58ed3423f062cd9a98
MD5 fa8a9e7bd1e9f44b8fe0c80c2c79d391
BLAKE2b-256 47ee778308d1d2d5b16ade3d2cbc0633f76465ba802cfd3e5b60fa4dbbcc965f

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