Skip to content

Commit a23bce0

Browse files
authored
MeteredDecoder records timer once in happy path (#1554)
1 parent 1f7ca4c commit a23bce0

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

micrometer/src/main/java/feign/micrometer/MeteredDecoder.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ public Object decode(Response response, Type type)
6262
try {
6363
decoded = decoder.decode(meteredResponse, type);
6464
timer = createTimer(response, type, null);
65-
sample.stop(timer);
6665
} catch (IOException | RuntimeException e) {
6766
timer = createTimer(response, type, e);
6867
createExceptionCounter(response, type, e).count();

micrometer/src/test/java/feign/micrometer/AbstractMetricsTestBase.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ public final void addMetricsCapability() {
7474
.filter(this::doesMetricHasCounter)
7575
.forEach(metric -> assertEquals(1, getMetricCounter(metric)));
7676

77+
final Map<METRIC_ID, METRIC> decoderMetrics = getFeignMetrics().entrySet().stream()
78+
.filter(entry -> isDecoderMetric(entry.getKey()))
79+
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
80+
81+
decoderMetrics.values().stream()
82+
.filter(this::doesMetricHasCounter)
83+
.forEach(metric -> assertEquals(1, getMetricCounter(metric)));
7784
}
7885

7986
protected abstract boolean doesMetricIncludeHost(METRIC_ID metricId);

0 commit comments

Comments
 (0)