Jimdo / prometheus_client_php

Prometheus instrumentation library for PHP applications
https://prometheus.io/docs/concepts/metric_types/
Apache License 2.0
281 stars 213 forks source link

Incorrect name in Exception #41

Closed thompsa closed 6 years ago

thompsa commented 7 years ago

When checking the label name it displays metricName on error.

diff --git a/src/Prometheus/Collector.php b/src/Prometheus/Collector.php
index 7efc5d6..edc5e80 100644
--- a/src/Prometheus/Collector.php
+++ b/src/Prometheus/Collector.php
@@ -32,7 +32,7 @@ abstract class Collector
         $this->help = $help;
         foreach ($labels as $label) {
             if (!preg_match(self::RE_METRIC_LABEL_NAME, $label)) {
-                throw new \InvalidArgumentException("Invalid label name: '" . $metricName . "'");
+                throw new \InvalidArgumentException("Invalid label name: '" . $label . "'");
             }
         }
         $this->labels = $labels;
bracki commented 6 years ago

Fixed in #66.