Skip to content

Latest commit

 

History

History
212 lines (128 loc) · 8.14 KB

prometheus_registry.md

File metadata and controls

212 lines (128 loc) · 8.14 KB

Module prometheus_registry

A registry of Collectors.

Description

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.

Data Types


collect_callback() = fun((registry(), prometheus_collector:collector()) -> any())

registry() = atom()

Function Index

clear/0Equivalent to clear(default).
clear/1Unregisters all collectors.
collect/2 Calls Callback for each collector with two arguments: Registry and Collector.
collector_registeredp/1Equivalent to collector_registeredp(default, Collector).
collector_registeredp/2Checks whether Collector is registered.
collectors/1 Returns collectors registered in Registry.
deregister_collector/1Equivalent to deregister_collector(default, Collector).
deregister_collector/2Unregisters a collector.
exists/1 Tries to find registry with the Name.
register_collector/1Equivalent to register_collector(default, Collector).
register_collector/2Register a collector.
register_collectors/1Equivalent to register_collectors(default, Collectors).
register_collectors/2Registers collectors list.

Function Details

clear/0


clear() -> ok

Equivalent to clear(default).

clear/1


clear(Registry::prometheus_registry:registry()) -> ok

Unregisters all collectors.

collect/2


collect(Registry, Callback) -> ok

Calls Callback for each collector with two arguments: Registry and Collector.

collector_registeredp/1


collector_registeredp(Collector) -> boolean()

Equivalent to collector_registeredp(default, Collector).

collector_registeredp/2


collector_registeredp(Registry, Collector) -> boolean()

Checks whether Collector is registered.

collectors/1


Returns collectors registered in Registry.

deregister_collector/1


deregister_collector(Collector::prometheus_collector:collector()) -> ok

Equivalent to deregister_collector(default, Collector).

deregister_collector/2


deregister_collector(Registry::prometheus_registry:registry(), Collector::prometheus_collector:collector()) -> ok

Unregisters a collector.

exists/1


exists(Name) -> Result
  • Name = atom() | iolist()
  • Result = boolean() | atom()

Tries to find registry with the Name. Assumes that registry name is always an atom. If Name is an atom ets: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).

register_collector/1


register_collector(Collector::prometheus_collector:collector()) -> ok

Equivalent to register_collector(default, Collector).

register_collector/2


register_collector(Registry::prometheus_registry:registry(), Collector::prometheus_collector:collector()) -> ok

Register a collector.

register_collectors/1


register_collectors(Collectors::[prometheus_collector:collector()]) -> ok

Equivalent to register_collectors(default, Collectors).

register_collectors/2


register_collectors(Registry::prometheus_registry:registry(), Collectors::[prometheus_collector:collector()]) -> ok

Registers collectors list.