Monitoring and metrics for SGN streaming pipelines
Project description
sgnmon
Monitoring and metrics for SGN streaming pipelines
Observe SGN pipelines from the outside: collect Prometheus metrics (gap/non-gap content, latencies, throughput, end-of-stream state) from running pipelines, serve them over HTTP, and evaluate pipeline health checks suitable for container orchestration and monitoring plugins.
Resources
Installation
pip install sgnmon
Features
- Non-invasive taps -- attach probes to any existing pipeline's pads without modifying the graph, at three observation points per element (frames produced, frames received, and post-audioadapter consumption) so latency can be attributed per element
- Monitoring elements -- a pass-through
MonitorTransformand terminalMonitorSinkfor explicit in-graph instrumentation - Prometheus metrics -- frame counts, gap/data seconds, sample throughput, latency histograms, per-pad execution time, freshness timestamps, EOS state, and opt-in process CPU/memory metrics
- Custom metrics -- declare application metrics on your own elements
(
MetricSpec/MetricsMixin) or create families directly on the monitor; anEventLatencyelement measures per-event latency for event streams - Windowed statistics -- rates, gap fractions, and latencies aggregated natively over a 5s...6h trailing-window ladder, for sub-minute resolution and consumers without PromQL
- Health checks -- a configuration-free default set (data freshness, throughput, latency drift) that self-paces its startup, plus opt-in absolute-latency, gap-fraction, and end-of-stream checks, aggregated into a JSON report
- Built-in webserver --
/metrics,/health(HTTP 503 when unhealthy),/status,/graph, and live updates over server-sent events, served from a background thread - Live dashboard -- a self-contained web page drawing the pipeline graph with live per-element rates, latencies, gap fractions, and health state; composed elements expand in place to show their internal elements
- CLI --
sgnmon run -- <app> ...attaches monitoring to any sgn application with zero code changes;sgnmon demoruns a monitored example pipeline;sgnmon check <url>queries a running pipeline's health with plugin-friendly exit codes
Quickstart
Monitor any sgn application, zero code changes
$ sgnmon run --port 9090 -- sgn-cal --config config.yaml --model model.npz
[sgnmon] dashboard: http://localhost:9090/
Tap an existing pipeline
from sgnmon import Monitor, MonitorServer
monitor = Monitor()
monitor.tap(pipeline) # observe every pad, no graph changes
with MonitorServer(monitor, host="0.0.0.0", port=9090):
pipeline.run()
Default health checks (data freshness, throughput, latency drift) are
registered out of the box; tune or extend them with
monitor.add_default_checks(...). Then point Prometheus at
http://<host>:9090/metrics, or check health by hand:
$ sgnmon check http://localhost:9090
Instrument with elements
from sgnmon import Monitor, MonitorTransform
monitor = Monitor()
mon = MonitorTransform(name="mon", sink_pad_names=["H1"], monitor=monitor)
pipeline.insert(src, mon, snk)
pipeline.link({
"mon:snk:H1": "src:src:H1",
"snk:snk:H1": "mon:src:H1",
})
Try the demo
$ sgnmon demo --port 9090
dashboard: http://localhost:9090/
metrics: http://localhost:9090/metrics
health: http://localhost:9090/health
status: http://localhost:9090/status
Open the dashboard in a browser to watch the pipeline graph update live.
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 sgnmon-0.1.0.tar.gz.
File metadata
- Download URL: sgnmon-0.1.0.tar.gz
- Upload date:
- Size: 99.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.16.5 cpython/3.13.12 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5245973af5eaa8c06c807f07927aab844cb56f9b907f4a5b9bbd785c4d41c6d7
|
|
| MD5 |
e8717af81157dd334caeecd28d8b895c
|
|
| BLAKE2b-256 |
2b94ce870a402208af84c61ae9d72100fc740f91cc9839f50ef444ca2600fed3
|
File details
Details for the file sgnmon-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sgnmon-0.1.0-py3-none-any.whl
- Upload date:
- Size: 81.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.16.5 cpython/3.13.12 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6aa1afce7b1df743230191fc8380a68c587a89a61078a3fc2176f387ac391d3c
|
|
| MD5 |
bc7cd9dbdf1425f32e0e293e983acde3
|
|
| BLAKE2b-256 |
41c545120761358288c04ceecc08dd3b45572111d7dad69bd1a0a4dd470cac2c
|