O'Reilly logo

Hands-On Enterprise Java Microservices with Eclipse MicroProfile by Scott Stark, Antoine Sabot-Durand, Pavol Loffay, Jeff Mesnil, Heiko W. Rupp, Cesar Saavedra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

@Traced annotation

MicroProfile OpenTracing defines an @Traced annotation that can be used to enable tracing on CDI beans or disable tracing on automatically traced interfaces. The annotation can also be used to override the operation name on other automatically traced components – JAX-RS endpoints.

The following code example shows how the @Traced annotation can be used to enable tracing on a CDI bean. (1) enables tracing for all methods the bean defines. (2) overrides the default operation name (package.className.method) to get_all_users. (3) disables tracing of the health method:

@Traced (1)@ApplicationScopedpublic class Service {   @Traced(operationName = "get_all_users") (2)   public void getUsers() {        // business code   } @Traced(false) (3) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required