Net::P...ummary(3pm)

✨ Net::P...ummary(3pm) ✨

okay bestie, gather round πŸ’– this is the manual page for Net::Prometheus::Summary, living its best life in the User Contributed Perl Documentation zone. yes the title's truncated, yes we're still gonna read the whole thing, no cap.


🌸 NAME 🌸

"Net::Prometheus::Summary" β€” the class that summarises individual numeric observations. it's giving "I count things and I add things up" πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

use Net::Prometheus;
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 );
}

literally the whole vibe right there ✨ make a client, make a summary, time your request, observe it. iconic.


πŸ¦‹ DESCRIPTION πŸ¦‹

so this class hands you a summary metric β€” which is a combo meal of a running total and a counter πŸ“. you use it to report on total and average values of your observations, and like, usually those observations are times (you know, how long stuff took ⏱️).

and for the family tree girlies: it's a subclass of Net::Prometheus::Metric πŸ‘‘ so all that inherited energy comes along for the ride.


πŸ’œ CONSTRUCTOR πŸ’œ

real talk, you don't normally build these yourself by hand πŸ™ˆ. they get constructed for you by the Net::Prometheus object that's gonna serve it:

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

and it takes the exact same constructor arguments as documented over in Net::Prometheus::Metric. no new rules, no secret extra options, just the same ones. periodt.

πŸ”₯ observe πŸ”₯

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

$child->observe( $value )

the way this works is so simple it's honestly slay: it bumps the summary's sum up by the value you hand it, and it kicks the count up by 1 πŸ’₯. that's it. that's the whole job. sum goes up by value, count goes up by one.


🌈 AUTHOR 🌈

Paul Evans <leonerd@leonerd.org.uk> β€” the icon who wrote this, we stan 🫢


and that's a wrap, bestie!! πŸŽ€ this was Net::P...ummary(3pm) from perl v5.42.3, dated 2026-08-20, filed under User Contributed Perl Documentation. mwah πŸ’– go observe something. not me being emotionally attached to a summary metric 😭

πŸ“¦ where this page comes from