Skip to main content

event-monitoring

A tiny, non-blocking emitter that publishes business/contextual events from any Python app to a Redis Stream for a monitoring dashboard to consume.

  • Sync (emit) and async (aemit) APIs.
  • Transaction-safe under Django (transaction.on_commit); works fine without Django.
  • Opt-in — a no-op unless MONITORING_ENABLED is truthy, so it's inert when installed into an app nobody has wired up to a dashboard.
  • Only hard dependency is redis.

Install

pip install event-monitoring
# or
uv add event-monitoring

Pre-release / unpublished, straight from Git:

pip install "git+https://github.com/<you>/event-monitoring.git@v0.1.0"

For local cross-repo dev, as a uv path source:

[tool.uv.sources]
event-monitoring = { path = "../event-monitoring", editable = true }

Usage

import event_monitoring

# Sync (Django views, scripts, workers)
event_monitoring.emit(
    event="offer_approved",
    entity_type="offer", entity_id=offer.id,
    actor_id=request.user.id,
    url=request.build_absolute_uri(offer.get_absolute_url()),
    payload={"amount": offer.amount},
)

# Async (asyncio apps — e.g. a Discord bot). Offloads the blocking publish.
await event_monitoring.aemit("music_played", entity_type="guild", entity_id=guild_id,
                             actor_id=user.id, payload={"song": title})

Configuration (env vars)

Var Default Meaning
MONITORING_ENABLED 0 (off) Set 1/true/yes to actually publish.
MONITORING_APP unknown Logical source-app name (rms, dryorm, …).
MONITORING_REDIS_URL redis://events-redis:6379/0 Redis the dashboard consumes from. Keep separate from the app's own Redis.
MONITORING_STREAM events Stream name.

Publish failures are swallowed (warned once) — monitoring never breaks the host app.

Event shape

{"app":"rms","event":"offer_approved","entity_type":"offer","entity_id":"123",
 "actor_id":"55","url":"https://rms.example/offers/123",
 "timestamp":"<naive-UTC-iso>","payload":{}}

Download files

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

Source Distribution

event_monitoring-0.1.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

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

event_monitoring-0.1.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file event_monitoring-0.1.0.tar.gz.

File metadata

  • Download URL: event_monitoring-0.1.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for event_monitoring-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4553c69a07e75a3e661589011d9e0adb978cb9fd7ed569a07eab6596790c5b5c
MD5 e396fbeabb6b28f885f8b411c72ea8c2
BLAKE2b-256 05705f3b57cbb4aa1912b1e657ead44b3a588f635ad52c02878454c95a65fd64

See more details on using hashes here.

Provenance

The following attestation bundles were made for event_monitoring-0.1.0.tar.gz:

Publisher: publish-pypi.yml on omaraboumrad/event-monitoring

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file event_monitoring-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for event_monitoring-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ad299e0d4c8a17f0f793242cb8a2a7e136b15a9a66d628c236b9cc9f4d790db7
MD5 c242edc0e9c0febce522976c0b7def26
BLAKE2b-256 04537b6a948d3982cea7c3fc2667b9c421d7261c9857711304433c93e8021845

See more details on using hashes here.

Provenance

The following attestation bundles were made for event_monitoring-0.1.0-py3-none-any.whl:

Publisher: publish-pypi.yml on omaraboumrad/event-monitoring

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

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