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

NAME

Monitor::MetricsAPI::Metric::Counter - Counter metric class for Monitor::MetricsAPI

SYNOPSIS

    use Monitor::MetricsAPI;

    my $collector = Monitor::MetricsAPI->new(
        metrics => { messages => { incoming => 'counter' } }
    );

    # Later on, when a new message is received by your app:
    $collector->metric('messages/incoming')->increment;

DESCRIPTION

Counter metrics are numeric values which initialize at zero and only increase over the lifetime of the monitored process. Counter metrics are appropriate when you simply want to know how many times X occurred.

METHODS

The following methods are specific to counter metrics. Monitor::MetricsAPI::Metric defines methods which are common to all metric types.

add ($amount)

Adds $amount to the current value of the metric.

increment

Increases the value of the metric by 1 each time it is called. Produces the same effect as calling $metric->add(1), which is unsurprising since that is exactly what this method does.

incr

Alias for increment()

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.