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

NAME

Monitor::MetricsAPI::MetricFactory - Factory for creating Metric::* objects.

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

This module provides a factory pattern for creating individual metric objects. The intent is for Monitor::MetricsAPI::Collector to use this when building the collector, as well as any time new metrics are added to an existing collector.

METHODS

create (%options)

Accepts a hash of options describing a metric, and returns the appropriate type of metric object. Valid entries in the options hash are:

  • name

    A string containing the full name (including all parent groups) for the metric. As detailed in Monitor::MetricsAPI::Tutorial, full metric names are slash-delimited strings of the form "<group>/<subgroup>/<metric>" and there may be as many or as few subgroups as you choose.

    Example:

        process/workers/current_threads
  • type

    A string naming the type of metric to be created. This will match the last component of the metric class's name, in lowercase. Thus, a metric of the class Monitor::MetricsAPI::Metric::Boolean would have a type of "boolean".

  • callback

    A subroutine to be invoked every time the metric is included in API output, or when the metric's value() method is called. Relevant only for metrics of type 'callback'.

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.