opt_prometheus

The opt_prometheus module contains no-op implementations of prometheus’s Counter, Gauge, Summary, Histogram, Info and Enum, as well as a helper method for timing async methods. It’s useful for creating metrics unconditionally without a hard dependency on prometheus_client.

is_installed

A boolean indicating whether prometheus_client was successfully imported.

Type

bool

Canonical

mautrix.util.opt_prometheus.is_installed

@async_time(metric)

Measure the time that each execution of the decorated async function takes.

This is equivalent to the time method-decorator in the metrics, but supports async functions.

Parameters

metric (Gauge/Summary/Histogram) – The metric instance to store the measures in.

Canonical

mautrix.util.opt_prometheus.async_time