[강운덕] [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:
Woonduk Kang
2013-02-18 01:43:10 +00:00
parent 0caf0d3b6d
commit e6aa1fe3d0
2 changed files with 4 additions and 4 deletions
@@ -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) {