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

Method collect

prometheus_client/registry.py:88–99  ·  view source on GitHub ↗

Yields metrics from the collectors in the registry.

(self)

Source from the content-addressed store, hash-verified

86 return result
87
88 def collect(self) -> Iterable[Metric]:
89 """Yields metrics from the collectors in the registry."""
90 collectors = None
91 ti = None
92 with self._lock:
93 collectors = copy.copy(self._collector_to_names)
94 if self._target_info:
95 ti = self._target_info_metric()
96 if ti:
97 yield ti
98 for collector in collectors:
99 yield from collector.collect()
100
101 def restricted_registry(self, names: Iterable[str]) -> "RestrictedRegistry":
102 """Returns object that only collects some metrics.

Callers 1

get_sample_valueMethod · 0.95

Calls 2

_target_info_metricMethod · 0.95
collectMethod · 0.45

Tested by

no test coverage detected