Class ServletHelper<REQUEST,RESPONSE>
java.lang.Object
io.opentelemetry.javaagent.instrumentation.servlet.BaseServletHelper<REQUEST,RESPONSE>
io.opentelemetry.javaagent.instrumentation.servlet.ServletHelper<REQUEST,RESPONSE>
-
Field Summary
FieldsFields inherited from class io.opentelemetry.javaagent.instrumentation.servlet.BaseServletHelper
accessor, instrumenter -
Constructor Summary
ConstructorsConstructorDescriptionServletHelper(io.opentelemetry.instrumentation.api.instrumenter.Instrumenter<ServletRequestContext<REQUEST>, ServletResponseContext<RESPONSE>> instrumenter, ServletAccessor<REQUEST, RESPONSE> accessor) -
Method Summary
Modifier and TypeMethodDescriptionvoidattachAsyncListener(REQUEST request) voidend(ServletRequestContext<REQUEST> requestContext, REQUEST request, RESPONSE response, Throwable throwable, boolean topLevel, io.opentelemetry.context.Context context, io.opentelemetry.context.Scope scope) getAsyncException(REQUEST request) getAsyncListenerResponse(REQUEST request) booleanisAsyncListenerAttached(REQUEST request) booleanmustEndOnHandlerMethodExit(REQUEST request) Helper method to determine whether the appserver handler/servlet service/servlet filter method that started a span must also end it, even if no error was detected.voidrecordAsyncException(REQUEST request, Throwable throwable) voidsetAsyncListenerResponse(REQUEST request, RESPONSE response) Response object must be attached to a request prior toattachAsyncListener(ServletRequestContext)being called, as otherwise in some environments it is not possible to access response from async event in listeners.wrapAsyncRunnable(REQUEST request, Runnable runnable) Methods inherited from class io.opentelemetry.javaagent.instrumentation.servlet.BaseServletHelper
addServletContextPath, captureServletAttributes, getServerContext, needsRescoping, recordException, shouldStart, start, updateContext
-
Field Details
-
ASYNC_EXCEPTION_ATTRIBUTE
-
CONTEXT_ATTRIBUTE
-
-
Constructor Details
-
ServletHelper
public ServletHelper(io.opentelemetry.instrumentation.api.instrumenter.Instrumenter<ServletRequestContext<REQUEST>, ServletResponseContext<RESPONSE>> instrumenter, ServletAccessor<REQUEST, RESPONSE> accessor)
-
-
Method Details
-
end
public void end(ServletRequestContext<REQUEST> requestContext, REQUEST request, RESPONSE response, Throwable throwable, boolean topLevel, io.opentelemetry.context.Context context, io.opentelemetry.context.Scope scope) -
mustEndOnHandlerMethodExit
Helper method to determine whether the appserver handler/servlet service/servlet filter method that started a span must also end it, even if no error was detected. Extracted as a separate method to avoid duplicating the comments on the logic behind this choice. -
setAsyncListenerResponse
Response object must be attached to a request prior toattachAsyncListener(ServletRequestContext)being called, as otherwise in some environments it is not possible to access response from async event in listeners. -
getAsyncListenerResponse
-
attachAsyncListener
-
isAsyncListenerAttached
-
wrapAsyncRunnable
-
recordAsyncException
-
getAsyncException
-