...
Distributed Tracing with Micrometer Observation and JAX-WS support
...
Distributed tracing in the Apache CXF is build primarily around JAX-RS 2.x implementation. However, JAX-WS is also supported but it requires to write some boiler-plate code and use Micrometer Observation APIs directly (the JAX-WS integration is going to be enhanced in the future). Essentially, from the server-side prospective the in/out interceptors, ObservationStartInterceptor and ObservationStopInterceptor respectively, should be configured as part of interceptor chains, either manually or using ObservationFeature. For example:
Code Block |
---|
final ObservationRegistry observationRegistry = ObservationRegistry.create();
// Configure tracing bridge, propagators, etc...
final JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
...
sf.getFeatures().add(new ObservationFeature( observationRegistry ));
...
sf.create(); |
Similarly to the server-side, client-side needs own set of out/in interceptors, ObservationClientStartInterceptor and ObservationClientStopInterceptor (or ObservationClientFeature). Please notice the difference from server-side: ObservationClientStartInterceptor becomes out-interceptor while ObservationClientStopInterceptor becomes in-interceptor. For example:
Code Block | ||||
---|---|---|---|---|
| ||||
final ObservationRegistry observationRegistry = ObservationRegistry.create();
// Configure tracing bridge, propagators, etc...
final JaxWsProxyFactoryBean sf = new JaxWsProxyFactoryBean();
...
sf.getFeatures().add(new ObservationClientFeature(observationRegistry));
...
sf.create(); |
Accessing Micrometer Observation APIs
...
The Apache CXF uses native Micrometer Observation capabilities so the existing instrumentations for different HTTP clients work as expected. The usage of only JAX-RS client is not required.