mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-21 02:35:53 +10:00
[강운덕] [LUCYSUS-1744] next spanid를 획득할때 보모의 spanId와 parentSpanId를 둘다 체크해서 안겹치게 수정.
git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-tomcat-profiler/trunk@1211 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
@@ -6,7 +6,7 @@ public class SpanID {
|
||||
|
||||
public static final int NULL = -1;
|
||||
|
||||
private static Random seed = new Random();
|
||||
private static final Random seed = new Random();
|
||||
|
||||
public static int newSpanID() {
|
||||
int id = seed.nextInt();
|
||||
@@ -16,9 +16,9 @@ public class SpanID {
|
||||
return id;
|
||||
}
|
||||
|
||||
public static int nextSpanID(long parentId) {
|
||||
public static int nextSpanID(int spanId, int parentSpanId) {
|
||||
int newId = newSpanID();
|
||||
while (newId == parentId) {
|
||||
while (newId == spanId || newId == parentSpanId) {
|
||||
newId = newSpanID();
|
||||
}
|
||||
return newId;
|
||||
|
||||
@@ -15,7 +15,7 @@ public class TraceID {
|
||||
}
|
||||
|
||||
public TraceID getNextTraceId() {
|
||||
return new TraceID(id, spanId, SpanID.nextSpanID(spanId), sampled, flags);
|
||||
return new TraceID(id, spanId, SpanID.nextSpanID(spanId, parentSpanId), sampled, flags);
|
||||
}
|
||||
|
||||
public TraceID(UUID id, int parentSpanId, int spanId, boolean sampled, short flags) {
|
||||
|
||||
Reference in New Issue
Block a user