1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
#!perl
use warnings;
use strict;
use Test::More;
use Prometheus::Tiny;
{
my $p = Prometheus::Tiny->new;
$p->add('some_metric', 5, { some_label => 'aaa' });
is $p->format, <<EOF, 'single metric with label adds correctly';
some_metric{some_label="aaa"} 5
EOF
}
{
my $p = Prometheus::Tiny->new;
$p->inc('some_metric', { some_label => "aaa" });
is $p->format, <<EOF, 'single metric with label increments correctly';
some_metric{some_label="aaa"} 1
EOF
}
{
my $p = Prometheus::Tiny->new;
$p->dec('some_metric', { some_label => "aaa" });
is $p->format, <<EOF, 'single metric with label decrements correctly';
some_metric{some_label="aaa"} -1
EOF
}
done_testing;
|