Adds the ability to configure things needed by stackdriver
We will eventually need to change the encoder to use their format. Also, stackdriver does not support shared spans.
This commit is contained in:
4
pom.xml
4
pom.xml
@@ -272,9 +272,9 @@
|
||||
<spring-cloud-stream.version>Elmhurst.BUILD-SNAPSHOT</spring-cloud-stream.version>
|
||||
<spring-cloud-netflix.version>2.0.0.BUILD-SNAPSHOT</spring-cloud-netflix.version>
|
||||
<spring-cloud-openfeign.version>2.0.0.BUILD-SNAPSHOT</spring-cloud-openfeign.version>
|
||||
<brave.version>4.18.0</brave.version>
|
||||
<brave.version>4.18.1</brave.version>
|
||||
<!-- Version set until zipkin-junit gets defined in Brave BOM -->
|
||||
<zipkin.version>2.5.1</zipkin.version>
|
||||
<zipkin.version>2.6.1</zipkin.version>
|
||||
<spring-security-boot-autoconfigure.version>2.0.0.RELEASE</spring-security-boot-autoconfigure.version>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -34,6 +34,9 @@ public class SleuthProperties {
|
||||
/** When true, generate 128-bit trace IDs instead of 64-bit ones. */
|
||||
private boolean traceId128 = false;
|
||||
|
||||
/** True means the tracing system supports sharing a span ID between a client and server. */
|
||||
private boolean supportsJoin = true;
|
||||
|
||||
/**
|
||||
* List of baggage key names that should be propagated out of process.
|
||||
* These keys will be prefixed with `baggage` before the actual key.
|
||||
@@ -70,6 +73,14 @@ public class SleuthProperties {
|
||||
this.traceId128 = traceId128;
|
||||
}
|
||||
|
||||
public boolean isSupportsJoin() {
|
||||
return this.supportsJoin;
|
||||
}
|
||||
|
||||
public void setSupportsJoin(boolean supportsJoin) {
|
||||
this.supportsJoin = supportsJoin;
|
||||
}
|
||||
|
||||
public List<String> getBaggageKeys() {
|
||||
return this.baggageKeys;
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@ public class TraceAutoConfiguration {
|
||||
.currentTraceContext(currentTraceContext)
|
||||
.spanReporter(adjustedReporter(reporter))
|
||||
.traceId128Bit(sleuthProperties.isTraceId128())
|
||||
.supportsJoin(sleuthProperties.isSupportsJoin())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
import brave.sampler.Sampler;
|
||||
import zipkin2.Span;
|
||||
import zipkin2.codec.BytesEncoder;
|
||||
import zipkin2.reporter.AsyncReporter;
|
||||
import zipkin2.reporter.InMemoryReporterMetrics;
|
||||
import zipkin2.reporter.Reporter;
|
||||
@@ -78,13 +79,20 @@ public class ZipkinAutoConfiguration {
|
||||
public Reporter<Span> reporter(
|
||||
ReporterMetrics reporterMetrics,
|
||||
ZipkinProperties zipkin,
|
||||
Sender sender
|
||||
Sender sender,
|
||||
BytesEncoder<Span> spanBytesEncoder
|
||||
) {
|
||||
return AsyncReporter.builder(sender)
|
||||
.queuedMaxSpans(1000) // historical constraint. Note: AsyncReporter supports memory bounds
|
||||
.messageTimeout(zipkin.getMessageTimeout(), TimeUnit.SECONDS)
|
||||
.metrics(reporterMetrics)
|
||||
.build(zipkin.getEncoder());
|
||||
.build(spanBytesEncoder);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public BytesEncoder<Span> spanBytesEncoder(ZipkinProperties zipkinProperties) {
|
||||
return zipkinProperties.getEncoder();
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
Reference in New Issue
Block a user