Class OkHttpTelemetry
java.lang.Object
io.opentelemetry.instrumentation.okhttp.v3_0.OkHttpTelemetry
Entrypoint for instrumenting OkHttp clients.
-
Method Summary
Modifier and TypeMethodDescriptionstatic OkHttpTelemetryBuilderbuilder(io.opentelemetry.api.OpenTelemetry openTelemetry) Returns a newOkHttpTelemetryBuilderconfigured with the givenOpenTelemetry.static OkHttpTelemetrycreate(io.opentelemetry.api.OpenTelemetry openTelemetry) Returns a newOkHttpTelemetryconfigured with the givenOpenTelemetry.okhttp3.Call.FactorynewCallFactory(okhttp3.OkHttpClient baseClient) Construct a new OpenTelemetry tracing-enabledCall.Factoryusing the providedOkHttpClientinstance.okhttp3.InterceptorDeprecated.
-
Method Details
-
create
Returns a newOkHttpTelemetryconfigured with the givenOpenTelemetry. -
builder
Returns a newOkHttpTelemetryBuilderconfigured with the givenOpenTelemetry. -
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.
-
newCallFactory(OkHttpClient)method instead.