Skip to content

Commit

Permalink
fix(deps): update opentelemetry.instrumentation.alpha to v2.6.0-alpha (
Browse files Browse the repository at this point in the history
…#483)

* fix(deps): update opentelemetry.instrumentation.alpha to v2.6.0-alpha

* update okhttp instrumentation breakage

* remove unnecessary dep

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jason Plumb <[email protected]>
  • Loading branch information
renovate[bot] and breedx-splk authored Jul 20, 2024
1 parent fb407bd commit 3579223
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 25 deletions.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
opentelemetry = "1.40.0"
opentelemetry-alpha = "1.38.0-alpha"
opentelemetry-instrumentation = "2.6.0"
opentelemetry-instrumentation-alpha = "2.5.0-alpha"
opentelemetry-instrumentation-alpha = "2.6.0-alpha"
opentelemetry-semconv = "1.25.0-alpha"
opentelemetry-contrib = "1.34.0-alpha"
mockito = "5.12.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,18 @@

package io.opentelemetry.instrumentation.library.okhttp.v3_0.internal;

import static java.util.Collections.singletonList;

import io.opentelemetry.api.GlobalOpenTelemetry;
import io.opentelemetry.context.Context;
import io.opentelemetry.context.Scope;
import io.opentelemetry.instrumentation.api.incubator.semconv.net.PeerServiceAttributesExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
import io.opentelemetry.instrumentation.api.semconv.http.HttpClientRequestResendCount;
import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractor;
import io.opentelemetry.instrumentation.library.okhttp.v3_0.OkHttpInstrumentationConfig;
import io.opentelemetry.instrumentation.okhttp.v3_0.internal.ConnectionErrorSpanInterceptor;
import io.opentelemetry.instrumentation.okhttp.v3_0.internal.OkHttpAttributesGetter;
import io.opentelemetry.instrumentation.okhttp.v3_0.internal.OkHttpInstrumenterFactory;
import io.opentelemetry.instrumentation.okhttp.v3_0.internal.OkHttpClientInstrumenterBuilderFactory;
import io.opentelemetry.instrumentation.okhttp.v3_0.internal.TracingInterceptor;
import java.util.function.Function;
import java.util.function.Supplier;
import okhttp3.Interceptor;
import okhttp3.Request;
Expand All @@ -33,29 +31,33 @@ public final class OkHttp3Singletons {
private static final Supplier<Instrumenter<Request, Response>> INSTRUMENTER =
CachedSupplier.create(
() ->
OkHttpInstrumenterFactory.create(
GlobalOpenTelemetry.get(),
builder ->
builder.setCapturedRequestHeaders(
OkHttpInstrumentationConfig
.getCapturedRequestHeaders())
.setCapturedResponseHeaders(
OkHttpInstrumentationConfig
.getCapturedResponseHeaders())
.setKnownMethods(
OkHttpInstrumentationConfig
.getKnownMethods()),
spanNameExtractorConfigurer ->
spanNameExtractorConfigurer.setKnownMethods(
OkHttpInstrumentationConfig.getKnownMethods()),
Function.identity(),
singletonList(
OkHttpClientInstrumenterBuilderFactory.create(GlobalOpenTelemetry.get())
.setCapturedRequestHeaders(
OkHttpInstrumentationConfig.getCapturedRequestHeaders())
.setCapturedResponseHeaders(
OkHttpInstrumentationConfig
.getCapturedResponseHeaders())
.setKnownMethods(OkHttpInstrumentationConfig.getKnownMethods())
// TODO: Do we really need to set the known methods on the span
// name
// extractor as well?
.setSpanNameExtractor(
x ->
HttpSpanNameExtractor.builder(
OkHttpAttributesGetter.INSTANCE)
.setKnownMethods(
OkHttpInstrumentationConfig
.getKnownMethods())
.build())
.addAttributeExtractor(
PeerServiceAttributesExtractor.create(
OkHttpAttributesGetter.INSTANCE,
OkHttpInstrumentationConfig
.newPeerServiceResolver())),
OkHttpInstrumentationConfig
.emitExperimentalHttpClientMetrics()));
.newPeerServiceResolver()))
.setEmitExperimentalHttpClientMetrics(
OkHttpInstrumentationConfig
.emitExperimentalHttpClientMetrics())
.build());

public static final Interceptor CALLBACK_CONTEXT_INTERCEPTOR =
chain -> {
Expand Down

0 comments on commit 3579223

Please sign in to comment.