I'm using micronaut tracing library to instrument an application. I want to use the tracing annotations (@NewSpan
and @ContinueSpan
) in classes that are not beans registered in the application context. I'm not getting spans for the methods in those classes, and I'm wondering if for the tracing annotations to work the classes need to be beans.
In order to have an effect when using @NewSpan
and @ContinueSpan
Micronaut requires Micronaut beans. Therefore the answer to your question is no, that does not work that way.
The reason is that for example @NewSpan
used Micronaut AOP. Micronaut AOP only works with Micronaut beans. For example the @NewSpan
annotation indicates that a call to a method annotated with @NewSpan
should be intercepted.