Brought back the 128 bit property setting

This commit is contained in:
Marcin Grzejszczak
2018-03-07 20:18:36 -05:00
parent c159949484
commit a6e23231e1
2 changed files with 15 additions and 2 deletions

View File

@@ -31,6 +31,9 @@ public class SleuthProperties {
private boolean enabled = true;
/** When true, generate 128-bit trace IDs instead of 64-bit ones. */
private boolean traceId128 = false;
/**
* List of baggage key names that should be propagated out of process.
* These keys will be prefixed with `baggage` before the actual key.
@@ -59,6 +62,14 @@ public class SleuthProperties {
this.enabled = enabled;
}
public boolean isTraceId128() {
return this.traceId128;
}
public void setTraceId128(boolean traceId128) {
this.traceId128 = traceId128;
}
public List<String> getBaggageKeys() {
return this.baggageKeys;
}

View File

@@ -66,13 +66,15 @@ public class TraceAutoConfiguration {
Propagation.Factory factory,
CurrentTraceContext currentTraceContext,
Reporter<zipkin2.Span> reporter,
Sampler sampler) {
Sampler sampler, SleuthProperties sleuthProperties) {
return Tracing.newBuilder()
.sampler(sampler)
.localServiceName(serviceName)
.propagationFactory(factory)
.currentTraceContext(currentTraceContext)
.spanReporter(adjustedReporter(reporter)).build();
.spanReporter(adjustedReporter(reporter))
.traceId128Bit(sleuthProperties.isTraceId128())
.build();
}
private Reporter<zipkin2.Span> adjustedReporter(Reporter<zipkin2.Span> delegate) {