Skip to content

Commit

Permalink
MeteredDecoder records timer once in happy path (#1554)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalijr2 authored Dec 21, 2021
1 parent 08fe6a3 commit 4814ae0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ public final void addMetricsCapability() {
.filter(this::doesMetricHasCounter)
.forEach(metric -> assertEquals(1, getMetricCounter(metric)));

final Map<METRIC_ID, METRIC> 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);
Expand Down

0 comments on commit 4814ae0

Please sign in to comment.