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

Method add_metric

prometheus_client/metrics_core.py:356–372  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

354 self.add_metric([], value)
355
356 def add_metric(self,
357 labels: Sequence[str],
358 value: Dict[str, str],
359 timestamp: Optional[Union[Timestamp, float]] = None,
360 ) -> None:
361 """Add a metric to the metric family.
362
363 Args:
364 labels: A list of label values
365 value: A dict of labels
366 """
367 self.samples.append(Sample(
368 self.name + '_info',
369 dict(dict(zip(self._labelnames, labels)), **value),
370 1,
371 timestamp,
372 ))
373
374
375class StateSetMetricFamily(Metric):

Callers 4

__init__Method · 0.95
test_info_labelsMethod · 0.95
collectMethod · 0.45
test_untyped_labelsMethod · 0.45

Calls 1

SampleClass · 0.85

Tested by 3

test_info_labelsMethod · 0.76
collectMethod · 0.36
test_untyped_labelsMethod · 0.36