diff --git a/micrometer/src/main/java/feign/micrometer/MeteredDecoder.java b/micrometer/src/main/java/feign/micrometer/MeteredDecoder.java index c47e5baa9..8800a7e29 100644 --- a/micrometer/src/main/java/feign/micrometer/MeteredDecoder.java +++ b/micrometer/src/main/java/feign/micrometer/MeteredDecoder.java @@ -62,7 +62,6 @@ public Object decode(Response response, Type type) try { decoded = decoder.decode(meteredResponse, type); timer = createTimer(response, type, null); - sample.stop(timer); } catch (IOException | RuntimeException e) { timer = createTimer(response, type, e); createExceptionCounter(response, type, e).count(); diff --git a/micrometer/src/test/java/feign/micrometer/AbstractMetricsTestBase.java b/micrometer/src/test/java/feign/micrometer/AbstractMetricsTestBase.java index 0b62f52c4..441a927f3 100644 --- a/micrometer/src/test/java/feign/micrometer/AbstractMetricsTestBase.java +++ b/micrometer/src/test/java/feign/micrometer/AbstractMetricsTestBase.java @@ -74,6 +74,13 @@ public final void addMetricsCapability() { .filter(this::doesMetricHasCounter) .forEach(metric -> assertEquals(1, getMetricCounter(metric))); + final Map decoderMetrics = getFeignMetrics().entrySet().stream() + .filter(entry -> isDecoderMetric(entry.getKey())) + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); + + decoderMetrics.values().stream() + .filter(this::doesMetricHasCounter) + .forEach(metric -> assertEquals(1, getMetricCounter(metric))); } protected abstract boolean doesMetricIncludeHost(METRIC_ID metricId);