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

Method register

prometheus_client/registry.py:37–50  ·  view source on GitHub ↗

Add a collector to the registry.

(self, collector: Collector)

Source from the content-addressed store, hash-verified

35 self.set_target_info(target_info)
36
37 def register(self, collector: Collector) -> None:
38 """Add a collector to the registry."""
39 with self._lock:
40 names = self._get_names(collector)
41 duplicates = set(self._names_to_collectors).intersection(names)
42 if duplicates:
43 raise ValueError(
44 'Duplicated timeseries in CollectorRegistry: {}'.format(
45 duplicates))
46 for name in names:
47 self._names_to_collectors[name] = collector
48 self._collector_to_names[collector] = names
49 if self._support_collectors_without_names and not names:
50 self._collectors_without_names.append(collector)
51
52 def unregister(self, collector: Collector) -> None:
53 """Remove a collector from the registry."""

Callers 15

test_roundtripMethod · 0.95
test_roundtripMethod · 0.95
simple_client.pyFile · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
custom_collectorMethod · 0.45

Calls 1

_get_namesMethod · 0.95