NAME

GrwothForecast::Aggregator::Callback - Aggregate by callback

SYNOPSIS

my $aggregator = GrowthForecast::Aggregator::Callback->new(
    service => 'blog',
    section => 'entry',
    name    => 'count',
    code => sub {
        ...
        return $n; # return the metrics value
    },
);
my $res = $aggregator->run(...);

DESCRIPTION

This aggregator aggregates data from RDBMS, and post it to GrowthForecast.

CONSTRUCTOR ARGUMENTS

section: Str, required

Section name.

This module send request to "/api/$service/$section/$name"

name : Str, required

Name of the metrics.

This module send request to "/api/$service/$section/$name"

description: Str, required

Description of the query. The module post it as 'description' parameter.

code : CodeRef, required

Callback function to return metrics value.

ARGUMENTS FOR 'run' METHOD

service

Service name.

This module send request to "/api/$service/$section/$name"

endpoint

Endpoint URL, contains '/api'.

E.g. http://example.com/api/

ua

Instance of HTTP client. I tested on Furl.