1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
|
# 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-2024 -- leonerd@leonerd.org.uk
package Net::Prometheus::Types 0.14;
use v5.14;
use warnings;
use Exporter 'import';
our @EXPORT_OK;
use Struct::Dumb qw( readonly_struct );
=head1 NAME
C<Net::Prometheus::Types> - a collection of support structure types
=head1 SYNOPSIS
=for highlighter language=perl
use Net::Prometheus::Types qw( Sample );
my $ob = Sample( variable => [], 123 );
print "The sample relates to a variable called ", $ob->varname;
=head1 DESCRIPTION
This package contains some simple support structures that assist with other
parts of the L<Net::Prometheus> distribution.
Each type is exported as a constructor function.
=cut
=head1 TYPES
=cut
=head2 Sample
This structure represents an individual value sample; associating a numerical
value with a named variable and set of label values.
$sample = Sample( $varname, $labels, $value )
=head3 varname
$varname = $sample->varname
The string variable name. This is the basic name, undecorated by label values.
=head3 labels
$labels = $sample->labels
A reference to an even-sized ARRAY containing name/value pairs for the labels.
Label values should be raw unescaped strings.
=head3 value
$sample->value
The numerical value observed.
=cut
push @EXPORT_OK, qw( Sample );
readonly_struct Sample => [qw( varname labels value )];
=head2 MetricSamples
This structure represents all the samples made about a given metric, including
metadata about the metric itself.
$samples = MetricSamples( $fullname, $type, $help, $samples )
=head3 fullname
A string giving the fullname of the metric.
=head3 type
A string, one of C<'gauge'>, C<'counter'>, C<'summary'> or C<'histogram'>.
=head3 help
A string containing the descriptive help message text.
=head3 samples
A reference to an ARRAY containing individual L</Sample> instances.
=cut
push @EXPORT_OK, qw( MetricSamples );
readonly_struct MetricSamples => [qw( fullname type help samples )];
=head1 AUTHOR
Paul Evans <leonerd@leonerd.org.uk>
=cut
0x55AA;
|