Skip to content

Commit 5bb71a0

Browse files
KacperFilutowski-TomTomzeitlinger
authored andcommitted
[DropwizardExport] Apply label mapper to metric name for snapshots
Signed-off-by: Kacper Filutowski <[email protected]>
1 parent 2678bcc commit 5bb71a0

File tree

2 files changed

+4
-2
lines changed
  • prometheus-metrics-instrumentation-dropwizard5/src/main/java/io/prometheus/metrics/instrumentation/dropwizard5
  • prometheus-metrics-instrumentation-dropwizard/src/main/java/io/prometheus/metrics/instrumentation/dropwizard

2 files changed

+4
-2
lines changed

prometheus-metrics-instrumentation-dropwizard/src/main/java/io/prometheus/metrics/instrumentation/dropwizard/DropwizardExports.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,9 @@ MetricSnapshot fromSnapshotAndCount(
169169
.quantile(0.999, snapshot.get999thPercentile() * factor)
170170
.build();
171171

172+
String name = labelMapper.isPresent() ? labelMapper.get().getName(dropwizardName) : dropwizardName;
172173
MetricMetadata metadata =
173-
new MetricMetadata(PrometheusNaming.sanitizeMetricName(dropwizardName), helpMessage);
174+
new MetricMetadata(PrometheusNaming.sanitizeMetricName(name), helpMessage);
174175
SummarySnapshot.SummaryDataPointSnapshot.Builder dataPointBuilder =
175176
SummarySnapshot.SummaryDataPointSnapshot.builder().quantiles(quantiles).count(count);
176177
labelMapper.ifPresent(

prometheus-metrics-instrumentation-dropwizard5/src/main/java/io/prometheus/metrics/instrumentation/dropwizard5/DropwizardExports.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,9 @@ MetricSnapshot fromSnapshotAndCount(
169169
.quantile(0.999, snapshot.get999thPercentile() * factor)
170170
.build();
171171

172+
String name = labelMapper.isPresent() ? labelMapper.get().getName(dropwizardName) : dropwizardName;
172173
MetricMetadata metadata =
173-
new MetricMetadata(PrometheusNaming.sanitizeMetricName(dropwizardName), helpMessage);
174+
new MetricMetadata(PrometheusNaming.sanitizeMetricName(name), helpMessage);
174175
SummarySnapshot.SummaryDataPointSnapshot.Builder dataPointBuilder =
175176
SummarySnapshot.SummaryDataPointSnapshot.builder().quantiles(quantiles).count(count);
176177
labelMapper.ifPresent(

0 commit comments

Comments
 (0)