SmallRye OpenTracing is an implementation of https://github.com/eclipse/microprofile-opentracing meant to be reusable for different vendors.
The following components have to be added to deployment to pass microprofile-opentracing-tck
:
Server side JAX-RS tracing integration is provided by JAX-RS SmallRyeTracingDynamicFeature
and
servlet filter SpanFinishingFilter
which finishes the span started in JAX-RS filter.
The installation is JAX-RS and server implementation specific.
For example in RestEasy DynamicFeature
it can be enabled by specifying
resteasy.providers
in servlet context init parameters. The following code snippet demonstrates
possible installation.
public class ServletContextTracingInstaller implements ServletContextListener {
@Override
public void contextInitialized(ServletContextEvent servletContextEvent) {
ServletContext servletContext = servletContextEvent.getServletContext();
servletContext.setInitParameter("resteasy.providers", SmallRyeTracingDynamicFeature.class.getName());
Dynamic filterRegistration = servletContext.addFilter("tracingFilter", new SpanFinishingFilter());
filterRegistration.setAsyncSupported(true);
filterRegistration.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "*");
}
}
Vendor has to implement ClientTracingRegistrarProvider
and specify it in
META-INF/services/org.eclipse.microprofile.opentracing.ClientTracingRegistrarProvider
.
This project provides SmallRyeClientTracingFeature
with tracing integration. The feature
has to be registered to ClientBuilder
in vendor specific implementation of ClientTracingRegistrarProvider
.
Client side tracing usually requires more components, for example OpenTracing-aware AsyncExecutor
.
The Rest Client instrumentation is provided in SmallRyeRestClientListener
which has to be registered
in META-INF/services/org.eclipse.microprofile.rest.client.spi.RestClientListener
.
The @Traced
aspects of the specification is provided by the OpenTracingInterceptor
, from the
OpenTracing Contrib Java Interceptors project.