[강운덕] [LUCYSUS-1744] call tree 객체 이동.

git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-web/trunk@774 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
Woonduk Kang
2012-10-11 10:18:58 +00:00
parent 32806ce6fc
commit 7be02c0e65
14 changed files with 288 additions and 239 deletions
@@ -0,0 +1,58 @@
package com.nhn.hippo.web.path;
import com.profiler.common.dto.thrift.Endpoint;
import com.profiler.common.dto.thrift.Span;
import com.profiler.context.TraceID;
import org.junit.Test;
import java.text.SimpleDateFormat;
import java.util.UUID;
/**
*
*/
public class PathTest {
int index;
SimpleDateFormat format = new SimpleDateFormat("ss.SSS");
@Test
public void testPath() {
//root -> next1 -> next2
// > - -> next3
// Span root = root();
// printSpan("root", root);
//
// Span next1 = createNextSpan(root);
// printSpan("next1", next1);
//
// Span next2 = createNextSpan(next1);
// printSpan("next2", next2);
//
// Span next3 = createNextSpan(next1);
// printSpan("next3", next3);
}
public void printSpan(String msg, Span span) {
// System.out.println(msg + " id:" + span.getSpanID() + " pid:" + span.getParentSpanId() + " time:" + format.format(new Date(span.getTimestamp())));
System.out.println(msg + " id:" + span.getSpanID() + " pid:" + span.getParentSpanId() + " time:" + span.getTimestamp());
}
// private Span root() {
// TraceID traceID = TraceID.newTraceId();
// UUID uuid = traceID.getId();
// Span root = new Span("test", System.currentTimeMillis(), uuid.getMostSignificantBits(), uuid.getLeastSignificantBits(), Integer.toString(index++), "serviceName", traceID.getSpanId(), null, null, "http:ip:23");
// root.setParentSpanId(traceID.getParentSpanId());
// return root;
// }
// private Span createNextSpan(Span span) {
// UUID uuid = new UUID(span.getMostTraceID(), span.getLeastTraceID());
// TraceID traceID = new TraceID(uuid, span.getParentSpanId(), span.getSpanID(), true, 0);
// TraceID nextTraceId = traceID.getNextTraceId();
// Span next = new Span("test", System.currentTimeMillis(), span.getMostTraceID(), span.getLeastTraceID(), Integer.toString(index++), "serviceName", nextTraceId.getSpanId(), null, null, "http:ip:23");
// next.setParentSpanId(nextTraceId.getParentSpanId());
// return next;
// }
}