Interface TraceContextExtractor
@RestOp invocation.
RestOpInvoker resolves every operation argument (path/query/body parameters, parsed request
beans, etc.) before it opens a TracerHook span. A registered TraceContextExtractor
bean gets a look at those resolved arguments — not just the raw RestRequest — so
it can recognize a domain-specific carrier (for example a parsed JSON-RPC/MCP request's nested
params._meta object) and hand back a TraceContextCarrier plus a TraceOperation
before the span is created. Neither this interface nor its default implementation depends on MCP,
JSON-RPC, or OpenTelemetry.
Extraction only happens when a non-no-op TracerHook is active; a resource with no
registered TracerHook bean never resolves a TraceContextExtractor either, preserving
the existing zero-allocation no-op fast path.
See Also:
- Since:
- 10.0.0
-
Method Summary
Modifier and TypeMethodDescriptionextract(RestRequest request, Object[] resolvedArguments) Attempts to recognize a non-HTTP trace-context carrier among the resolved operation arguments.default TraceOperationoperation(RestRequest request, Object[] resolvedArguments) Derives theTraceOperationa bridge should name/attribute its span with.
-
Method Details
-
extract
Attempts to recognize a non-HTTP trace-context carrier among the resolved operation arguments.- Parameters:
request- The in-flightRestRequest. Nevernull .resolvedArguments- The fully-resolved@RestOphandler arguments, in declaration order. Nevernull ; may be empty.- Returns:
- The recognized
TraceContextCarrier, orOptional.empty()if this extractor found nothing to extract from the resolved arguments (the bridge then falls back to HTTP headers only). Nevernull .
-
operation
Derives theTraceOperationa bridge should name/attribute its span with.The default implementation returns
TraceOperation.DEFAULT— an extractor that overrides onlyextract(org.apache.juneau.rest.server.RestRequest, java.lang.Object[])still satisfiesTracerHook.startSpan's three-argument overload, and the bridge keeps its own HTTP-derived span name/attributes.- Parameters:
request- The in-flightRestRequest. Nevernull .resolvedArguments- The fully-resolved@RestOphandler arguments, in declaration order. Nevernull ; may be empty.- Returns:
- The derived
TraceOperation. Nevernull .
-