[#106] Converted UUID to Long

- Changed Random instantiation to a shared Random
- Changed the name of the converter
- Changed generator into random
- Span id is now non-nullable.
    - it gets generated in the http filter if it's not there
    - it's generated in the spring-integration channels if it wasn't set
This commit is contained in:
Marcin Grzejszczak
2016-01-18 14:38:09 +01:00
parent 483737fdc1
commit 82ed9f78a1
68 changed files with 685 additions and 888 deletions

View File

@@ -32,11 +32,12 @@ public class SampleBackground {
@Autowired
private TraceManager traceManager;
@Autowired
private Random random;
@SneakyThrows
@Async
public void background() {
final Random random = new Random();
int millis = random.nextInt(1000);
Thread.sleep(millis);
this.traceManager.addAnnotation("background-sleep-millis", String.valueOf(millis));

View File

@@ -27,11 +27,11 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.util.JdkIdGenerator;
import sample.SampleMessagingApplication;
import tools.AbstractIntegrationTest;
import java.util.Collection;
import java.util.Random;
import static org.assertj.core.api.BDDAssertions.then;
@@ -52,7 +52,7 @@ public class MessagingApplicationTests extends AbstractIntegrationTest {
@Test
public void should_propagate_spans_for_messaging() {
String traceId = new JdkIdGenerator().generateId().toString();
long traceId = new Random().nextLong();
await().until(httpMessageWithTraceIdInHeadersIsSuccessfullySent(sampleAppUrl + "/", traceId));
@@ -63,7 +63,7 @@ public class MessagingApplicationTests extends AbstractIntegrationTest {
@Test
public void should_propagate_spans_for_messaging_with_async() {
String traceId = new JdkIdGenerator().generateId().toString();
long traceId = new Random().nextLong();
await().until(httpMessageWithTraceIdInHeadersIsSuccessfullySent(sampleAppUrl + "/xform", traceId));
@@ -80,8 +80,8 @@ public class MessagingApplicationTests extends AbstractIntegrationTest {
.anyMatch(b -> b.key.equals(binaryAnnotationKey))).isTrue();
}
private void thenAllSpansHaveTraceIdEqualTo(String traceId) {
then(integrationTestSpanCollector.hashedSpans.stream().allMatch(span -> span.traceId == zipkinHashedTraceId(traceId))).isTrue();
private void thenAllSpansHaveTraceIdEqualTo(long traceId) {
then(this.integrationTestSpanCollector.hashedSpans.stream().allMatch(span -> span.traceId == traceId)).isTrue();
}
@Configuration