dm_mac.views.prometheus module

Views related to machine endpoints.

class dm_mac.views.prometheus.LabeledGaugeMetricFamily(name: str, documentation: str, value: float | None = None, labels: Dict[str, str] | None = None, unit: str = '')

Bases: Metric

Not sure why the upstream one doesn’t allow labels…

add_metric(labels: Dict[str, str], value: float) None

Add a metric to the metric family.

Args:

labels: A dictionary of labels value: A float

class dm_mac.views.prometheus.PromCustomCollector

Bases: object

Custom collector for metrics.

collect() Generator[LabeledGaugeMetricFamily, None, None]

Collect custom metrics.

async dm_mac.views.prometheus.prometheus_route() Response

API method to return Prometheus-compatible metrics.