MCPcopy Index your code
hub / github.com/prometheus/client_python / _metric_init

Method _metric_init

prometheus_client/metrics.py:650–663  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

648 self._upper_bounds = buckets
649
650 def _metric_init(self) -> None:
651 self._buckets: List[values.ValueClass] = []
652 self._created = time.time()
653 bucket_labelnames = self._labelnames + ('le',)
654 self._sum = values.ValueClass(self._type, self._name, self._name + '_sum', self._labelnames, self._labelvalues, self._documentation)
655 for b in self._upper_bounds:
656 self._buckets.append(values.ValueClass(
657 self._type,
658 self._name,
659 self._name + '_bucket',
660 bucket_labelnames,
661 self._labelvalues + (floatToGoString(b),),
662 self._documentation)
663 )
664
665 def observe(self, amount: float, exemplar: Optional[Dict[str, str]] = None) -> None:
666 """Observe the given amount.

Callers

nothing calls this directly

Calls 2

floatToGoStringFunction · 0.85
timeMethod · 0.45

Tested by

no test coverage detected