prometheus_registry (prometheus v6.0.1)
View SourceA registry of Collectors.
The majority of users should use the default
, rather than their own.
Creating a registry other than the default is primarily useful for unit tests, or pushing a subset of metrics to the Pushgateway from batch jobs.
Summary
Functions
Equivalent to clear(default)
.
Unregisters all collectors.
Calls Callback
for each collector with two arguments: Registry
and Collector
.
Checks whether Collector
is registered.
Returns collectors registered in Registry
.
Unregisters a collector.
Tries to find registry with the Name
.
Register a collector.
Registers collectors list.
Types
-type collect_callback() :: fun((registry(), prometheus_collector:collector()) -> dynamic()).
-type registry() :: atom().
Functions
-spec clear() -> ok.
Equivalent to clear(default)
.
-spec clear(Registry :: prometheus_registry:registry()) -> ok.
Unregisters all collectors.
-spec collect(Registry, Callback) -> ok when Registry :: prometheus_registry:registry(), Callback :: collect_callback().
Calls Callback
for each collector with two arguments: Registry
and Collector
.
-spec collector_registeredp(Collector) -> boolean() when Collector :: prometheus_collector:collector().
Equivalent to collector_registeredp(default, Collector)
.
-spec collector_registeredp(Registry, Collector) -> boolean() when Registry :: prometheus_registry:registry(), Collector :: prometheus_collector:collector().
Checks whether Collector
is registered.
-spec collectors(Registry :: prometheus_registry:registry()) -> [Collector :: prometheus_collector:collector()].
Returns collectors registered in Registry
.
-spec deregister_collector(Collector :: prometheus_collector:collector()) -> ok.
Equivalent to deregister_collector(default, Collector)
.
-spec deregister_collector(Registry, Collector) -> ok when Registry :: prometheus_registry:registry(), Collector :: prometheus_collector:collector().
Unregisters a collector.
Tries to find registry with the Name
.
Assumes that registry name is always an atom.
- If
Name
is an atomets:lookup/2
is used - If
Name
is an iolist performs safe search (to avoid interning atoms) and returns atom or false.
This operation is O(n).
-spec register_collector(Collector :: prometheus_collector:collector()) -> ok.
Equivalent to register_collector(default, Collector)
.
-spec register_collector(Registry, Collector) -> ok when Registry :: prometheus_registry:registry(), Collector :: prometheus_collector:collector().
Register a collector.
-spec register_collectors(Collectors :: [prometheus_collector:collector()]) -> ok.
Equivalent to register_collectors(default, Collectors)
.
-spec register_collectors(Registry, Collectors) -> ok when Registry :: prometheus_registry:registry(), Collectors :: [prometheus_collector:collector()].
Registers collectors list.