Added missing new trace headers
without this change for kafka the new message headers are not passed with this change we're finally fixing this fixes #529
This commit is contained in:
@@ -26,6 +26,7 @@ import java.util.Properties;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.env.EnvironmentPostProcessor;
|
||||
import org.springframework.cloud.sleuth.Span;
|
||||
import org.springframework.cloud.sleuth.instrument.messaging.TraceMessageHeaders;
|
||||
import org.springframework.core.env.ConfigurableEnvironment;
|
||||
import org.springframework.core.env.MapPropertySource;
|
||||
import org.springframework.core.env.MutablePropertySources;
|
||||
@@ -48,7 +49,9 @@ public class StreamEnvironmentPostProcessor implements EnvironmentPostProcessor
|
||||
private static final String PROPERTY_SOURCE_NAME = "defaultProperties";
|
||||
static String[] headers = new String[] { Span.SPAN_ID_NAME,
|
||||
Span.TRACE_ID_NAME, Span.PARENT_ID_NAME, Span.PROCESS_ID_NAME,
|
||||
Span.SAMPLED_NAME, Span.SPAN_NAME_NAME };
|
||||
Span.SAMPLED_NAME, Span.SPAN_NAME_NAME, TraceMessageHeaders.SPAN_ID_NAME,
|
||||
TraceMessageHeaders.TRACE_ID_NAME, TraceMessageHeaders.PARENT_ID_NAME, TraceMessageHeaders.PROCESS_ID_NAME,
|
||||
TraceMessageHeaders.SAMPLED_NAME, TraceMessageHeaders.SPAN_NAME_NAME };
|
||||
|
||||
@Override
|
||||
public void postProcessEnvironment(ConfigurableEnvironment environment,
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.junit.Test;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.test.util.EnvironmentTestUtils;
|
||||
import org.springframework.cloud.sleuth.Span;
|
||||
import org.springframework.cloud.sleuth.instrument.messaging.TraceMessageHeaders;
|
||||
import org.springframework.core.env.ConfigurableEnvironment;
|
||||
import org.springframework.core.env.StandardEnvironment;
|
||||
|
||||
@@ -45,6 +46,13 @@ public class StreamEnvironmentPostProcessorTests {
|
||||
.isEqualTo(Span.SPAN_ID_NAME);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void should_append_new_tracing_headers() {
|
||||
postProcess();
|
||||
assertThat(this.environment.getProperty("spring.cloud.stream.test.binder.headers[6]"))
|
||||
.isEqualTo(TraceMessageHeaders.SPAN_ID_NAME);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void should_append_tracing_headers_to_existing_ones() {
|
||||
EnvironmentTestUtils.addEnvironment(this.environment, "spring.cloud.stream.test.binder.headers[0]=X-Custom",
|
||||
|
||||
Reference in New Issue
Block a user