|
@@ -13,10 +13,10 @@
|
|
* See the License for the specific language governing permissions and
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
* limitations under the License.
|
|
*/
|
|
*/
|
|
-package io.opentelemetry.auto.instrumentation.okhttp;
|
|
|
|
|
|
+package io.opentelemetry.auto.instrumentation.okhttp.v3_0;
|
|
|
|
|
|
-import static io.opentelemetry.auto.instrumentation.okhttp.OkHttpClientDecorator.DECORATE;
|
|
|
|
-import static io.opentelemetry.auto.instrumentation.okhttp.RequestBuilderInjectAdapter.SETTER;
|
|
|
|
|
|
+import static io.opentelemetry.auto.instrumentation.okhttp.v3_0.OkHttpClientDecorator.DECORATE;
|
|
|
|
+import static io.opentelemetry.auto.instrumentation.okhttp.v3_0.OkHttpClientDecorator.TRACER;
|
|
import static io.opentelemetry.context.ContextUtils.withScopedContext;
|
|
import static io.opentelemetry.context.ContextUtils.withScopedContext;
|
|
import static io.opentelemetry.trace.Span.Kind.CLIENT;
|
|
import static io.opentelemetry.trace.Span.Kind.CLIENT;
|
|
import static io.opentelemetry.trace.TracingContextUtils.withSpan;
|
|
import static io.opentelemetry.trace.TracingContextUtils.withSpan;
|
|
@@ -25,7 +25,6 @@ import io.grpc.Context;
|
|
import io.opentelemetry.OpenTelemetry;
|
|
import io.opentelemetry.OpenTelemetry;
|
|
import io.opentelemetry.context.Scope;
|
|
import io.opentelemetry.context.Scope;
|
|
import io.opentelemetry.trace.Span;
|
|
import io.opentelemetry.trace.Span;
|
|
-import io.opentelemetry.trace.Tracer;
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import okhttp3.Interceptor;
|
|
import okhttp3.Interceptor;
|
|
@@ -34,8 +33,6 @@ import okhttp3.Response;
|
|
|
|
|
|
@Slf4j
|
|
@Slf4j
|
|
public class TracingInterceptor implements Interceptor {
|
|
public class TracingInterceptor implements Interceptor {
|
|
- public static final Tracer TRACER =
|
|
|
|
- OpenTelemetry.getTracerProvider().get("io.opentelemetry.auto.okhttp-3.0");
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Response intercept(final Chain chain) throws IOException {
|
|
public Response intercept(final Chain chain) throws IOException {
|
|
@@ -51,7 +48,9 @@ public class TracingInterceptor implements Interceptor {
|
|
final Context context = withSpan(span, Context.current());
|
|
final Context context = withSpan(span, Context.current());
|
|
|
|
|
|
final Request.Builder requestBuilder = chain.request().newBuilder();
|
|
final Request.Builder requestBuilder = chain.request().newBuilder();
|
|
- OpenTelemetry.getPropagators().getHttpTextFormat().inject(context, requestBuilder, SETTER);
|
|
|
|
|
|
+ OpenTelemetry.getPropagators()
|
|
|
|
+ .getHttpTextFormat()
|
|
|
|
+ .inject(context, requestBuilder, RequestBuilderInjectAdapter.SETTER);
|
|
|
|
|
|
final Response response;
|
|
final Response response;
|
|
try (final Scope scope = withScopedContext(context)) {
|
|
try (final Scope scope = withScopedContext(context)) {
|