Class NoOpTracerHook
java.lang.Object
org.apache.juneau.rest.server.tracing.NoOpTracerHook
- All Implemented Interfaces:
TracerHook
Default
TracerHook implementation that opens no spans and records nothing.
Used whenever no consumer-provided TracerHook bean is reachable from the
RestContext's bean store. Ensures the TracerHook contract is always satisfied
— the framework can call startSpan(RestRequest) unconditionally without a
null-check, and the returned NoOpTracerHook.NoOpScope satisfies the close-in-finally contract with
zero allocations.
Both INSTANCE and NoOpTracerHook.NoOpScope.INSTANCE are process-wide singletons; the
startSpan(RestRequest) method returns the same scope reference for every call and JIT-inlines
the no-op setters / close to empty method bodies.
- Since:
- 10.0.0
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstartSpan(RestRequest request) Opens a new span for the in-flight request.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.juneau.rest.server.tracing.TracerHook
inject, startSpan, startSpan
-
Field Details
-
INSTANCE
Process-wide singleton instance.
-
-
Method Details
-
startSpan
Description copied from interface:TracerHookOpens a new span for the in-flight request.- Specified by:
startSpanin interfaceTracerHook- Parameters:
request- The in-flightRestRequest. Nevernull . Bridges may read headers for distributed-tracing context propagation (e.g. W3Ctraceparent/tracestate), the HTTP method, the path, etc. Bridges must not mutate the request.- Returns:
- The opened
Scope. Nevernull . Returningnullis a contract violation — bridges that cannot open a span (e.g. because the trace context is invalid) should returnNoOpTracerHook.NoOpScope.INSTANCEso the framework's close-in-finally contract still holds.
-