Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

OpenZipkin Brave is a distributed tracing implementation compatible with Twitter Zipkin backend services, written in Java. For quite a while OpenZipkin Brave offers a dedicated module to integrate with Apache CXF framework, namely brave-cxf3. However, lately the discussion had been initiated to make this integration a part of Apache CXF codebase so the CXF team is going to be responsible for maintaining it. As such, it is going to be available since 3.2.0/3.1.12 releases under cxf-integration-tracing-brave module, with both client side and server side supported. This section gives a complete overview on how distributed tracing using OpenZipkin Brave (4.3.x+) could be integrated into JAX-RS / JAX-WS applications built on top of Apache CXF.

...

Under the hood spans are attached to their threads (in general, thread which created the span should close it), the same technique employed by other distributed tracing implementations. However, what is unique is that OpenZipkin Brave distinguishes three different types of tracers:

...

.

...

Apache CXF integration uses client tracer Apache CXF integration uses  HttpTracing (part of Brave HTTP instrumentation) to instantiate spans on client side (providers and interceptors) to demarcate send / receive cycle , server tracer as well on the server side (providers and interceptors) to demarcate receive / send cycle, while using local tracer regular Tracer for any spans instantiated within a process.

...

Apache CXF uses HTTP headers to hand off tracing context from the client to the service and from the service to service. Those headers are used internally by OpenZipkin Brave and are not configurable at the moment. The header names are declared in the BraveHttpHeaders the B3Propagation class and at the moment include:

  • X-B3-TraceId: 128 or 64-bit trace ID
  • X-B3-SpanId: 64-bit span ID
  • X-B3-ParentSpanId: 64-bit parent span ID
  • X-B3-Sampled: "1" means report this span to the tracing system, "0" means do not

  • X-B3-Flags: "1" implies sampled and is a request to override collection-tier sampling policy

By default, BraveClientProvider will try to pass the currently active span through HTTP headers on each service invocation. If there is no active spans, the new span will be created and passed through HTTP headers on per-invocation basis. Essentially, for JAX-RS applications just registering BraveClientProvider on the client and BraveProvider on the server is enough to have tracing context to be properly passed everywhere. The only configuration part which is necessary are span reports(s) and sampler(s).

...