Class OkHttpTracing
- java.lang.Object
-
- io.opentelemetry.instrumentation.okhttp.v3_0.OkHttpTracing
-
public final class OkHttpTracing extends Object
Entrypoint for tracing OkHttp clients.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static OkHttpTracingBuilderbuilder(io.opentelemetry.api.OpenTelemetry openTelemetry)Returns a newOkHttpTracingBuilderconfigured with the givenOpenTelemetry.static OkHttpTracingcreate(io.opentelemetry.api.OpenTelemetry openTelemetry)Returns a newOkHttpTracingconfigured with the givenOpenTelemetry.okhttp3.Call.FactorynewCallFactory(okhttp3.OkHttpClient baseClient)Construct a new OpenTelemetry tracing-enabledCall.Factoryusing the providedOkHttpClientinstance.okhttp3.InterceptornewInterceptor()Deprecated.Please use thenewCallFactory(OkHttpClient)method instead.
-
-
-
Method Detail
-
create
public static OkHttpTracing create(io.opentelemetry.api.OpenTelemetry openTelemetry)
Returns a newOkHttpTracingconfigured with the givenOpenTelemetry.
-
builder
public static OkHttpTracingBuilder builder(io.opentelemetry.api.OpenTelemetry openTelemetry)
Returns a newOkHttpTracingBuilderconfigured with the givenOpenTelemetry.
-
newInterceptor
@Deprecated public okhttp3.Interceptor newInterceptor()
Deprecated.Please use thenewCallFactory(OkHttpClient)method instead.Returns a newInterceptorthat can be used with methods likeOkHttpClient.Builder.addInterceptor(Interceptor).Important: asynchronous calls using
Call.enqueue(Callback)will *not* work correctly using just this interceptor.It is strongly recommended that you use the
newCallFactory(OkHttpClient)method to decorate yourOkHttpClient, rather than using this method directly.
-
newCallFactory
public okhttp3.Call.Factory newCallFactory(okhttp3.OkHttpClient baseClient)
Construct a new OpenTelemetry tracing-enabledCall.Factoryusing the providedOkHttpClientinstance.Using this method will result in proper propagation and span parenting, for both synchronous and asynchronous usages.
- Parameters:
baseClient- An instance of OkHttpClient configured as desired.- Returns:
- a
Call.Factoryfor creating newCallinstances.
-
-