snoozeml.metrics — Prometheus Metrics Parsing & Telemetry#
Structured Prometheus metrics parser for the SnoozeML inference daemon.
Parses the text exposition output of GET /metrics (src/server/metrics.rs)
into a typed DaemonMetrics object for programmatic monitoring, alerting,
and notebook telemetry.
- class snoozeml.metrics.DaemonMetrics(requests_total=0, requests_success=0, requests_error=0, inference_latency_seconds_total=0.0, batches_dispatched_total=0, oom_deallocations_total=0, idle_deallocations_total=0, capacity_deallocations_total=0, model_load_retries_total=0, deallocation_thrashing_total=0, stream_messages_consumed_total=0, stream_messages_published_total=0, stream_errors_total=0, raw_metrics=<factory>)[source]#
Bases:
objectStructured snapshot of SnoozeML operational counters parsed from
GET /metrics.- Parameters:
requests_total (int)
requests_success (int)
requests_error (int)
inference_latency_seconds_total (float)
batches_dispatched_total (int)
oom_deallocations_total (int)
idle_deallocations_total (int)
capacity_deallocations_total (int)
model_load_retries_total (int)
deallocation_thrashing_total (int)
stream_messages_consumed_total (int)
stream_messages_published_total (int)
stream_errors_total (int)
- raw_metrics#
Dictionary of all parsed metric keys (with normalized labels) to float values.
- property average_latency_ms: float#
Average server-side inference latency in milliseconds (
0.0if no requests recorded).
- property success_rate: float#
Fraction of successful inference requests in
[0.0, 1.0](1.0if no requests recorded).
- to_dict()[source]#
Serializes this
DaemonMetricssnapshot into a dictionary.
- classmethod from_prometheus(text)[source]#
Parses Prometheus exposition text from
GET /metricsinto aDaemonMetricsinstance.- Parameters:
text (str) – Raw Prometheus exposition string returned by the SnoozeML server.
- Returns:
Populated
DaemonMetricssnapshot.- Return type:
- snoozeml.metrics.parse_prometheus_metrics(text)[source]#
Convenience function that parses Prometheus exposition text into
DaemonMetrics.- Parameters:
text (str)
- Return type: