Non-blocking business-event emitter that publishes to a Redis Stream for a monitoring dashboard
Project description
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_ENABLEDis 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":{}}
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4553c69a07e75a3e661589011d9e0adb978cb9fd7ed569a07eab6596790c5b5c
|
|
| MD5 |
e396fbeabb6b28f885f8b411c72ea8c2
|
|
| BLAKE2b-256 |
05705f3b57cbb4aa1912b1e657ead44b3a588f635ad52c02878454c95a65fd64
|
Provenance
The following attestation bundles were made for event_monitoring-0.1.0.tar.gz:
Publisher:
publish-pypi.yml on omaraboumrad/event-monitoring
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
event_monitoring-0.1.0.tar.gz -
Subject digest:
4553c69a07e75a3e661589011d9e0adb978cb9fd7ed569a07eab6596790c5b5c - Sigstore transparency entry: 1803165062
- Sigstore integration time:
-
Permalink:
omaraboumrad/event-monitoring@1518ceabfea3e26076771746ef22350f3c795acd -
Branch / Tag:
refs/heads/main - Owner: https://github.com/omaraboumrad
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@1518ceabfea3e26076771746ef22350f3c795acd -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file event_monitoring-0.1.0-py3-none-any.whl.
File metadata
- Download URL: event_monitoring-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad299e0d4c8a17f0f793242cb8a2a7e136b15a9a66d628c236b9cc9f4d790db7
|
|
| MD5 |
c242edc0e9c0febce522976c0b7def26
|
|
| BLAKE2b-256 |
04537b6a948d3982cea7c3fc2667b9c421d7261c9857711304433c93e8021845
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
event_monitoring-0.1.0-py3-none-any.whl -
Subject digest:
ad299e0d4c8a17f0f793242cb8a2a7e136b15a9a66d628c236b9cc9f4d790db7 - Sigstore transparency entry: 1803165108
- Sigstore integration time:
-
Permalink:
omaraboumrad/event-monitoring@1518ceabfea3e26076771746ef22350f3c795acd -
Branch / Tag:
refs/heads/main - Owner: https://github.com/omaraboumrad
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@1518ceabfea3e26076771746ef22350f3c795acd -
Trigger Event:
workflow_dispatch
-
Statement type: