Skip to content

Commit 566320c

Browse files
authored
MeteredDecoder records timer once in happy path (#1554)
1 parent 615b2fa commit 566320c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-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
@@ -58,7 +58,6 @@ public Object decode(Response response, Type type) throws IOException, FeignExce
5858
try {
5959
decoded = decoder.decode(meteredResponse, type);
6060
timer = createTimer(response, type, null);
61-
sample.stop(timer);
6261
} catch (IOException | RuntimeException e) {
6362
timer = createTimer(response, type, e);
6463
createExceptionCounter(response, type, e).count();

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,15 @@ public final void addMetricsCapability() {
8686
clientMetrics.values().stream()
8787
.filter(this::doesMetricHasCounter)
8888
.forEach(metric -> assertEquals(1, getMetricCounter(metric)));
89+
90+
final Map<METRIC_ID, METRIC> decoderMetrics =
91+
getFeignMetrics().entrySet().stream()
92+
.filter(entry -> isDecoderMetric(entry.getKey()))
93+
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
94+
95+
decoderMetrics.values().stream()
96+
.filter(this::doesMetricHasCounter)
97+
.forEach(metric -> assertEquals(1, getMetricCounter(metric)));
8998
}
9099

91100
protected abstract boolean doesMetricIncludeHost(METRIC_ID metricId);

0 commit comments

Comments
 (0)