Prometheus

Prometheus is a monitoring solution we use at Q2 for keeping track of the stats that matter most to a running service.

https://prometheus.io/

There are a few gotchas in working with Prometheus that we’ve attempted to abstract away with this module. To use it will be something like this:

prometheus.get_metric(
    MetricType.Counter,
    'caliper_endpoints',
    'Number of times called',
    labels={'endpoint': self.extension_name}
).inc()
class q2_sdk.core.prometheus.MetricType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Available metric types according to Prometheus

q2_sdk.core.prometheus.get_metric(metric_type, name, documentation, labels, namespace='', subsystem='', unit='', registry=<prometheus_client.registry.CollectorRegistry object>, chain=None, is_parent=False, **kwargs)[source]

Will return an instance of metric_type with given parameters as inputs, but will return an existing one if it already exists, creating a new one only if it’s the first time that metric combination has been seen.

Any key/value pairs in kwargs will be passed through to the underlying MetricType in prometheus_client.metrics (such as buckets for Histogram)

Return type:

MetricWrapperBase