Package io.micrometer.tracing.handler
Class HttpServerTracingObservationHandler
java.lang.Object
io.micrometer.tracing.handler.HttpServerTracingObservationHandler
- All Implemented Interfaces:
io.micrometer.observation.ObservationHandler<io.micrometer.observation.transport.http.context.HttpServerContext>,TracingObservationHandler<io.micrometer.observation.transport.http.context.HttpServerContext>
public class HttpServerTracingObservationHandler
extends Object
implements TracingObservationHandler<io.micrometer.observation.transport.http.context.HttpServerContext>
TracingRecordingListener that uses the Tracing API to record events for HTTP server
side.
- Since:
- 1.0.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.micrometer.observation.ObservationHandler
io.micrometer.observation.ObservationHandler.AllMatchingCompositeObservationHandler, io.micrometer.observation.ObservationHandler.CompositeObservationHandler, io.micrometer.observation.ObservationHandler.FirstMatchingCompositeObservationHandlerNested classes/interfaces inherited from interface io.micrometer.tracing.handler.TracingObservationHandler
TracingObservationHandler.TracingContext -
Constructor Summary
ConstructorsConstructorDescriptionHttpServerTracingObservationHandler(Tracer tracer, HttpServerHandler handler) Creates a new instance ofHttpServerTracingObservationHandler.HttpServerTracingObservationHandler(Tracer tracer, Function<io.micrometer.observation.transport.http.HttpServerRequest, Span> startFunction, BiConsumer<io.micrometer.observation.transport.http.HttpServerResponse, Span> stopConsumer) Creates a new instance ofHttpServerTracingObservationHandler. -
Method Summary
Modifier and TypeMethodDescriptiongetSpanName(io.micrometer.observation.transport.http.context.HttpServerContext ctx) Get the span name.Returns theTracer.voidonError(io.micrometer.observation.transport.http.context.HttpServerContext context) voidonStart(io.micrometer.observation.transport.http.context.HttpServerContext ctx) voidonStop(io.micrometer.observation.transport.http.context.HttpServerContext ctx) booleansupportsContext(io.micrometer.observation.Observation.Context context) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micrometer.observation.ObservationHandler
onStart, onStopMethods inherited from interface io.micrometer.tracing.handler.TracingObservationHandler
getRequiredSpan, getTracer, getTracingContext, onError, onScopeClosed, onScopeOpened, tagSpan
-
Constructor Details
-
HttpServerTracingObservationHandler
Creates a new instance ofHttpServerTracingObservationHandler.- Parameters:
tracer- tracerhandler- http server handler
-
HttpServerTracingObservationHandler
public HttpServerTracingObservationHandler(Tracer tracer, Function<io.micrometer.observation.transport.http.HttpServerRequest, Span> startFunction, BiConsumer<io.micrometer.observation.transport.http.HttpServerResponse, Span> stopConsumer) Creates a new instance ofHttpServerTracingObservationHandler.- Parameters:
tracer- tracerstartFunction- function that creates a spanstopConsumer- lambda to be applied on the span upon receiving the response
-
-
Method Details
-
getSpanName
Description copied from interface:TracingObservationHandlerGet the span name.- Specified by:
getSpanNamein interfaceTracingObservationHandler<io.micrometer.observation.transport.http.context.HttpServerContext>- Parameters:
ctx- handler context- Returns:
- name for the span
-
supportsContext
public boolean supportsContext(io.micrometer.observation.Observation.Context context) - Specified by:
supportsContextin interfaceio.micrometer.observation.ObservationHandler<io.micrometer.observation.transport.http.context.HttpServerContext>- Specified by:
supportsContextin interfaceTracingObservationHandler<io.micrometer.observation.transport.http.context.HttpServerContext>
-
onStart
public void onStart(io.micrometer.observation.transport.http.context.HttpServerContext ctx) - Specified by:
onStartin interfaceio.micrometer.observation.ObservationHandler<CTX extends io.micrometer.observation.transport.http.context.HttpContext>
-
getTracer
Description copied from interface:TracingObservationHandlerReturns theTracer.- Specified by:
getTracerin interfaceTracingObservationHandler<CTX extends io.micrometer.observation.transport.http.context.HttpContext>- Returns:
- tracer
-
onError
public void onError(io.micrometer.observation.transport.http.context.HttpServerContext context) - Specified by:
onErrorin interfaceio.micrometer.observation.ObservationHandler<CTX extends io.micrometer.observation.transport.http.context.HttpContext>- Specified by:
onErrorin interfaceTracingObservationHandler<CTX extends io.micrometer.observation.transport.http.context.HttpContext>
-
onStop
public void onStop(io.micrometer.observation.transport.http.context.HttpServerContext ctx) - Specified by:
onStopin interfaceio.micrometer.observation.ObservationHandler<CTX extends io.micrometer.observation.transport.http.context.HttpContext>
-