---
name: "Net::Prometheus::Summary"
section: "3pm"
platform: "linux"
package: "libnet-prometheus-perl"
version: "0.14-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Net::Prometheus::Summary"
---

# Net::Prometheus::Summary(3pm)

summarise individual numeric observations

## NAME

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

## 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 );
   }
```

## 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\>
