1 | <?php |
||
19 | final class Metrics |
||
20 | { |
||
21 | /** @var RPC */ |
||
22 | private $rpc; |
||
23 | |||
24 | /** |
||
25 | * @param RPC $rpc |
||
26 | */ |
||
27 | public function __construct(RPC $rpc) |
||
31 | |||
32 | /** |
||
33 | * Add collector value. Fallback to appropriate method of related collector. |
||
34 | * |
||
35 | * @param string $collector |
||
36 | * @param float $value |
||
37 | * @param array $labels |
||
38 | * |
||
39 | * @throws MetricException |
||
40 | */ |
||
41 | public function add(string $collector, float $value, array $labels = []) |
||
49 | |||
50 | /** |
||
51 | * Subtract the collector value, only for gauge collector. |
||
52 | * |
||
53 | * @param string $collector |
||
54 | * @param float $value |
||
55 | * @param array $labels |
||
56 | * |
||
57 | * @throws MetricException |
||
58 | */ |
||
59 | public function sub(string $collector, float $value, array $labels = []) |
||
67 | |||
68 | /** |
||
69 | * Observe collector value, only for histogram and summary collectors. |
||
70 | * |
||
71 | * @param string $collector |
||
72 | * @param float $value |
||
73 | * @param array $labels |
||
74 | * |
||
75 | * @throws MetricException |
||
76 | */ |
||
77 | public function observe(string $collector, float $value, array $labels = []) |
||
85 | |||
86 | /** |
||
87 | * Set collector value, only for gauge collector. |
||
88 | * |
||
89 | * @param string $collector |
||
90 | * @param float $value |
||
91 | * @param array $labels |
||
92 | * |
||
93 | * @throws MetricException |
||
94 | */ |
||
95 | public function set(string $collector, float $value, array $labels = []) |
||
103 | } |