use of com.navercorp.pinpoint.thrift.dto.TSpanEvent in project pinpoint by naver.
the class RandomTSpan method randomTSpanEvent.
public TSpanEvent randomTSpanEvent(short sequence) {
TSpanEvent tSpanEvent = new TSpanEvent();
// @deprecated
// tSpanEvent.setSpanId();
tSpanEvent.setSequence(sequence);
tSpanEvent.setStartElapsed(RandomUtils.nextInt(0, 1000));
tSpanEvent.setEndElapsed(RandomUtils.nextInt(0, 1000));
tSpanEvent.setRpc(RandomStringUtils.random(10));
// Database (2000 ~ 2899)
tSpanEvent.setServiceType((short) RandomUtils.nextInt(2000, 2889));
tSpanEvent.setEndPoint(RandomStringUtils.random(10));
List<TAnnotation> tAnnotationList = randomTAnnotationList();
if (CollectionUtils.isNotEmpty(tAnnotationList)) {
tSpanEvent.setAnnotations(tAnnotationList);
}
tSpanEvent.setDepth(RandomUtils.nextInt(0, 256));
tSpanEvent.setNextSpanId(random.nextLong());
tSpanEvent.setDestinationId(RandomStringUtils.random(20));
tSpanEvent.setApiId(RandomUtils.nextInt(0, 65535));
tSpanEvent.setAsyncId(randomNegative(RandomUtils.nextInt(0, 10)));
tSpanEvent.setNextAsyncId(random.nextInt());
tSpanEvent.setAsyncSequence((short) RandomUtils.nextInt(0, Short.MAX_VALUE));
if (random.nextBoolean()) {
TIntStringValue exceptionInfo = new TIntStringValue();
exceptionInfo.setIntValue(RandomUtils.nextInt(0, 5000));
exceptionInfo.setStringValue(RandomStringUtils.random(100));
tSpanEvent.setExceptionInfo(exceptionInfo);
}
return tSpanEvent;
}
use of com.navercorp.pinpoint.thrift.dto.TSpanEvent in project pinpoint by naver.
the class SpanFactoryAssert method assertSpan.
public void assertSpan(TSpan tSpan, SpanBo spanBo) {
Assert.assertEquals(tSpan.getAgentId(), spanBo.getAgentId());
Assert.assertEquals(tSpan.getApplicationName(), spanBo.getApplicationId());
Assert.assertEquals(tSpan.getAgentStartTime(), spanBo.getAgentStartTime());
TransactionId transactionId = spanBo.getTransactionId();
ByteBuffer byteBuffer = TransactionIdUtils.formatByteBuffer(transactionId.getAgentId(), transactionId.getAgentStartTime(), transactionId.getTransactionSequence());
Assert.assertEquals(ByteBuffer.wrap(tSpan.getTransactionId()), byteBuffer);
Assert.assertEquals(tSpan.getSpanId(), spanBo.getSpanId());
Assert.assertEquals(tSpan.getParentSpanId(), spanBo.getParentSpanId());
Assert.assertEquals(tSpan.getStartTime(), spanBo.getStartTime());
Assert.assertEquals(tSpan.getElapsed(), spanBo.getElapsed());
Assert.assertEquals(tSpan.getElapsed(), spanBo.getElapsed());
Assert.assertEquals(tSpan.getRpc(), spanBo.getRpc());
Assert.assertEquals(tSpan.getServiceType(), spanBo.getServiceType());
Assert.assertEquals(tSpan.getEndPoint(), spanBo.getEndPoint());
Assert.assertEquals(tSpan.getRemoteAddr(), spanBo.getRemoteAddr());
assertAnnotation(tSpan.getAnnotations(), spanBo.getAnnotationBoList());
Assert.assertEquals(tSpan.getFlag(), spanBo.getFlag());
Assert.assertEquals(tSpan.getErr(), spanBo.getErrCode());
Assert.assertEquals(tSpan.getParentApplicationName(), spanBo.getParentApplicationId());
Assert.assertEquals(tSpan.getParentApplicationType(), spanBo.getParentApplicationServiceType());
Assert.assertEquals(tSpan.getAcceptorHost(), spanBo.getAcceptorHost());
Assert.assertEquals(tSpan.getApiId(), spanBo.getApiId());
Assert.assertEquals(tSpan.getApplicationServiceType(), spanBo.getApplicationServiceType());
List<SpanEventBo> spanEventBoList = spanBo.getSpanEventBoList();
List<TSpanEvent> spanEventList = tSpan.getSpanEventList();
assertSpanEventList(spanEventBoList, spanEventList);
boolean hasException = tSpan.getExceptionInfo() != null;
Assert.assertEquals(hasException, spanBo.hasException());
if (hasException) {
Assert.assertEquals(tSpan.getExceptionInfo().getIntValue(), spanBo.getExceptionId());
Assert.assertEquals(tSpan.getExceptionInfo().getStringValue(), spanBo.getExceptionMessage());
}
Assert.assertEquals(tSpan.getLoggingTransactionInfo(), spanBo.getLoggingTransactionInfo());
}
use of com.navercorp.pinpoint.thrift.dto.TSpanEvent in project pinpoint by naver.
the class SpanFactoryAssert method assertSpanChunk.
public void assertSpanChunk(TSpanChunk tSpanChunk, SpanChunkBo spanChunkBo) {
Assert.assertEquals(tSpanChunk.getAgentId(), spanChunkBo.getAgentId());
Assert.assertEquals(tSpanChunk.getApplicationName(), spanChunkBo.getApplicationId());
Assert.assertEquals(tSpanChunk.getAgentStartTime(), spanChunkBo.getAgentStartTime());
TransactionId transactionId = spanChunkBo.getTransactionId();
ByteBuffer byteBuffer = TransactionIdUtils.formatByteBuffer(transactionId.getAgentId(), transactionId.getAgentStartTime(), transactionId.getTransactionSequence());
Assert.assertEquals(ByteBuffer.wrap(tSpanChunk.getTransactionId()), byteBuffer);
Assert.assertEquals(tSpanChunk.getSpanId(), spanChunkBo.getSpanId());
Assert.assertEquals(tSpanChunk.getServiceType(), spanChunkBo.getServiceType());
Assert.assertEquals(tSpanChunk.getEndPoint(), spanChunkBo.getEndPoint());
Assert.assertEquals(tSpanChunk.getApplicationServiceType(), spanChunkBo.getApplicationServiceType());
List<SpanEventBo> spanEventBoList = spanChunkBo.getSpanEventBoList();
List<TSpanEvent> spanEventList = tSpanChunk.getSpanEventList();
assertSpanEventList(spanEventBoList, spanEventList);
}
use of com.navercorp.pinpoint.thrift.dto.TSpanEvent 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.TSpanEvent in project pinpoint by naver.
the class SpanEncoderTest method randomComplexSpan.
public SpanBo randomComplexSpan() {
TSpan tSpan = randomTSpan.randomTSpan();
TSpanEvent tSpanEvent1 = randomTSpan.randomTSpanEvent((short) 1);
TSpanEvent tSpanEvent2 = randomTSpan.randomTSpanEvent((short) 2);
TSpanEvent tSpanEvent3 = randomTSpan.randomTSpanEvent((short) 3);
TSpanEvent tSpanEvent4 = randomTSpan.randomTSpanEvent((short) 5);
tSpan.setSpanEventList(Lists.newArrayList(tSpanEvent1, tSpanEvent2, tSpanEvent3, tSpanEvent4));
return spanFactory.buildSpanBo(tSpan);
}
Aggregations