dropwizard/metrics

[Help][4.0.5][4.2.9] Default timer not decaying exponentially

Nabeelperson opened this issue · 1 comments

Hi Dropwizard Team,

I have the following implementation of Jdbi's SqlLogger.logAfterExecution.

@Override
public void logAfterExecution(StatementContext context) {
    String metricName = buildMetricName(context);  // build a metric name based on DAO call
    if(! timerMap.containsKey(metricName)) {
        timerMap.put(metricName, metricRegistry.timer(metricName));
    }
    long elapsedTime = context.getElapsedTime(ChronoUnit.MILLIS);
    timerMap.get(metricName).update(elapsedTime, TimeUnit.MILLISECONDS);
}

Testing: I ran a dropwizard API and hit an endpoint with a single DAO call once. I have a UDS listener that prints out all the metrics to a terminal screen (filtered for DAO metrics).

Expectation: I should see the DAO metric such as dao.metric_name.p95 be emitted every tick with a decreasing value.

I have observed the following behaviors in 4.0.5 and 4.2.9: the metric produced every tick but the metric does not decay.

Ideally I resolve this issue while staying at 4.0.5 but if an upgrade is necessary/simpler resolution that is fine. Please let me know if I have made an incorrect assumption about how the default timers work. Thank you in advance for the help.

Hello Dropwizard team, looking for a status update on this.