How to configure tracing in Java
To configure tracing in Java, register the OpenTracingClientInterceptor()
interceptor.
You can register the interceptors on both the Temporal Client side and the Worker side.
The following code examples demonstrate the OpenTracingClientInterceptor()
on the Temporal Client.
WorkflowClientOptions.newBuilder()
//...
.setInterceptors(new OpenTracingClientInterceptor())
.build();
WorkflowClientOptions clientOptions =
WorkflowClientOptions.newBuilder()
.setInterceptors(new OpenTracingClientInterceptor(JaegerUtils.getJaegerOptions(type)))
.build();
WorkflowClient client = WorkflowClient.newInstance(service, clientOptions);
The following code examples demonstrate the OpenTracingClientInterceptor()
on the Worker.
WorkerFactoryOptions.newBuilder()
//...
.setWorkerInterceptors(new OpenTracingWorkerInterceptor())
.build();
WorkerFactoryOptions factoryOptions =
WorkerFactoryOptions.newBuilder()
.setWorkerInterceptors(
new OpenTracingWorkerInterceptor(JaegerUtils.getJaegerOptions(type)))
.build();
WorkerFactory factory = WorkerFactory.newInstance(client, factoryOptions);
For more information, see the Temporal OpenTracing module.