MCPcopy Create free account
hub / github.com/prometheus/client_python / add_metric

Method add_metric

prometheus_client/metrics_core.py:170–177  ·  view source on GitHub ↗

Add a metric to the metric family. Args: labels: A list of label values value: A float

(self, labels: Sequence[str], value: float, timestamp: Optional[Union[Timestamp, float]] = None)

Source from the content-addressed store, hash-verified

168 self.add_metric([], value)
169
170 def add_metric(self, labels: Sequence[str], value: float, timestamp: Optional[Union[Timestamp, float]] = None) -> None:
171 """Add a metric to the metric family.
172
173 Args:
174 labels: A list of label values
175 value: A float
176 """
177 self.samples.append(Sample(self.name, dict(zip(self._labelnames, labels)), value, timestamp))
178
179
180class SummaryMetricFamily(Metric):

Callers 5

collectMethod · 0.95
_add_metricMethod · 0.95
__init__Method · 0.95
test_gauge_labelsMethod · 0.95

Calls 1

SampleClass · 0.85

Tested by 2

test_gauge_labelsMethod · 0.76