-
Notifications
You must be signed in to change notification settings - Fork 1
/
Registry.php
38 lines (32 loc) · 1.03 KB
/
Registry.php
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
<?php
declare(strict_types=1);
namespace Zlodes\PrometheusClient\Registry;
use Zlodes\PrometheusClient\Exception\MetricAlreadyRegisteredException;
use Zlodes\PrometheusClient\Exception\MetricHasWrongTypeException;
use Zlodes\PrometheusClient\Exception\MetricNotFoundException;
use Zlodes\PrometheusClient\Metric\Metric;
interface Registry
{
/**
* @return $this
*
* @throws MetricAlreadyRegisteredException
*/
public function registerMetric(Metric $metric): self;
/**
* @return array<string, Metric> Name => Metric
*/
public function getAll(): array;
/**
* @template TMetric of Metric
*
* @param non-empty-string $name
* @param class-string<TMetric> $class
*
* @return TMetric
*
* @throws MetricNotFoundException When a metric with specified name isn't registered
* @throws MetricHasWrongTypeException When found metric has different type (e.g. expected Counter but Gauge given)
*/
public function getMetric(string $name, string $class): Metric;
}