The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Net::Prometheus::Registry - a collection of metrics collectors

DESCRIPTION

This class, or instances of it, acts as a simple storage array for instances derived from Net::Prometheus::Metric, known as "collectors".

A single global collection is stored by the module, accessible via the class methods. Additional collections may be made with the constructor and then accessed by instance methods.

CONSTRUCTOR

new

$registry = Net::Prometheus::Registry->new;

Returns a new registry instance.

METHODS

register

$collector = Net::Prometheus::Registry->register( $collector );
$collector = $registry->register( $collector );

Adds a new collector to the registry. The collector instance itself is returned, for convenience of chaining method calls on it.

unregister

Net::Prometheus::Registry->unregister( $collector );
$registry->unregister( $collector );

Removes a previously-registered collector.

collectors

@collectors = Net::Prometheus::Registry->collectors;
@collectors = $registry->collectors;

Returns a list of the currently-registered collectors.

AUTHOR

Paul Evans <leonerd@leonerd.org.uk>