|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Prometheus; |
| 4 | + |
| 5 | +use Prometheus\Exception\MetricNotFoundException; |
| 6 | +use Prometheus\Exception\MetricsRegistrationException; |
| 7 | + |
| 8 | +interface RegistryInterface |
| 9 | +{ |
| 10 | + /** |
| 11 | + * @return MetricFamilySamples[] |
| 12 | + */ |
| 13 | + public function getMetricFamilySamples(): array; |
| 14 | + |
| 15 | + /** |
| 16 | + * @param string $namespace e.g. cms |
| 17 | + * @param string $name e.g. duration_seconds |
| 18 | + * @param string $help e.g. The duration something took in seconds. |
| 19 | + * @param array $labels e.g. ['controller', 'action'] |
| 20 | + * |
| 21 | + * @return Gauge |
| 22 | + * @throws MetricsRegistrationException |
| 23 | + */ |
| 24 | + public function registerGauge($namespace, $name, $help, $labels = []): Gauge; |
| 25 | + |
| 26 | + /** |
| 27 | + * @param string $namespace |
| 28 | + * @param string $name |
| 29 | + * |
| 30 | + * @return Gauge |
| 31 | + * @throws MetricNotFoundException |
| 32 | + */ |
| 33 | + public function getGauge($namespace, $name): Gauge; |
| 34 | + |
| 35 | + /** |
| 36 | + * @param string $namespace e.g. cms |
| 37 | + * @param string $name e.g. duration_seconds |
| 38 | + * @param string $help e.g. The duration something took in seconds. |
| 39 | + * @param array $labels e.g. ['controller', 'action'] |
| 40 | + * |
| 41 | + * @return Gauge |
| 42 | + * @throws MetricsRegistrationException |
| 43 | + */ |
| 44 | + public function getOrRegisterGauge($namespace, $name, $help, $labels = []): Gauge; |
| 45 | + |
| 46 | + /** |
| 47 | + * @param string $namespace e.g. cms |
| 48 | + * @param string $name e.g. requests |
| 49 | + * @param string $help e.g. The number of requests made. |
| 50 | + * @param array $labels e.g. ['controller', 'action'] |
| 51 | + * |
| 52 | + * @return Counter |
| 53 | + * @throws MetricsRegistrationException |
| 54 | + */ |
| 55 | + public function registerCounter($namespace, $name, $help, $labels = []): Counter; |
| 56 | + |
| 57 | + /** |
| 58 | + * @param string $namespace |
| 59 | + * @param string $name |
| 60 | + * |
| 61 | + * @return Counter |
| 62 | + * @throws MetricNotFoundException |
| 63 | + */ |
| 64 | + public function getCounter($namespace, $name): Counter; |
| 65 | + |
| 66 | + /** |
| 67 | + * @param string $namespace e.g. cms |
| 68 | + * @param string $name e.g. requests |
| 69 | + * @param string $help e.g. The number of requests made. |
| 70 | + * @param array $labels e.g. ['controller', 'action'] |
| 71 | + * |
| 72 | + * @return Counter |
| 73 | + * @throws MetricsRegistrationException |
| 74 | + */ |
| 75 | + public function getOrRegisterCounter($namespace, $name, $help, $labels = []): Counter; |
| 76 | + |
| 77 | + /** |
| 78 | + * @param string $namespace e.g. cms |
| 79 | + * @param string $name e.g. duration_seconds |
| 80 | + * @param string $help e.g. A histogram of the duration in seconds. |
| 81 | + * @param array $labels e.g. ['controller', 'action'] |
| 82 | + * @param array $buckets e.g. [100, 200, 300] |
| 83 | + * |
| 84 | + * @return Histogram |
| 85 | + * @throws MetricsRegistrationException |
| 86 | + */ |
| 87 | + public function registerHistogram($namespace, $name, $help, $labels = [], $buckets = null): Histogram; |
| 88 | + |
| 89 | + /** |
| 90 | + * @param string $namespace |
| 91 | + * @param string $name |
| 92 | + * |
| 93 | + * @return Histogram |
| 94 | + * @throws MetricNotFoundException |
| 95 | + */ |
| 96 | + public function getHistogram($namespace, $name): Histogram; |
| 97 | + |
| 98 | + /** |
| 99 | + * @param string $namespace e.g. cms |
| 100 | + * @param string $name e.g. duration_seconds |
| 101 | + * @param string $help e.g. A histogram of the duration in seconds. |
| 102 | + * @param array $labels e.g. ['controller', 'action'] |
| 103 | + * @param array $buckets e.g. [100, 200, 300] |
| 104 | + * |
| 105 | + * @return Histogram |
| 106 | + * @throws MetricsRegistrationException |
| 107 | + */ |
| 108 | + public function getOrRegisterHistogram($namespace, $name, $help, $labels = [], $buckets = null): Histogram; |
| 109 | +} |
0 commit comments