Skip to content

Commit 75c54f7

Browse files
committed
remove time unit from metric name
Signed-off-by: Ben Efrati <[email protected]>
1 parent 4562a34 commit 75c54f7

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

implementations/micrometer-registry-otlp/src/main/java/io/micrometer/registry/otlp/OtlpMetricConverter.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,7 @@ private static Optional<ExponentialHistogramSnapShot> getExponentialHistogramSna
157157
}
158158

159159
private void addMaxGaugeForTimer(Meter.Id id, Iterable<KeyValue> tags, double max) {
160-
String metricName = id.getName()
161-
+ (isTimeBasedMeter(id) ? "." + this.baseTimeUnit.toString().toLowerCase() : "") + ".max";
160+
String metricName = id.getName() + ".max";
162161
Metric.Builder metricBuilder = getOrCreateMetricBuilder(id.withName(metricName), DataCase.GAUGE);
163162
if (!metricBuilder.hasGauge()) {
164163
metricBuilder.setGauge(io.opentelemetry.proto.metrics.v1.Gauge.newBuilder());

implementations/micrometer-registry-otlp/src/test/java/io/micrometer/registry/otlp/OTelCollectorIntegrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ void collectorShouldExportMetrics() throws Exception {
107107
// see: https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/20519
108108
matchesPattern("(?s)^.*test_timer_milliseconds_sum\\{.+} 123\\.0\\n.*$"),
109109
matchesPattern("(?s)^.*test_timer_milliseconds_bucket\\{.+,le=\"\\+Inf\"} 1\\n.*$"),
110-
matchesPattern("(?s)^.*test_timer_milliseconds_max\\{.+} 123\\.0\n.*$"),
110+
matchesPattern("(?s)^.*test_timer_max_milliseconds\\{.+} 123\\.0\n.*$"),
111111

112112
containsString("# HELP test_ds \n"),
113113
containsString("# TYPE test_ds histogram\n"),

0 commit comments

Comments
 (0)