Class TracingTestController
java.lang.Object
io.jmix.samples.restservice.controller.TracingTestController
Test HTTP controller that acts as an echo service for distributed tracing headers.
This controller is specifically designed to support tracing integration tests by:
1. Capturing incoming HTTP tracing headers (both W3C and B3 formats)
2. Logging the received headers for debugging purposes
3. Returning the headers back to the client as a structured response
The controller serves as a "mirror" that allows client-side code to verify
whether tracing headers are being properly propagated in outbound HTTP requests.
This is essential for testing distributed tracing functionality where we need
to confirm that trace context flows correctly across service boundaries.
Without this test endpoint, it would be difficult to verify that HTTP clients
are correctly injecting tracing headers, as the headers are typically consumed
by tracing infrastructure and not visible in normal application responses.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionio.jmix.samples.restservice.controller.TracingTestController.TracingResponsegetTracingInfo(String traceparent, String traceId, String spanId) Endpoint that captures and returns distributed tracing headers.
-
Constructor Details
-
TracingTestController
public TracingTestController()
-
-
Method Details
-
getTracingInfo
@GetMapping("/rest/tracing-test") public io.jmix.samples.restservice.controller.TracingTestController.TracingResponse getTracingInfo(@RequestHeader(value="traceparent",required=false) String traceparent, @RequestHeader(value="X-Trace-Id",required=false) String traceId, @RequestHeader(value="X-Span-Id",required=false) String spanId) Endpoint that captures and returns distributed tracing headers. This method extracts tracing headers from the incoming HTTP request and returns them in a structured format. It supports both W3C trace context (traceparent) and legacy B3 tracing headers for maximum compatibility.- Parameters:
traceparent- W3C trace context header containing trace ID, span ID, and flagstraceId- B3 trace ID header (legacy Zipkin format)spanId- B3 span ID header (legacy Zipkin format)- Returns:
- TracingResponse containing all received tracing headers and processing timestamp
-