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

Method collect

prometheus_client/registry.py:152–167  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

150 self._registry = registry
151
152 def collect(self) -> Iterable[Metric]:
153 collectors = set(self._registry._collectors_without_names)
154 target_info_metric = None
155 with self._registry._lock:
156 if 'target_info' in self._name_set and self._registry._target_info:
157 target_info_metric = self._registry._target_info_metric()
158 for name in self._name_set:
159 if name != 'target_info' and name in self._registry._names_to_collectors:
160 collectors.add(self._registry._names_to_collectors[name])
161 if target_info_metric:
162 yield target_info_metric
163 for collector in collectors:
164 for metric in collector.collect():
165 m = metric._restricted_metric(self._name_set)
166 if m:
167 yield m
168
169
170REGISTRY = CollectorRegistry(auto_describe=True)

Callers

nothing calls this directly

Calls 4

_target_info_metricMethod · 0.80
_restricted_metricMethod · 0.80
addMethod · 0.45
collectMethod · 0.45

Tested by

no test coverage detected