micronaut-micrometer
micronaut-micrometer copied to clipboard
TimedInterceptor specifies order
Feature description
TimedInterceptor doesn't override getOrder and return a specific value, so it gets 0. The docs for Ordered claim "Defaults to zero (no order)", but from my reading of how things work, 0 just means it'll happen before all the defined phases in InterceptPhase.
That means, if you put @Timed and @Async on the same method, I think you end up timing the tiny of bit code that kicks off the async work and not the actual work, which is probably not what most people would expect.
My proposal: have it return InterceptPhase.TRACE.
Might also be worth changing the comment on Ordered to not say "no order" to clarify that it only means no defined order relative to other 0 values, but it definitely will come before any InterceptPhase work :)