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

Class Info

prometheus_client/metrics.py:706–741  ·  view source on GitHub ↗

Info metric, key-value pairs. Examples of Info include: - Build information - Version information - Potential target metadata Example usage: from prometheus_client import Info i = Info('my_build', 'Description of info') i.info({'version':

Source from the content-addressed store, hash-verified

704
705
706class Info(MetricWrapperBase):
707 """Info metric, key-value pairs.
708
709 Examples of Info include:
710 - Build information
711 - Version information
712 - Potential target metadata
713
714 Example usage:
715 from prometheus_client import Info
716
717 i = Info('my_build', 'Description of info')
718 i.info({'version': '1.2.3', 'buildhost': 'foo@bar'})
719
720 Info metrics do not work in multiprocess mode.
721 """
722 _type = 'info'
723
724 def _metric_init(self):
725 self._labelname_set = set(self._labelnames)
726 self._lock = Lock()
727 self._value = {}
728
729 def info(self, val: Dict[str, str]) -> None:
730 """Set info metric."""
731 if self._labelname_set.intersection(val.keys()):
732 raise ValueError('Overlapping labels for Info metric, metric: {} child: {}'.format(
733 self._labelnames, val))
734 if any(i is None for i in val.values()):
735 raise ValueError('Label value cannot be None')
736 with self._lock:
737 self._value = dict(val)
738
739 def _child_samples(self) -> Iterable[Sample]:
740 with self._lock:
741 return (Sample('_info', self._value, 1.0, None, None),)
742
743
744class Enum(MetricWrapperBase):

Callers 5

test_infoMethod · 0.90
test_infoMethod · 0.90
setUpMethod · 0.85

Calls

no outgoing calls

Tested by 5

test_infoMethod · 0.72
test_infoMethod · 0.72
setUpMethod · 0.68