Use a ThreadLocalRandom generator for span IDs instead of nanoTime
MODIFY
.gitignore
.gitignore
# Maven #
#########
target
+/target
+**/target/
+**/dependency-reduced-pom.xml
# Gradle #
#########
@@ -31,6 +34,8 @@ Thumbs.db
#################
/.idea
*.iml
+*.ipr
+*.iws
# Visual Studio Code #
######################
@@ -39,10 +44,5 @@ Thumbs.db
# Others #
##########
/logs/*
-
-
-
-/target
-**/target/
-**/dependency-reduced-pom.xml
/bin
+/out

MODIFY
dd-trace/src/main/java/com/datadoghq/trace/DDTracer.java
dd-trace/src/main/java/com/datadoghq/trace/DDTracer.java
@@ -5,7 +5,6 @@ import com.datadoghq.trace.propagation.Codec;
import com.datadoghq.trace.propagation.HTTPCodec;
import com.datadoghq.trace.sampling.AllSampler;
import com.datadoghq.trace.sampling.Sampler;
-import com.datadoghq.trace.util.Clock;
import com.datadoghq.trace.writer.LoggingWriter;
import com.datadoghq.trace.writer.Writer;
import io.opentracing.ActiveSpan;
@@ -14,7 +13,13 @@ import io.opentracing.BaseSpan;
import io.opentracing.SpanContext;
import io.opentracing.propagation.Format;
import io.opentracing.util.ThreadLocalActiveSpanSource;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Queue;
+import java.util.concurrent.ThreadLocalRandom;
import lombok.extern.slf4j.Slf4j;
/** DDTracer makes it easy to send traces and span to DD using the OpenTracing integration. */
@@ -285,7 +290,7 @@ public class DDTracer extends ThreadLocalActiveSpanSource implements io.opentrac
}
private long generateNewId() {
- return Clock.currentNanoTicks();
+ return ThreadLocalRandom.current().nextLong();
}
/**

Use a ThreadLocalRandom generator for span IDs instead of nanoTime