line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
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 -- leonerd@leonerd.org.uk |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Net::Prometheus::Types; |
7
|
|
|
|
|
|
|
|
8
|
17
|
|
|
17
|
|
115
|
use strict; |
|
17
|
|
|
|
|
34
|
|
|
17
|
|
|
|
|
482
|
|
9
|
17
|
|
|
17
|
|
83
|
use warnings; |
|
17
|
|
|
|
|
31
|
|
|
17
|
|
|
|
|
804
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.11'; |
12
|
|
|
|
|
|
|
|
13
|
17
|
|
|
17
|
|
106
|
use Exporter 'import'; |
|
17
|
|
|
|
|
40
|
|
|
17
|
|
|
|
|
858
|
|
14
|
|
|
|
|
|
|
our @EXPORT_OK; |
15
|
|
|
|
|
|
|
|
16
|
17
|
|
|
17
|
|
8497
|
use Struct::Dumb qw( readonly_struct ); |
|
17
|
|
|
|
|
36684
|
|
|
17
|
|
|
|
|
86
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 NAME |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
C - a collection of support structure types |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 SYNOPSIS |
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 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
|
|
|
|
|
|
|
push @EXPORT_OK, qw( Sample ); |
72
|
|
|
|
|
|
|
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 instances. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=cut |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
push @EXPORT_OK, qw( MetricSamples ); |
100
|
|
|
|
|
|
|
readonly_struct MetricSamples => [qw( fullname type help samples )]; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 AUTHOR |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Paul Evans |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=cut |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
0x55AA; |