Пример #1
0
 /**
  * @param string $variable
  * @return \Prometheus\Gauge
  */
 private function getOrRegisterGaugeForVariable($variable)
 {
     try {
         $gauge = $this->collectorRegistry->getGauge($this->namespace, $variable);
     } catch (MetricNotFoundException $e) {
         $gauge = $this->collectorRegistry->registerGauge($this->namespace, $variable, '', array_keys($this->tags));
     }
     return $gauge;
 }
 /**
  * @test
  * @expectedException \Prometheus\Exception\MetricNotFoundException
  */
 public function itShouldThrowAnExceptionWhenGettingANonExistentMetric()
 {
     $registry = new CollectorRegistry($this->adapter);
     $registry->getGauge("not_here", "go_away");
 }