blib/lib/Net/Prometheus/Types.pm

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