latest brave
This commit is contained in:
@@ -34,7 +34,8 @@
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<spring-boot.version>2.1.10.RELEASE</spring-boot.version>
|
||||
<brave.version>5.8.0</brave.version>
|
||||
<spring-boot.version>2.3.0.BUILD-SNAPSHOT</spring-boot.version>
|
||||
<brave.version>5.9.2</brave.version>
|
||||
<okhttp.version>3.11.0</okhttp.version>
|
||||
</properties>
|
||||
|
||||
|
||||
2
pom.xml
2
pom.xml
@@ -264,7 +264,7 @@
|
||||
<spring-cloud-stream.version>Fishtown.SR4</spring-cloud-stream.version>
|
||||
<spring-cloud-netflix.version>2.1.5.BUILD-SNAPSHOT</spring-cloud-netflix.version>
|
||||
<spring-cloud-openfeign.version>2.1.5.BUILD-SNAPSHOT</spring-cloud-openfeign.version>
|
||||
<brave.version>5.8.0</brave.version>
|
||||
<brave.version>5.9.2</brave.version>
|
||||
<spring-security-boot-autoconfigure.version>2.1.2.RELEASE
|
||||
</spring-security-boot-autoconfigure.version>
|
||||
|
||||
|
||||
@@ -32,13 +32,11 @@ import javax.jms.XAConnectionFactory;
|
||||
import javax.resource.spi.ResourceAdapter;
|
||||
|
||||
import brave.Tracing;
|
||||
import brave.internal.HexCodec;
|
||||
import brave.propagation.CurrentTraceContext;
|
||||
import brave.propagation.TraceContext;
|
||||
import org.apache.activemq.ra.ActiveMQActivationSpec;
|
||||
import org.apache.activemq.ra.ActiveMQResourceAdapter;
|
||||
import org.junit.Test;
|
||||
import zipkin2.Annotation;
|
||||
import zipkin2.Span;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -281,8 +279,6 @@ public class JmsTracingConfigurationTest {
|
||||
EurekaClientAutoConfiguration.class })
|
||||
class JmsTestTracingConfiguration {
|
||||
|
||||
static final String CONTEXT_LEAK = "context.leak";
|
||||
|
||||
/**
|
||||
* When testing servers or asynchronous clients, spans are reported on a worker
|
||||
* thread. In order to read them on the main thread, we use a concurrent queue. As
|
||||
@@ -304,34 +300,14 @@ class JmsTestTracingConfiguration {
|
||||
return () -> {
|
||||
Span result = this.spans.poll(3, TimeUnit.SECONDS);
|
||||
assertThat(result).withFailMessage("Span was not reported").isNotNull();
|
||||
assertThat(result.annotations()).extracting(Annotation::value)
|
||||
.doesNotContain(CONTEXT_LEAK);
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
@Bean
|
||||
Tracing tracing(CurrentTraceContext currentTraceContext) {
|
||||
return Tracing.newBuilder().spanReporter(s -> {
|
||||
// make sure the context was cleared prior to finish.. no leaks!
|
||||
TraceContext current = currentTraceContext.get();
|
||||
boolean contextLeak = false;
|
||||
if (current != null) {
|
||||
// add annotation in addition to throwing, in case we are off the main
|
||||
// thread
|
||||
if (HexCodec.toLowerHex(current.spanId()).equals(s.id())) {
|
||||
s = s.toBuilder().addAnnotation(s.timestampAsLong(), CONTEXT_LEAK)
|
||||
.build();
|
||||
contextLeak = true;
|
||||
}
|
||||
}
|
||||
this.spans.add(s);
|
||||
// throw so that we can see the path to the code that leaked the context
|
||||
if (contextLeak) {
|
||||
throw new AssertionError(
|
||||
CONTEXT_LEAK + " on " + Thread.currentThread().getName());
|
||||
}
|
||||
}).currentTraceContext(currentTraceContext).build();
|
||||
return Tracing.newBuilder().spanReporter(spans::add)
|
||||
.currentTraceContext(currentTraceContext).build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
<dependency>
|
||||
<groupId>io.zipkin.zipkin2</groupId>
|
||||
<artifactId>zipkin</artifactId>
|
||||
<version>2.17.0</version>
|
||||
<version>2.19.3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
Reference in New Issue
Block a user