Skip to content

Commit

Permalink
feat: add metric name to MetricsRegistrationException
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Podlipsky <[email protected]>
  • Loading branch information
simPod committed Nov 18, 2024
1 parent 50b70a6 commit 0ac74fc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Prometheus/CollectorRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function registerGauge(string $namespace, string $name, string $help, arr
{
$metricIdentifier = self::metricIdentifier($namespace, $name);
if (isset($this->gauges[$metricIdentifier])) {
throw new MetricsRegistrationException("Metric already registered");
throw new MetricsRegistrationException("Metric ` . $metricIdentifier . ` already registered");
}
$this->gauges[$metricIdentifier] = new Gauge(
$this->storageAdapter,
Expand Down Expand Up @@ -159,7 +159,7 @@ public function registerCounter(string $namespace, string $name, string $help, a
{
$metricIdentifier = self::metricIdentifier($namespace, $name);
if (isset($this->counters[$metricIdentifier])) {
throw new MetricsRegistrationException("Metric already registered");
throw new MetricsRegistrationException("Metric ` . $metricIdentifier . ` already registered");
}
$this->counters[$metricIdentifier] = new Counter(
$this->storageAdapter,
Expand Down Expand Up @@ -225,7 +225,7 @@ public function registerHistogram(
): Histogram {
$metricIdentifier = self::metricIdentifier($namespace, $name);
if (isset($this->histograms[$metricIdentifier])) {
throw new MetricsRegistrationException("Metric already registered");
throw new MetricsRegistrationException("Metric ` . $metricIdentifier . ` already registered");
}
$this->histograms[$metricIdentifier] = new Histogram(
$this->storageAdapter,
Expand Down Expand Up @@ -301,7 +301,7 @@ public function registerSummary(
): Summary {
$metricIdentifier = self::metricIdentifier($namespace, $name);
if (isset($this->summaries[$metricIdentifier])) {
throw new MetricsRegistrationException("Metric already registered");
throw new MetricsRegistrationException("Metric ` . $metricIdentifier . ` already registered");
}
$this->summaries[$metricIdentifier] = new Summary(
$this->storageAdapter,
Expand Down

0 comments on commit 0ac74fc

Please sign in to comment.