| Net::Prometheus::Counter(3pm) | User Contributed Perl Documentation | Net::Prometheus::Counter(3pm) |
"Net::Prometheus::Counter" - a monotonically-increasing counter metric
use Net::Prometheus;
my $client = Net::Prometheus->new;
my $counter = $client->new_counter(
name => "requests",
help => "Number of received requests",
);
sub handle_request
{
$counter->inc;
...
}
This class provides a counter metric - a value that monotonically increases, usually used to represent occurrences of some event that happens within the instrumented program. It is a subclass of Net::Prometheus::Metric.
Instances of this class are not usually constructed directly, but instead via the Net::Prometheus object that will serve it:
$counter = $prometheus->new_counter( %args )
This takes the same constructor arguments as documented in Net::Prometheus::Metric.
$counter->inc( @label_values, $delta ) $counter->inc( \%labels, $delta ) $child->inc( $delta )
Increment the current value for the gauge. $delta will default to 1 if not supplied and must be non-negative.
Paul Evans <leonerd@leonerd.org.uk>
| 2024-03-31 | perl v5.38.2 |