Class HttpServerTracer<REQUEST,RESPONSE,CONNECTION,STORAGE>
- java.lang.Object
-
- io.opentelemetry.instrumentation.api.tracer.BaseTracer
-
- io.opentelemetry.instrumentation.api.tracer.HttpServerTracer<REQUEST,RESPONSE,CONNECTION,STORAGE>
-
- Type Parameters:
REQUEST- - The specific type for HTTP requestsRESPONSE- - The specific type for HTTP responsesCONNECTION- - The specific type of HTTP connection, used to get peer address information and HTTP flavor.STORAGE- - Implementation specific storage type for attaching/getting the server context. Use Void if your subclass does not have an implementation specific storage need.
public abstract class HttpServerTracer<REQUEST,RESPONSE,CONNECTION,STORAGE> extends BaseTracer
Base class for implementing Tracers for HTTP servers. It has 3 types that must be specified by subclasses:
-
-
Field Summary
Fields Modifier and Type Field Description static StringCONTEXT_ATTRIBUTE-
Fields inherited from class io.opentelemetry.instrumentation.api.tracer.BaseTracer
CONTEXT_CLIENT_SPAN_KEY, CONTEXT_SERVER_SPAN_KEY
-
-
Constructor Summary
Constructors Constructor Description HttpServerTracer()HttpServerTracer(io.opentelemetry.api.trace.Tracer tracer)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidend(io.opentelemetry.context.Context context, RESPONSE response)Convenience method.voidend(io.opentelemetry.context.Context context, RESPONSE response, long timestamp)voidendExceptionally(io.opentelemetry.context.Context context, Throwable throwable)Convenience method.voidendExceptionally(io.opentelemetry.context.Context context, Throwable throwable, RESPONSE response)Convenience method.voidendExceptionally(io.opentelemetry.context.Context context, Throwable throwable, RESPONSE response, long timestamp)Ifresponseisnull, thehttp.status_codewill be set to500and theSpanstatus will be set toStatusCode.ERROR.abstract @Nullable io.opentelemetry.context.ContextgetServerContext(STORAGE storage)Returns context stored to the given request-response-loop storage byattachServerContext(Context, Object).io.opentelemetry.api.trace.SpangetServerSpan(STORAGE storage)io.opentelemetry.context.ContextstartSpan(REQUEST request, CONNECTION connection, @Nullable STORAGE storage, String spanName, long startTimestamp)io.opentelemetry.context.ContextstartSpan(REQUEST request, CONNECTION connection, STORAGE storage, Method origin)io.opentelemetry.context.ContextstartSpan(REQUEST request, CONNECTION connection, STORAGE storage, String spanName)-
Methods inherited from class io.opentelemetry.instrumentation.api.tracer.BaseTracer
addThrowable, end, end, endExceptionally, endExceptionally, extract, getCurrentServerSpan, getCurrentServerSpan, getCurrentSpan, spanNameForClass, spanNameForMethod, startScope, startSpan, startSpan, startSpan
-
-
-
-
Field Detail
-
CONTEXT_ATTRIBUTE
public static final String CONTEXT_ATTRIBUTE
-
-
Method Detail
-
startSpan
public io.opentelemetry.context.Context startSpan(REQUEST request, CONNECTION connection, STORAGE storage, Method origin)
-
startSpan
public io.opentelemetry.context.Context startSpan(REQUEST request, CONNECTION connection, STORAGE storage, String spanName)
-
startSpan
public io.opentelemetry.context.Context startSpan(REQUEST request, CONNECTION connection, @Nullable STORAGE storage, String spanName, long startTimestamp)
-
end
public void end(io.opentelemetry.context.Context context, RESPONSE response)
-
end
public void end(io.opentelemetry.context.Context context, RESPONSE response, long timestamp)
-
endExceptionally
public void endExceptionally(io.opentelemetry.context.Context context, Throwable throwable)Convenience method. Delegates toendExceptionally(Context, Throwable, Object), passingresponsevalue ofnull.
-
endExceptionally
public void endExceptionally(io.opentelemetry.context.Context context, Throwable throwable, RESPONSE response)Convenience method. Delegates toendExceptionally(Context, Throwable, Object, long), passingtimestampvalue of-1.
-
endExceptionally
public void endExceptionally(io.opentelemetry.context.Context context, Throwable throwable, RESPONSE response, long timestamp)Ifresponseisnull, thehttp.status_codewill be set to500and theSpanstatus will be set toStatusCode.ERROR.
-
getServerSpan
public io.opentelemetry.api.trace.Span getServerSpan(STORAGE storage)
-
getServerContext
public abstract @Nullable io.opentelemetry.context.Context getServerContext(STORAGE storage)
Returns context stored to the given request-response-loop storage byattachServerContext(Context, Object).
-
-