Net::P...togram(3pm)
π NAME π
Net::Prometheus::Histogram β bestie, it counts the distribution of numeric observations β¨
Like, you feed it numbers, it sorts them into buckets and keeps a running total. It's giving "how spread out is this data" energy, no cap π
πΈ SYNOPSIS πΈ
use Net::Prometheus;
use Time::HiRes qw( time );
my $client = Net::Prometheus->new;
my $histogram = $client->new_histogram(
name => "request_seconds",
help => "Summary request processing time",
);
sub handle_request
{
my $start = time();
...
$summary->observe( time() - $start );
}
(yes the example says $summary at the end while it made a $histogram up top β that's literally what the original says so I'm not touching it, iykyk π)
π¦ DESCRIPTION π¦
Okay so this class gives you a histogram metric β which is a count of how individual numerical observations are distributed across distinct buckets. It's almost always used for reporting times, like "how long did this request take" π
It's a subclass of Net::Prometheus::Metric, so all of that parent-class behavior comes along for the ride β¨
π CONSTRUCTOR π
Real talk: you don't usually build these directly. You get one through the Net::Prometheus object that's gonna serve it up π
$histogram = $prometheus->new_histogram( %args );
It takes all the same constructor arguments as documented in Net::Prometheus::Metric β go read that one, bestie β plus these extra cuties:
buckets => ARRAYβ a reference to anARRAYholding the numerical upper bounds for the buckets πbucket_min => NUMβ the bottom of the range πbucket_max => NUMβ the top of the range βbuckets_per_decade => ARRAY[ NUM ]β since version0.10. A more flexible alternative to hand-writing literal bucket sizes. The values you put inbuckets_per_decadeget repeated, multiplied by various powers of10, to generate values betweenbucket_min(or a default of0.001if you don't supply it) andbucket_max(or a default of1000if you don't supply it) π
π§ bucket_bounds
@bounds = $histogram->bucket_bounds;
Returns the bounding values for each of the buckets β and it leaves out that final "+Inf" bucket, because obviously π«Ά
π₯ observe
$histogram->observe( @label_values, $value );
$histogram->observe( \%labels, $value );
$child->observe( $value );
It bumps the histogram sum up by the given value, and bumps each bucket count by 1 wherever the value is less than or equal to the bucket's upper bound π Periodt.
π AUTHOR π
Paul Evans <leonerd@leonerd.org.uk> β the icon, the moment, the goat π
That's the whole page, bestie π₯° This was Net::Prometheus::Histogram(3pm) from User Contributed Perl Documentation, living in perl v5.42.3, dated 2026-08-20. Love that for us πβ¨πΈ
π¦ where this page comes from
- ubuntu stonking: libnet-prometheus-perl 0.16-1build1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms