Monitor::MetricsAPI::Metric - Base class for Monitor::MetricsAPI metrics.
You should not interact with this module directly in your code. Please refer to Monitor::MetricsAPI for how to integrate this service with your application.
Several different types of metrics are offered, to allow for tracking many unique and varying bits of information in your applications. Each metric type behaves slightly different, permits its own limited range of values, and exposes its own set of methods for manipulating the metric value.
It is important that you choose the proper type of metric for whatever it is you are attempting to track. Using a boolean metric, for instance, to monitor your memory usage is utter nonsense, as is using a string metric for your API requests counter.
string
The simplest of metric types. Any arbitrary string value may be stored in the metric and it will be echoed back in reporting output. Application names, version numbers, build numbers, and so on make sense for String metrics.
boolean
Boolean metrics allow you to monitor the true/false/unknown state of something.
counter
gauge
timestamp
Timestamp metrics allow you to update a timestamp when a particular event occurs. Useful for ensuring that it hasn't been too long since an expected event has been triggered.
callback
Callback metrics allow you to supply a subroutine to invoke any time the metric is included in reporting output. Useful when the metric requires additional computation (e.g. avg-events-over-time), or the use of an external resource such as a database (e.g. total registered users).
The following methods are provided for all types of metrics. Additional methods may be provided by individual metric types.
Returns the current value of the metric.
Updates the current value of the metric to $value. Individual metric types may perform validation on the value.
Jon Sime <jonsime@gmail.com>
This software is copyright (c) 2015 by OmniTI Computer Consulting, Inc.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
To install Monitor::MetricsAPI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Monitor::MetricsAPI
CPAN shell
perl -MCPAN -e shell install Monitor::MetricsAPI
For more information on module installation, please visit the detailed CPAN module installation guide.