Net-Prometheus
view release on metacpan or search on metacpan
lib/Net/Prometheus/Metric.pm view on Meta::CPAN
# You may distribute under the terms of either the GNU General Public License
# or the Artistic License (the same terms as Perl itself)
#
# (C) Paul Evans, 2016-2026 -- leonerd@leonerd.org.uk
package Net::Prometheus::Metric 0.16;
use v5.20;
use warnings;
use feature qw( postderef signatures );
no warnings qw( experimental::postderef experimental::signatures );
use Carp;
our @CARP_NOT = qw( Net::Prometheus );
use meta 0.009; # GvCVu bugfix
no warnings 'meta::experimental';
use Ref::Util qw( is_hashref );
use Net::Prometheus::Types qw( Sample MetricSamples );
use constant CHILDCLASS => "Net::Prometheus::Metric::_Child";
=head1 NAME
C<Net::Prometheus::Metric> - the base class for observed metrics
=head1 DESCRIPTION
=for highlighter language=perl
This class provides the basic methods shared by the concrete subclasses,
=over 2
=item *
L<Net::Prometheus::Gauge> - a snapshot value-reporting metric
=item *
L<Net::Prometheus::Counter> - a monotonically-increasing counter metric
=item *
L<Net::Prometheus::Summary> - summarise individual numeric observations
=item *
L<Net::Prometheus::Histogram> - count the distribution of numeric observations
=back
=cut
=head1 CONSTRUCTOR
=cut
=head2 new
$metric = Net::Prometheus::Metric->new(
name => $name,
help => $help,
);
The constructor is not normally used directly by instrumented code. Instead it
is more common to use one of the C<new_*> methods on the containing
L<Net::Prometheus> client instance so that the new metric is automatically
registered as a collector, and gets exported by the render method.
$metric = $prometheus->new_counter(
name => $name,
help => $help,
);
In either case, it returns a newly-constructed metric.
( run in 1.860 second using v1.01-cache-2.11-cpan-140bd7fdf52 )