summaryrefslogtreecommitdiff
path: root/src/MetricsInterface.php
blob: ec2009b0afc4f51adc082c180d94ed10bac0ef16 (plain)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php

/**
 * Spiral Framework.
 *
 * @license   MIT
 * @author    Anton Titov (Wolfy-J)
 */
declare(strict_types=1);

namespace Spiral\RoadRunner;

use Spiral\RoadRunner\Exception\MetricException;

interface MetricsInterface
{
    /**
     * Add collector value. Fallback to appropriate method of related collector.
     *
     * @param string  $collector
     * @param float   $value
     * @param mixed[] $labels
     *
     * @throws MetricException
     * @return void
     */
    public function add(string $collector, float $value, array $labels = []);

    /**
     * Subtract the collector value, only for gauge collector.
     *
     * @param string  $collector
     * @param float   $value
     * @param mixed[] $labels
     *
     * @throws MetricException
     * @return void
     */
    public function sub(string $collector, float $value, array $labels = []);

    /**
     * Observe collector value, only for histogram and summary collectors.
     *
     * @param string  $collector
     * @param float   $value
     * @param mixed[] $labels
     *
     * @throws MetricException
     * @return void
     */
    public function observe(string $collector, float $value, array $labels = []);

    /**
     * Set collector value, only for gauge collector.
     *
     * @param string  $collector
     * @param float   $value
     * @param mixed[] $labels
     *
     * @throws MetricException
     * @return void
     */
    public function set(string $collector, float $value, array $labels = []);
}