Class ServletHttpServerTracer<REQUEST,RESPONSE>
- java.lang.Object
-
- io.opentelemetry.instrumentation.api.tracer.BaseTracer
-
- io.opentelemetry.instrumentation.api.tracer.HttpServerTracer<REQUEST,RESPONSE,REQUEST,REQUEST>
-
- io.opentelemetry.instrumentation.servlet.ServletHttpServerTracer<REQUEST,RESPONSE>
-
public abstract class ServletHttpServerTracer<REQUEST,RESPONSE> extends io.opentelemetry.instrumentation.api.tracer.HttpServerTracer<REQUEST,RESPONSE,REQUEST,REQUEST>
-
-
Field Summary
Fields Modifier and Type Field Description static StringASYNC_LISTENER_ATTRIBUTEstatic StringASYNC_LISTENER_RESPONSE_ATTRIBUTE
-
Constructor Summary
Constructors Modifier Constructor Description protectedServletHttpServerTracer(ServletAccessor<REQUEST,RESPONSE> accessor)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddUnwrappedThrowable(io.opentelemetry.context.Context context, Throwable throwable)voidattachAsyncListener(REQUEST request)protected voidattachServerContext(io.opentelemetry.context.Context context, REQUEST request)protected io.opentelemetry.context.ContextcustomizeContext(io.opentelemetry.context.Context context, REQUEST request)voidendExceptionally(io.opentelemetry.context.Context context, Throwable throwable, RESPONSE response, long timestamp)ThrowableerrorException(REQUEST request)protected abstract StringerrorExceptionAttributeName()protected Stringflavor(REQUEST connection, REQUEST request)protected abstract io.opentelemetry.context.propagation.TextMapGetter<REQUEST>getGetter()io.opentelemetry.context.ContextgetServerContext(REQUEST request)StringgetSpanName(REQUEST request)booleanisAsyncListenerAttached(REQUEST request)protected Stringmethod(REQUEST request)booleanneedsRescoping(io.opentelemetry.context.Context attachedContext)voidonTimeout(io.opentelemetry.context.Context context, long timeout)protected StringpeerHostIp(REQUEST connection)protected IntegerpeerPort(REQUEST connection)protected StringrequestHeader(REQUEST httpServletRequest, String name)protected intresponseStatus(RESPONSE response)voidsetAsyncListenerResponse(REQUEST request, RESPONSE response)Response object must be attached to a request prior toattachAsyncListener(Object)being called, as otherwise in some environments it is not possible to access response from async event in listeners.voidsetPrincipal(io.opentelemetry.context.Context context, REQUEST request)io.opentelemetry.context.ContextstartSpan(REQUEST request, String spanName, boolean servlet)protected ThrowableunwrapThrowable(Throwable throwable)io.opentelemetry.context.ContextupdateContext(io.opentelemetry.context.Context context, REQUEST request)When server spans are managed by app server instrumentation we need to add context path of current request to context if it isn't already added.voidupdateSpanName(REQUEST request)protected Stringurl(REQUEST httpServletRequest)-
Methods inherited from class io.opentelemetry.instrumentation.api.tracer.HttpServerTracer
end, end, endExceptionally, endExceptionally, getServerSpan, isRelativeUrl, onConnection, onConnectionAndRequest, onRequest, startSpan, startSpan, startSpan
-
-
-
-
Constructor Detail
-
ServletHttpServerTracer
protected ServletHttpServerTracer(ServletAccessor<REQUEST,RESPONSE> accessor)
-
-
Method Detail
-
startSpan
public io.opentelemetry.context.Context startSpan(REQUEST request, String spanName, boolean servlet)
-
customizeContext
protected io.opentelemetry.context.Context customizeContext(io.opentelemetry.context.Context context, REQUEST request)
-
endExceptionally
public void endExceptionally(io.opentelemetry.context.Context context, Throwable throwable, RESPONSE response, long timestamp)
-
getServerContext
public io.opentelemetry.context.Context getServerContext(REQUEST request)
-
attachServerContext
protected void attachServerContext(io.opentelemetry.context.Context context, REQUEST request)
-
responseStatus
protected int responseStatus(RESPONSE response)
-
getGetter
protected abstract io.opentelemetry.context.propagation.TextMapGetter<REQUEST> getGetter()
-
setAsyncListenerResponse
public void setAsyncListenerResponse(REQUEST request, RESPONSE response)
Response object must be attached to a request prior toattachAsyncListener(Object)being called, as otherwise in some environments it is not possible to access response from async event in listeners.
-
attachAsyncListener
public void attachAsyncListener(REQUEST request)
-
isAsyncListenerAttached
public boolean isAsyncListenerAttached(REQUEST request)
-
addUnwrappedThrowable
public void addUnwrappedThrowable(io.opentelemetry.context.Context context, Throwable throwable)
-
unwrapThrowable
protected Throwable unwrapThrowable(Throwable throwable)
- Overrides:
unwrapThrowablein classio.opentelemetry.instrumentation.api.tracer.BaseTracer
-
setPrincipal
public void setPrincipal(io.opentelemetry.context.Context context, REQUEST request)
-
errorExceptionAttributeName
protected abstract String errorExceptionAttributeName()
-
updateContext
public io.opentelemetry.context.Context updateContext(io.opentelemetry.context.Context context, REQUEST request)When server spans are managed by app server instrumentation we need to add context path of current request to context if it isn't already added. Servlet instrumentation adds it when it starts server span.
-
updateSpanName
public void updateSpanName(REQUEST request)
-
onTimeout
public void onTimeout(io.opentelemetry.context.Context context, long timeout)
-
needsRescoping
public boolean needsRescoping(io.opentelemetry.context.Context attachedContext)
-
-