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:
Adrian Cole
2018-03-20 16:35:19 +08:00
committed by Adrian Cole
parent ad2b9dd39d
commit 3649852ce9
4 changed files with 24 additions and 4 deletions

View File

@@ -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