Rename http.resend_count to http.request.resend_count (#9700)
This commit is contained in:
parent
60b65488cb
commit
ea8f3d0e24
|
|
@ -10,6 +10,7 @@ import static io.opentelemetry.instrumentation.api.internal.AttributesExtractorU
|
||||||
import io.opentelemetry.api.common.AttributesBuilder;
|
import io.opentelemetry.api.common.AttributesBuilder;
|
||||||
import io.opentelemetry.context.Context;
|
import io.opentelemetry.context.Context;
|
||||||
import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor;
|
import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor;
|
||||||
|
import io.opentelemetry.instrumentation.api.instrumenter.http.internal.HttpAttributes;
|
||||||
import io.opentelemetry.instrumentation.api.instrumenter.net.internal.InternalNetClientAttributesExtractor;
|
import io.opentelemetry.instrumentation.api.instrumenter.net.internal.InternalNetClientAttributesExtractor;
|
||||||
import io.opentelemetry.instrumentation.api.instrumenter.network.internal.InternalNetworkAttributesExtractor;
|
import io.opentelemetry.instrumentation.api.instrumenter.network.internal.InternalNetworkAttributesExtractor;
|
||||||
import io.opentelemetry.instrumentation.api.instrumenter.network.internal.InternalServerAttributesExtractor;
|
import io.opentelemetry.instrumentation.api.instrumenter.network.internal.InternalServerAttributesExtractor;
|
||||||
|
|
@ -117,7 +118,7 @@ public final class HttpClientAttributesExtractor<REQUEST, RESPONSE>
|
||||||
|
|
||||||
int resendCount = resendCountIncrementer.applyAsInt(parentContext);
|
int resendCount = resendCountIncrementer.applyAsInt(parentContext);
|
||||||
if (resendCount > 0) {
|
if (resendCount > 0) {
|
||||||
attributes.put(SemanticAttributes.HTTP_RESEND_COUNT, resendCount);
|
attributes.put(HttpAttributes.HTTP_REQUEST_RESEND_COUNT, resendCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ public final class HttpClientAttributesExtractorBuilder<REQUEST, RESPONSE> {
|
||||||
List<String> capturedRequestHeaders = emptyList();
|
List<String> capturedRequestHeaders = emptyList();
|
||||||
List<String> capturedResponseHeaders = emptyList();
|
List<String> capturedResponseHeaders = emptyList();
|
||||||
Set<String> knownMethods = HttpConstants.KNOWN_METHODS;
|
Set<String> knownMethods = HttpConstants.KNOWN_METHODS;
|
||||||
ToIntFunction<Context> resendCountIncrementer = HttpClientResendCount::getAndIncrement;
|
ToIntFunction<Context> resendCountIncrementer = HttpClientRequestResendCount::getAndIncrement;
|
||||||
|
|
||||||
HttpClientAttributesExtractorBuilder(
|
HttpClientAttributesExtractorBuilder(
|
||||||
HttpClientAttributesGetter<REQUEST, RESPONSE> httpAttributesGetter,
|
HttpClientAttributesGetter<REQUEST, RESPONSE> httpAttributesGetter,
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,12 @@ import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
|
||||||
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
|
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
|
||||||
|
|
||||||
/** A helper that keeps track of the count of the HTTP request resend attempts. */
|
/** A helper that keeps track of the count of the HTTP request resend attempts. */
|
||||||
public final class HttpClientResendCount {
|
public final class HttpClientRequestResendCount {
|
||||||
|
|
||||||
private static final ContextKey<HttpClientResendCount> KEY =
|
private static final ContextKey<HttpClientRequestResendCount> KEY =
|
||||||
ContextKey.named("opentelemetry-http-client-resend-key");
|
ContextKey.named("opentelemetry-http-client-resend-key");
|
||||||
private static final AtomicIntegerFieldUpdater<HttpClientResendCount> resendsUpdater =
|
private static final AtomicIntegerFieldUpdater<HttpClientRequestResendCount> resendsUpdater =
|
||||||
AtomicIntegerFieldUpdater.newUpdater(HttpClientResendCount.class, "resends");
|
AtomicIntegerFieldUpdater.newUpdater(HttpClientRequestResendCount.class, "resends");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the HTTP request resend counter.
|
* Initializes the HTTP request resend counter.
|
||||||
|
|
@ -29,7 +29,7 @@ public final class HttpClientResendCount {
|
||||||
if (context.get(KEY) != null) {
|
if (context.get(KEY) != null) {
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
return context.with(KEY, new HttpClientResendCount());
|
return context.with(KEY, new HttpClientRequestResendCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -37,12 +37,12 @@ public final class HttpClientResendCount {
|
||||||
* send attempt.
|
* send attempt.
|
||||||
*/
|
*/
|
||||||
public static int get(Context context) {
|
public static int get(Context context) {
|
||||||
HttpClientResendCount resend = context.get(KEY);
|
HttpClientRequestResendCount resend = context.get(KEY);
|
||||||
return resend == null ? 0 : resend.resends;
|
return resend == null ? 0 : resend.resends;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int getAndIncrement(Context context) {
|
static int getAndIncrement(Context context) {
|
||||||
HttpClientResendCount resend = context.get(KEY);
|
HttpClientRequestResendCount resend = context.get(KEY);
|
||||||
if (resend == null) {
|
if (resend == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -52,5 +52,5 @@ public final class HttpClientResendCount {
|
||||||
@SuppressWarnings("unused") // it actually is used by the resendsUpdater
|
@SuppressWarnings("unused") // it actually is used by the resendsUpdater
|
||||||
private volatile int resends = 0;
|
private volatile int resends = 0;
|
||||||
|
|
||||||
private HttpClientResendCount() {}
|
private HttpClientRequestResendCount() {}
|
||||||
}
|
}
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
package io.opentelemetry.instrumentation.api.instrumenter.http.internal;
|
package io.opentelemetry.instrumentation.api.instrumenter.http.internal;
|
||||||
|
|
||||||
|
import static io.opentelemetry.api.common.AttributeKey.longKey;
|
||||||
import static io.opentelemetry.api.common.AttributeKey.stringKey;
|
import static io.opentelemetry.api.common.AttributeKey.stringKey;
|
||||||
|
|
||||||
import io.opentelemetry.api.common.AttributeKey;
|
import io.opentelemetry.api.common.AttributeKey;
|
||||||
|
|
@ -20,5 +21,8 @@ public final class HttpAttributes {
|
||||||
|
|
||||||
public static final AttributeKey<String> ERROR_TYPE = stringKey("error.type");
|
public static final AttributeKey<String> ERROR_TYPE = stringKey("error.type");
|
||||||
|
|
||||||
|
public static final AttributeKey<Long> HTTP_REQUEST_RESEND_COUNT =
|
||||||
|
longKey("http.request.resend_count");
|
||||||
|
|
||||||
private HttpAttributes() {}
|
private HttpAttributes() {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ import io.opentelemetry.api.common.Attributes;
|
||||||
import io.opentelemetry.api.common.AttributesBuilder;
|
import io.opentelemetry.api.common.AttributesBuilder;
|
||||||
import io.opentelemetry.context.Context;
|
import io.opentelemetry.context.Context;
|
||||||
import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor;
|
import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor;
|
||||||
|
import io.opentelemetry.instrumentation.api.instrumenter.http.internal.HttpAttributes;
|
||||||
import io.opentelemetry.semconv.SemanticAttributes;
|
import io.opentelemetry.semconv.SemanticAttributes;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -149,7 +150,7 @@ class HttpClientAttributesExtractorTest {
|
||||||
asList("123", "456")),
|
asList("123", "456")),
|
||||||
entry(SemanticAttributes.NET_PEER_NAME, "github.com"),
|
entry(SemanticAttributes.NET_PEER_NAME, "github.com"),
|
||||||
entry(SemanticAttributes.NET_PEER_PORT, 123L),
|
entry(SemanticAttributes.NET_PEER_PORT, 123L),
|
||||||
entry(SemanticAttributes.HTTP_RESEND_COUNT, 2L));
|
entry(HttpAttributes.HTTP_REQUEST_RESEND_COUNT, 2L));
|
||||||
|
|
||||||
AttributesBuilder endAttributes = Attributes.builder();
|
AttributesBuilder endAttributes = Attributes.builder();
|
||||||
extractor.onEnd(endAttributes, Context.root(), request, response, null);
|
extractor.onEnd(endAttributes, Context.root(), request, response, null);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* Copyright The OpenTelemetry Authors
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.opentelemetry.instrumentation.api.instrumenter.http;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
import io.opentelemetry.context.Context;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
class HttpClientRequestResendCountTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void resendCountShouldBeZeroWhenNotInitialized() {
|
||||||
|
assertThat(HttpClientRequestResendCount.getAndIncrement(Context.root())).isEqualTo(0);
|
||||||
|
assertThat(HttpClientRequestResendCount.getAndIncrement(Context.root())).isEqualTo(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void incrementResendCount() {
|
||||||
|
Context context = HttpClientRequestResendCount.initialize(Context.root());
|
||||||
|
|
||||||
|
assertThat(HttpClientRequestResendCount.getAndIncrement(context)).isEqualTo(0);
|
||||||
|
assertThat(HttpClientRequestResendCount.getAndIncrement(context)).isEqualTo(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright The OpenTelemetry Authors
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
package io.opentelemetry.instrumentation.api.instrumenter.http;
|
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
|
||||||
|
|
||||||
import io.opentelemetry.context.Context;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
class HttpClientResendCountTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void resendCountShouldBeZeroWhenNotInitialized() {
|
|
||||||
assertThat(HttpClientResendCount.getAndIncrement(Context.root())).isEqualTo(0);
|
|
||||||
assertThat(HttpClientResendCount.getAndIncrement(Context.root())).isEqualTo(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void incrementResendCount() {
|
|
||||||
Context context = HttpClientResendCount.initialize(Context.root());
|
|
||||||
|
|
||||||
assertThat(HttpClientResendCount.getAndIncrement(context)).isEqualTo(0);
|
|
||||||
assertThat(HttpClientResendCount.getAndIncrement(context)).isEqualTo(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -16,6 +16,7 @@ import io.opentelemetry.api.common.Attributes;
|
||||||
import io.opentelemetry.api.common.AttributesBuilder;
|
import io.opentelemetry.api.common.AttributesBuilder;
|
||||||
import io.opentelemetry.context.Context;
|
import io.opentelemetry.context.Context;
|
||||||
import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor;
|
import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor;
|
||||||
|
import io.opentelemetry.instrumentation.api.instrumenter.http.internal.HttpAttributes;
|
||||||
import io.opentelemetry.semconv.SemanticAttributes;
|
import io.opentelemetry.semconv.SemanticAttributes;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -146,7 +147,7 @@ class HttpClientAttributesExtractorBothSemconvTest {
|
||||||
entry(SemanticAttributes.NET_PEER_PORT, 123L),
|
entry(SemanticAttributes.NET_PEER_PORT, 123L),
|
||||||
entry(SemanticAttributes.SERVER_ADDRESS, "github.com"),
|
entry(SemanticAttributes.SERVER_ADDRESS, "github.com"),
|
||||||
entry(SemanticAttributes.SERVER_PORT, 123L),
|
entry(SemanticAttributes.SERVER_PORT, 123L),
|
||||||
entry(SemanticAttributes.HTTP_RESEND_COUNT, 2L));
|
entry(HttpAttributes.HTTP_REQUEST_RESEND_COUNT, 2L));
|
||||||
|
|
||||||
AttributesBuilder endAttributes = Attributes.builder();
|
AttributesBuilder endAttributes = Attributes.builder();
|
||||||
extractor.onEnd(endAttributes, Context.root(), request, response, null);
|
extractor.onEnd(endAttributes, Context.root(), request, response, null);
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,7 @@ class HttpClientAttributesExtractorStableSemconvTest {
|
||||||
asList("123", "456")),
|
asList("123", "456")),
|
||||||
entry(SemanticAttributes.SERVER_ADDRESS, "github.com"),
|
entry(SemanticAttributes.SERVER_ADDRESS, "github.com"),
|
||||||
entry(SemanticAttributes.SERVER_PORT, 123L),
|
entry(SemanticAttributes.SERVER_PORT, 123L),
|
||||||
entry(SemanticAttributes.HTTP_RESEND_COUNT, 2L));
|
entry(HttpAttributes.HTTP_REQUEST_RESEND_COUNT, 2L));
|
||||||
|
|
||||||
AttributesBuilder endAttributes = Attributes.builder();
|
AttributesBuilder endAttributes = Attributes.builder();
|
||||||
extractor.onEnd(endAttributes, Context.root(), request, response, null);
|
extractor.onEnd(endAttributes, Context.root(), request, response, null);
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import io.opentelemetry.context.Context;
|
||||||
import io.opentelemetry.context.Scope;
|
import io.opentelemetry.context.Scope;
|
||||||
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
|
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
|
||||||
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientPeerServiceAttributesExtractor;
|
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientPeerServiceAttributesExtractor;
|
||||||
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientResendCount;
|
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientRequestResendCount;
|
||||||
import io.opentelemetry.instrumentation.okhttp.v3_0.internal.ConnectionErrorSpanInterceptor;
|
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.OkHttpAttributesGetter;
|
||||||
import io.opentelemetry.instrumentation.okhttp.v3_0.internal.OkHttpInstrumenterFactory;
|
import io.opentelemetry.instrumentation.okhttp.v3_0.internal.OkHttpInstrumenterFactory;
|
||||||
|
|
@ -41,7 +41,8 @@ public final class OkHttp3Singletons {
|
||||||
|
|
||||||
public static final Interceptor CONTEXT_INTERCEPTOR =
|
public static final Interceptor CONTEXT_INTERCEPTOR =
|
||||||
chain -> {
|
chain -> {
|
||||||
try (Scope ignored = HttpClientResendCount.initialize(Context.current()).makeCurrent()) {
|
try (Scope ignored =
|
||||||
|
HttpClientRequestResendCount.initialize(Context.current()).makeCurrent()) {
|
||||||
return chain.proceed(chain.request());
|
return chain.proceed(chain.request());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ package io.opentelemetry.instrumentation.okhttp.v3_0;
|
||||||
|
|
||||||
import io.opentelemetry.context.Context;
|
import io.opentelemetry.context.Context;
|
||||||
import io.opentelemetry.context.Scope;
|
import io.opentelemetry.context.Scope;
|
||||||
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientResendCount;
|
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientRequestResendCount;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import okhttp3.Interceptor;
|
import okhttp3.Interceptor;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
|
|
@ -23,7 +23,7 @@ final class ContextInterceptor implements Interceptor {
|
||||||
parentContext = Context.current();
|
parentContext = Context.current();
|
||||||
}
|
}
|
||||||
// include the resend counter
|
// include the resend counter
|
||||||
Context context = HttpClientResendCount.initialize(parentContext);
|
Context context = HttpClientRequestResendCount.initialize(parentContext);
|
||||||
try (Scope ignored = context.makeCurrent()) {
|
try (Scope ignored = context.makeCurrent()) {
|
||||||
return chain.proceed(request);
|
return chain.proceed(request);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ package io.opentelemetry.instrumentation.okhttp.v3_0.internal;
|
||||||
|
|
||||||
import io.opentelemetry.context.Context;
|
import io.opentelemetry.context.Context;
|
||||||
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
|
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
|
||||||
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientResendCount;
|
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientRequestResendCount;
|
||||||
import io.opentelemetry.instrumentation.api.internal.InstrumenterUtil;
|
import io.opentelemetry.instrumentation.api.internal.InstrumenterUtil;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
|
@ -42,7 +42,7 @@ public final class ConnectionErrorSpanInterceptor implements Interceptor {
|
||||||
throw t;
|
throw t;
|
||||||
} finally {
|
} finally {
|
||||||
// only create a span when there wasn't any HTTP request
|
// only create a span when there wasn't any HTTP request
|
||||||
if (HttpClientResendCount.get(parentContext) == 0) {
|
if (HttpClientRequestResendCount.get(parentContext) == 0) {
|
||||||
if (instrumenter.shouldStart(parentContext, request)) {
|
if (instrumenter.shouldStart(parentContext, request)) {
|
||||||
InstrumenterUtil.startAndEnd(
|
InstrumenterUtil.startAndEnd(
|
||||||
instrumenter, parentContext, request, response, error, startTime, Instant.now());
|
instrumenter, parentContext, request, response, error, startTime, Instant.now());
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ package io.opentelemetry.javaagent.instrumentation.reactornetty.v1_0;
|
||||||
import static io.opentelemetry.javaagent.instrumentation.reactornetty.v1_0.ReactorContextKeys.CONTEXTS_HOLDER_KEY;
|
import static io.opentelemetry.javaagent.instrumentation.reactornetty.v1_0.ReactorContextKeys.CONTEXTS_HOLDER_KEY;
|
||||||
|
|
||||||
import io.opentelemetry.context.Context;
|
import io.opentelemetry.context.Context;
|
||||||
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientResendCount;
|
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientRequestResendCount;
|
||||||
import io.opentelemetry.instrumentation.netty.v4_1.NettyClientTelemetry;
|
import io.opentelemetry.instrumentation.netty.v4_1.NettyClientTelemetry;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
@ -118,7 +118,7 @@ public final class HttpResponseReceiverInstrumenter {
|
||||||
public void accept(HttpClientRequest request, Throwable error) {
|
public void accept(HttpClientRequest request, Throwable error) {
|
||||||
instrumentationContexts.endClientSpan(null, error);
|
instrumentationContexts.endClientSpan(null, error);
|
||||||
|
|
||||||
if (HttpClientResendCount.get(instrumentationContexts.getParentContext()) == 0) {
|
if (HttpClientRequestResendCount.get(instrumentationContexts.getParentContext()) == 0) {
|
||||||
// request is an instance of FailedHttpClientRequest, which does not implement a correct
|
// request is an instance of FailedHttpClientRequest, which does not implement a correct
|
||||||
// resourceUrl() method -- we have to work around that
|
// resourceUrl() method -- we have to work around that
|
||||||
request = FailedRequestWithUrlMaker.create(config, request);
|
request = FailedRequestWithUrlMaker.create(config, request);
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ package io.opentelemetry.javaagent.instrumentation.reactornetty.v1_0;
|
||||||
import static io.opentelemetry.javaagent.instrumentation.reactornetty.v1_0.ReactorNettySingletons.instrumenter;
|
import static io.opentelemetry.javaagent.instrumentation.reactornetty.v1_0.ReactorNettySingletons.instrumenter;
|
||||||
|
|
||||||
import io.opentelemetry.context.Context;
|
import io.opentelemetry.context.Context;
|
||||||
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientResendCount;
|
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientRequestResendCount;
|
||||||
import io.opentelemetry.instrumentation.api.internal.InstrumenterUtil;
|
import io.opentelemetry.instrumentation.api.internal.InstrumenterUtil;
|
||||||
import io.opentelemetry.instrumentation.api.internal.Timer;
|
import io.opentelemetry.instrumentation.api.internal.Timer;
|
||||||
import io.opentelemetry.instrumentation.api.util.VirtualField;
|
import io.opentelemetry.instrumentation.api.util.VirtualField;
|
||||||
|
|
@ -36,7 +36,7 @@ final class InstrumentationContexts {
|
||||||
private final Queue<RequestAndContext> clientContexts = new LinkedBlockingQueue<>();
|
private final Queue<RequestAndContext> clientContexts = new LinkedBlockingQueue<>();
|
||||||
|
|
||||||
void initialize(Context parentContext) {
|
void initialize(Context parentContext) {
|
||||||
Context parentContextWithResends = HttpClientResendCount.initialize(parentContext);
|
Context parentContextWithResends = HttpClientRequestResendCount.initialize(parentContext);
|
||||||
// make sure initialization happens only once
|
// make sure initialization happens only once
|
||||||
if (parentContextUpdater.compareAndSet(this, null, parentContextWithResends)) {
|
if (parentContextUpdater.compareAndSet(this, null, parentContextWithResends)) {
|
||||||
timer = Timer.start();
|
timer = Timer.start();
|
||||||
|
|
|
||||||
|
|
@ -279,7 +279,7 @@ public abstract class AbstractHttpClientTest<REQUEST> implements HttpClientTypeA
|
||||||
|
|
||||||
if (options.isLowLevelInstrumentation()) {
|
if (options.isLowLevelInstrumentation()) {
|
||||||
testing.waitAndAssertSortedTraces(
|
testing.waitAndAssertSortedTraces(
|
||||||
comparingRootSpanAttribute(SemanticAttributes.HTTP_RESEND_COUNT),
|
comparingRootSpanAttribute(HttpAttributes.HTTP_REQUEST_RESEND_COUNT),
|
||||||
trace -> {
|
trace -> {
|
||||||
trace.hasSpansSatisfyingExactly(
|
trace.hasSpansSatisfyingExactly(
|
||||||
span ->
|
span ->
|
||||||
|
|
@ -319,7 +319,7 @@ public abstract class AbstractHttpClientTest<REQUEST> implements HttpClientTypeA
|
||||||
|
|
||||||
if (options.isLowLevelInstrumentation()) {
|
if (options.isLowLevelInstrumentation()) {
|
||||||
testing.waitAndAssertSortedTraces(
|
testing.waitAndAssertSortedTraces(
|
||||||
comparingRootSpanAttribute(SemanticAttributes.HTTP_RESEND_COUNT),
|
comparingRootSpanAttribute(HttpAttributes.HTTP_REQUEST_RESEND_COUNT),
|
||||||
trace -> {
|
trace -> {
|
||||||
trace.hasSpansSatisfyingExactly(
|
trace.hasSpansSatisfyingExactly(
|
||||||
span ->
|
span ->
|
||||||
|
|
@ -378,7 +378,7 @@ public abstract class AbstractHttpClientTest<REQUEST> implements HttpClientTypeA
|
||||||
|
|
||||||
if (options.isLowLevelInstrumentation()) {
|
if (options.isLowLevelInstrumentation()) {
|
||||||
testing.waitAndAssertSortedTraces(
|
testing.waitAndAssertSortedTraces(
|
||||||
comparingRootSpanAttribute(SemanticAttributes.HTTP_RESEND_COUNT),
|
comparingRootSpanAttribute(HttpAttributes.HTTP_REQUEST_RESEND_COUNT),
|
||||||
IntStream.range(0, options.getMaxRedirects())
|
IntStream.range(0, options.getMaxRedirects())
|
||||||
.mapToObj(i -> makeCircularRedirectAssertForLolLevelTrace(uri, method, i))
|
.mapToObj(i -> makeCircularRedirectAssertForLolLevelTrace(uri, method, i))
|
||||||
.collect(Collectors.toList()));
|
.collect(Collectors.toList()));
|
||||||
|
|
@ -425,7 +425,7 @@ public abstract class AbstractHttpClientTest<REQUEST> implements HttpClientTypeA
|
||||||
|
|
||||||
if (options.isLowLevelInstrumentation()) {
|
if (options.isLowLevelInstrumentation()) {
|
||||||
testing.waitAndAssertSortedTraces(
|
testing.waitAndAssertSortedTraces(
|
||||||
comparingRootSpanAttribute(SemanticAttributes.HTTP_RESEND_COUNT),
|
comparingRootSpanAttribute(HttpAttributes.HTTP_REQUEST_RESEND_COUNT),
|
||||||
trace -> {
|
trace -> {
|
||||||
trace.hasSpansSatisfyingExactly(
|
trace.hasSpansSatisfyingExactly(
|
||||||
span ->
|
span ->
|
||||||
|
|
@ -1123,9 +1123,9 @@ public abstract class AbstractHttpClientTest<REQUEST> implements HttpClientTypeA
|
||||||
|
|
||||||
if (resendCount != null) {
|
if (resendCount != null) {
|
||||||
assertThat(attrs)
|
assertThat(attrs)
|
||||||
.containsEntry(SemanticAttributes.HTTP_RESEND_COUNT, (long) resendCount);
|
.containsEntry(HttpAttributes.HTTP_REQUEST_RESEND_COUNT, (long) resendCount);
|
||||||
} else {
|
} else {
|
||||||
assertThat(attrs).doesNotContainKey(SemanticAttributes.HTTP_RESEND_COUNT);
|
assertThat(attrs).doesNotContainKey(HttpAttributes.HTTP_REQUEST_RESEND_COUNT);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue