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::Counter - a monotonically-increasing counter metric

SYNOPSIS

   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;
      ...
   }

DESCRIPTION

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.

CONSTRUCTOR

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.

METHODS

inc

   $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.

AUTHOR

Paul Evans <leonerd@leonerd.org.uk>