The spec discussion of metric reusability gives an example about reuse via annotations, and it also discusses how metrics created via annotations are not by default reusable, while those created via the
MetricRegistry API are.
But nowhere in the MetricRegistry JavaDoc is reusability mentioned, so it's not at all clear which of those methods -- if any -- would enforce reusability.
The JavaDoc for the type-based MetricRegisty methods -- concurrentGauge, counter, histogram, meter, timer -- describe "lookup-first-then-register-if-absent" semantics. There's no hint of using the reusability setting if the metric already exists.
For the register methods, the doc states that it's an error for the caller to specify a metric that has already been registered. There's no mention of reusability there either.
So, is it true that none of the MetricRegistry methods themselves should enforce reusability? Or, is it really true that reusability is intended to apply only to metrics registered via annotation?
It'd be great to hear on this thread what the intent is, and to see the spec and/or JavaDoc clarified in a future release.
- Tim