The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Monitor::MetricsAPI::Metric - Base class for Monitor::MetricsAPI metrics.

SYNOPSIS

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.

DESCRIPTION

METRIC TYPES

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).

BASE METHODS

The following methods are provided for all types of metrics. Additional methods may be provided by individual metric types.

value

Returns the current value of the metric.

set ($value)

Updates the current value of the metric to $value. Individual metric types may perform validation on the value.

AUTHORS

Jon Sime <jonsime@gmail.com>

LICENSE AND COPYRIGHT

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.