use of com.navercorp.pinpoint.thrift.dto.TSpan in project pinpoint by naver.
the class SpanStreamUDPSenderTest method createSpanEventList.
private List<SpanEvent> createSpanEventList(int size) throws InterruptedException {
// Span span = new SpanBo(new TSpan());
Span span = new Span();
List<SpanEvent> spanEventList = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
SpanEvent spanEvent = new SpanEvent(span);
spanEvent.markStartTime();
Thread.sleep(1);
spanEvent.markAfterTime();
spanEventList.add(spanEvent);
}
return spanEventList;
}
use of com.navercorp.pinpoint.thrift.dto.TSpan in project pinpoint by naver.
the class SpanFactoryTest method testNewSpanBo.
@Test
public void testNewSpanBo() throws Exception {
TSpan tSpan = random.randomTSpan();
SpanBo spanBo = spanFactory.newSpanBo(tSpan);
spanFactoryAssert.assertSpan(tSpan, spanBo);
}
use of com.navercorp.pinpoint.thrift.dto.TSpan in project pinpoint by naver.
the class RandomTSpan method randomTSpan.
public TSpan randomTSpan() {
final TSpan tSpan = new TSpan();
tSpan.setAgentId("agentId");
tSpan.setApplicationName("appName");
tSpan.setAgentStartTime(System.currentTimeMillis());
tSpan.setTransactionId(TransactionIdUtils.formatByteBuffer("agent", System.currentTimeMillis(), RandomUtils.nextLong(0, Long.MAX_VALUE)));
tSpan.setSpanId(random.nextLong());
tSpan.setParentSpanId(RandomUtils.nextInt(0, 100000));
tSpan.setStartTime(System.currentTimeMillis() + RandomUtils.nextInt(0, 1000));
tSpan.setElapsed(RandomUtils.nextInt(0, 2000));
tSpan.setRpc(RandomStringUtils.random(10));
tSpan.setServiceType(randomServerServiceType());
tSpan.setEndPoint(RandomStringUtils.random(20));
tSpan.setRemoteAddr(RandomStringUtils.random(20));
List<TAnnotation> tAnnotationList = randomTAnnotationList();
if (CollectionUtils.isNotEmpty(tAnnotationList)) {
tSpan.setAnnotations(tAnnotationList);
}
tSpan.setFlag((short) RandomUtils.nextInt(0, 4));
tSpan.setErr((short) RandomUtils.nextInt(0, 2));
// tSpan.setSpanEventList()
tSpan.setParentApplicationName("parentApp");
tSpan.setParentApplicationType(randomServerServiceType());
tSpan.setAcceptorHost("acceptHost");
tSpan.setApiId(RandomUtils.nextInt(0, 5000));
if (random.nextBoolean()) {
tSpan.setApplicationServiceType(randomServerServiceType());
} else {
tSpan.setApplicationServiceType(tSpan.getServiceType());
}
if (random.nextBoolean()) {
TIntStringValue exceptionInfo = new TIntStringValue();
exceptionInfo.setIntValue(RandomUtils.nextInt(0, 5000));
exceptionInfo.setStringValue(RandomStringUtils.random(100));
tSpan.setExceptionInfo(exceptionInfo);
}
tSpan.setLoggingTransactionInfo((byte) RandomUtils.nextInt(0, 256));
return tSpan;
}
use of com.navercorp.pinpoint.thrift.dto.TSpan in project pinpoint by naver.
the class SpanFactoryTest method testBuildSpanBo.
@Test
public void testBuildSpanBo() throws Exception {
TSpan tSpan = random.randomTSpan();
TSpanEvent tSpanEvent1 = random.randomTSpanEvent((short) 0);
TSpanEvent tSpanEvent2 = random.randomTSpanEvent((short) 1);
TSpanEvent tSpanEvent3 = random.randomTSpanEvent((short) 5);
TSpanEvent tSpanEvent4 = random.randomTSpanEvent((short) 2);
tSpan.setSpanEventList(Lists.newArrayList(tSpanEvent1, tSpanEvent2, tSpanEvent3, tSpanEvent4));
SpanBo spanBo = spanFactory.buildSpanBo(tSpan);
spanFactoryAssert.assertSpan(tSpan, spanBo);
}
use of com.navercorp.pinpoint.thrift.dto.TSpan in project pinpoint by naver.
the class SpanFactoryTest method testTransactionId_skip_agentId.
@Test
public void testTransactionId_skip_agentId() throws Exception {
TSpan tSpan = new TSpan();
tSpan.setAgentId("agentId");
byte[] transactionIdBytes = TransactionIdUtils.formatBytes(null, 1, 2);
tSpan.setTransactionId(transactionIdBytes);
SpanBo spanBo = spanFactory.newSpanBo(tSpan);
TransactionId transactionId = spanBo.getTransactionId();
Assert.assertEquals(transactionId.getAgentId(), "agentId");
Assert.assertEquals(transactionId.getAgentStartTime(), 1);
Assert.assertEquals(transactionId.getTransactionSequence(), 2);
}
Aggregations