eclipse / microprofile-metrics

microprofile-metrics
Apache License 2.0
100 stars 66 forks source link

API: update package-info related to Timers #702

Closed donbourne closed 1 year ago

donbourne commented 1 year ago

for Timers the javadoc currently says: is used to measure the duration of an event as well as the frequency of occurrence. ...but Timers no longer measure frequency of occurrence

also, the example for Timers should use a try-with-resource block to be more useful

current:

 *     Timer timer = metricRegistry.timer(metadata);
 *     Timer.Context context = timer.time();
 *
 *     ... // code that will be timed
 *
 *     context.close();

proposed:

        Timer timer = metricRegistry.timer(metadata);
        try (Timer.Context context = timer.time()) {
            ... // code that will be timed
        }