File Coverage

blib/lib/Monitor/MetricsAPI/Metric/Gauge.pm
Criterion Covered Total %
statement 14 14 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 0 1 0.0
total 19 20 95.0


line stmt bran cond sub pod time code
1 13     13   85 use strict;
  13         24  
  13         549  
2 13     13   70 use warnings;
  13         24  
  13         1057  
3              
4             package Monitor::MetricsAPI::Metric::Gauge;
5             $Monitor::MetricsAPI::Metric::Gauge::VERSION = '0.900';
6 13     13   79 use namespace::autoclean;
  13         19  
  13         112  
7 13     13   1009 use Moose;
  13         24  
  13         95  
8              
9             extends 'Monitor::MetricsAPI::Metric';
10              
11             =head1 NAME
12              
13             Monitor::MetricsAPI::Metric::Gauge - Gauge metric class for Monitor::MetricsAPI
14              
15             =head1 SYNOPSIS
16              
17             use Monitor::MetricsAPI;
18              
19             my $collector = Monitor::MetricsAPI->new(
20             metrics => { process => { threads => 'gauge' } }
21             );
22              
23             # Later on, when your application modifies its worker thread pool:
24             $collector->metric('process/threads')->set(4);
25              
26             =head1 DESCRIPTION
27              
28             Gauge counters are numeric metrics providing an arbitrary point-in-time value.
29             Gauges may increase and decrease, and may do either by varying amounts each
30             time. They are useful for tracking things like current memory usage, number of
31             child threads or processes, temperature of a sensor, and any other arbitrary
32             values of interest.
33              
34             All gauges are initialized at zero, but may be set to any numeric value even
35             negative values.
36              
37             =cut
38              
39             sub BUILD {
40 2     2 0 4 my ($self) = @_;
41              
42 2         166 $self->_set_value(0);
43             }
44              
45             =head1 METHODS
46              
47             Gauge metrics do not provide any additional methods beyond the base methods
48             offered by L<Monitor::MetricsAPI::Metric>.
49              
50             =head1 AUTHORS
51              
52             Jon Sime <jonsime@gmail.com>
53              
54             =head1 LICENSE AND COPYRIGHT
55              
56             This software is copyright (c) 2015 by OmniTI Computer Consulting, Inc.
57              
58             This module is free software; you can redistribute it and/or
59             modify it under the same terms as Perl itself. See L<perlartistic>.
60              
61             This program is distributed in the hope that it will be useful,
62             but WITHOUT ANY WARRANTY; without even the implied warranty of
63             MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
64              
65             =cut
66              
67             __PACKAGE__->meta->make_immutable;
68             1;