Class HttpClientTracer<REQUEST,CARRIER,RESPONSE>
- java.lang.Object
-
- io.opentelemetry.instrumentation.api.tracer.BaseTracer
-
- io.opentelemetry.instrumentation.api.tracer.HttpClientTracer<REQUEST,CARRIER,RESPONSE>
-
public abstract class HttpClientTracer<REQUEST,CARRIER,RESPONSE> extends BaseTracer
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_SPAN_NAMEprotected NetPeerAttributesnetPeerAttributesprotected static StringUSER_AGENT
-
Constructor Summary
Constructors Modifier Constructor Description protectedHttpClientTracer(io.opentelemetry.api.OpenTelemetry openTelemetry, NetPeerAttributes netPeerAttributes)protectedHttpClientTracer(NetPeerAttributes netPeerAttributes)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidend(io.opentelemetry.context.Context context, RESPONSE response)voidend(io.opentelemetry.context.Context context, RESPONSE response, long endTimeNanos)voidendExceptionally(io.opentelemetry.context.Context context, RESPONSE response, Throwable throwable)voidendExceptionally(io.opentelemetry.context.Context context, RESPONSE response, Throwable throwable, long endTimeNanos)voidendMaybeExceptionally(io.opentelemetry.context.Context context, RESPONSE response, @Nullable Throwable throwable)protected @Nullable Stringflavor(REQUEST request)protected abstract io.opentelemetry.context.propagation.TextMapSetter<CARRIER>getSetter()protected voidinject(io.opentelemetry.context.Context context, CARRIER carrier)protected abstract Stringmethod(REQUEST request)protected voidonRequest(io.opentelemetry.api.trace.SpanBuilder spanBuilder, REQUEST request)protected voidonRequest(io.opentelemetry.api.trace.Span span, REQUEST request)This method should only be used when the request is not yet available whenstartSpan(io.opentelemetry.context.Context, REQUEST, CARRIER)is called.protected voidonResponse(io.opentelemetry.api.trace.Span span, RESPONSE response)protected abstract @Nullable StringrequestHeader(REQUEST request, String name)protected abstract @Nullable StringresponseHeader(RESPONSE response, String name)booleanshouldStartSpan(io.opentelemetry.context.Context parentContext)protected StringspanNameForRequest(REQUEST request)io.opentelemetry.context.ContextstartSpan(io.opentelemetry.api.trace.SpanKind kind, io.opentelemetry.context.Context parentContext, REQUEST request, CARRIER carrier, long startTimeNanos)io.opentelemetry.context.ContextstartSpan(io.opentelemetry.context.Context parentContext, REQUEST request, CARRIER carrier)io.opentelemetry.context.ContextstartSpan(io.opentelemetry.context.Context parentContext, REQUEST request, CARRIER carrier, long startTimeNanos)protected abstract @Nullable Integerstatus(RESPONSE response)protected abstract @Nullable URIurl(REQUEST request)-
Methods inherited from class io.opentelemetry.instrumentation.api.tracer.BaseTracer
end, end, endExceptionally, endExceptionally, extract, getInstrumentationName, getVersion, inject, onException, shouldStartSpan, spanBuilder, startSpan, startSpan, startSpan, unwrapThrowable, withClientSpan, withConsumerSpan, withServerSpan
-
-
-
-
Field Detail
-
DEFAULT_SPAN_NAME
public static final String DEFAULT_SPAN_NAME
- See Also:
- Constant Field Values
-
USER_AGENT
protected static final String USER_AGENT
- See Also:
- Constant Field Values
-
netPeerAttributes
protected final NetPeerAttributes netPeerAttributes
-
-
Constructor Detail
-
HttpClientTracer
protected HttpClientTracer(NetPeerAttributes netPeerAttributes)
-
HttpClientTracer
protected HttpClientTracer(io.opentelemetry.api.OpenTelemetry openTelemetry, NetPeerAttributes netPeerAttributes)
-
-
Method Detail
-
url
protected abstract @Nullable URI url(REQUEST request) throws URISyntaxException
- Throws:
URISyntaxException
-
getSetter
protected abstract io.opentelemetry.context.propagation.TextMapSetter<CARRIER> getSetter()
-
shouldStartSpan
public boolean shouldStartSpan(io.opentelemetry.context.Context parentContext)
-
startSpan
public io.opentelemetry.context.Context startSpan(io.opentelemetry.context.Context parentContext, REQUEST request, CARRIER carrier)
-
startSpan
public io.opentelemetry.context.Context startSpan(io.opentelemetry.api.trace.SpanKind kind, io.opentelemetry.context.Context parentContext, REQUEST request, CARRIER carrier, long startTimeNanos)
-
startSpan
public io.opentelemetry.context.Context startSpan(io.opentelemetry.context.Context parentContext, REQUEST request, CARRIER carrier, long startTimeNanos)
-
inject
protected void inject(io.opentelemetry.context.Context context, CARRIER carrier)
-
end
public void end(io.opentelemetry.context.Context context, RESPONSE response)
-
end
public void end(io.opentelemetry.context.Context context, RESPONSE response, long endTimeNanos)
-
endExceptionally
public void endExceptionally(io.opentelemetry.context.Context context, RESPONSE response, Throwable throwable)
-
endExceptionally
public void endExceptionally(io.opentelemetry.context.Context context, RESPONSE response, Throwable throwable, long endTimeNanos)
-
endMaybeExceptionally
public void endMaybeExceptionally(io.opentelemetry.context.Context context, RESPONSE response, @Nullable Throwable throwable)
-
onRequest
protected void onRequest(io.opentelemetry.api.trace.SpanBuilder spanBuilder, REQUEST request)
-
onRequest
protected void onRequest(io.opentelemetry.api.trace.Span span, REQUEST request)This method should only be used when the request is not yet available whenstartSpan(io.opentelemetry.context.Context, REQUEST, CARRIER)is called. OtherwiseonRequest(SpanBuilder, Object)should be used.
-
onResponse
protected void onResponse(io.opentelemetry.api.trace.Span span, RESPONSE response)
-
-