The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

NAME

Net::Prometheus::Summary - summarise individual numeric observations

SYNOPSIS

use Time::HiRes qw( time );
my $client = Net::Prometheus->new;
my $summary = $client->new_summary(
name => "request_seconds",
help => "Summary request processing time",
);
sub handle_request
{
my $start = time();
...
$summary->observe( time() - $start );
}

DESCRIPTION

This class provides a summary metric - a combination of a running total and a counter, that can be used to report on total and average values of observations, usually times. It is a subclass of Net::Prometheus::Metric.

CONSTRUCTOR

Instances of this class are not usually constructed directly, but instead via the Net::Prometheus object that will serve it:

$summary = $prometheus->new_summary( %args )

This takes the same constructor arguments as documented in Net::Prometheus::Metric.

observe

$summary->observe( @label_values, $value )
$summary->observe( \%labels, $value )
$child->observe( $value )

Increment the summary sum by the given value, and the count by 1.

AUTHOR

Paul Evans <leonerd@leonerd.org.uk>