use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.
the class SpanEventBitFieldTest method testSequence_add1_next.
@Test
public void testSequence_add1_next() throws Exception {
SpanEventBo prev = new SpanEventBo();
SpanEventBo current = new SpanEventBo();
prev.setSequence((short) 10);
current.setSequence((short) 11);
SpanEventBitField bitField = SpanEventBitField.build(current, prev);
Assert.assertEquals(bitField.getSequenceEncodingStrategy(), SequenceEncodingStrategy.PREV_ADD1);
}
use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.
the class SpanEventBoTest method testSerialize.
@Test
public void testSerialize() throws Exception {
SpanBo spanBo = new SpanBo();
spanBo.setAgentId("testAgent");
spanBo.setApplicationId("testApp");
spanBo.setAgentStartTime(1);
spanBo.setSpanId(12);
SpanEventBo spanEventBo = new SpanEventBo();
spanEventBo.setDepth(3);
spanEventBo.setDestinationId("testdest");
spanEventBo.setEndElapsed(2);
spanEventBo.setEndPoint("endpoint");
spanEventBo.setNextSpanId(4);
spanEventBo.setRpc("rpc");
spanEventBo.setServiceType(ServiceType.STAND_ALONE.getCode());
spanEventBo.setStartElapsed(100);
spanEventBo.setNextAsyncId(1000);
SpanEventEncodingContext spanEventEncodingContext = new SpanEventEncodingContext(spanBo, spanEventBo);
ByteBuffer bytes = serializer.writeValue(spanEventEncodingContext);
SpanEventBo newSpanEventBo = new SpanEventBo();
SpanDecodingContext spanDecodingContext = new SpanDecodingContext();
Buffer buffer = new OffsetFixedBuffer(bytes.array(), bytes.arrayOffset(), bytes.remaining());
int i = spanDecoder.readSpanEvent(newSpanEventBo, buffer, spanDecodingContext);
Assert.assertEquals(bytes.limit(), i);
Assert.assertEquals(spanBo.getAgentId(), spanDecodingContext.getAgentId());
Assert.assertEquals(spanBo.getApplicationId(), spanDecodingContext.getApplicationId());
Assert.assertEquals(spanBo.getAgentStartTime(), spanDecodingContext.getAgentStartTime());
Assert.assertEquals(spanEventBo.getDepth(), newSpanEventBo.getDepth());
Assert.assertEquals(spanEventBo.getDestinationId(), newSpanEventBo.getDestinationId());
Assert.assertEquals(spanEventBo.getEndElapsed(), newSpanEventBo.getEndElapsed());
Assert.assertEquals(spanEventBo.getEndPoint(), newSpanEventBo.getEndPoint());
Assert.assertEquals(spanEventBo.getNextSpanId(), newSpanEventBo.getNextSpanId());
Assert.assertEquals(spanEventBo.getRpc(), newSpanEventBo.getRpc());
Assert.assertEquals(spanEventBo.getServiceType(), newSpanEventBo.getServiceType());
Assert.assertEquals(spanEventBo.getStartElapsed(), newSpanEventBo.getStartElapsed());
Assert.assertEquals(spanEventBo.getNextAsyncId(), newSpanEventBo.getNextAsyncId());
spanEventBo.setSequence((short) 3);
newSpanEventBo.setSequence((short) 3);
Assert.assertEquals(spanEventBo.getSequence(), newSpanEventBo.getSequence());
}
use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.
the class SpanEncoderTest method testEncodeSpanColumnValue_spanEvent_depth_equals.
@Test
public void testEncodeSpanColumnValue_spanEvent_depth_equals() {
SpanBo spanBo = randomComplexSpan();
SpanEventBo spanEventBo0 = spanBo.getSpanEventBoList().get(0);
SpanEventBo spanEventBo1 = spanBo.getSpanEventBoList().get(1);
spanEventBo1.setDepth(spanEventBo0.getDepth());
assertSpan(spanBo);
}
use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.
the class SpanEncoderTest method assertSpan.
private void assertSpan(SpanBo spanBo) {
spanBo.setCollectorAcceptTime(getCollectorAcceptTime());
SpanEncodingContext<SpanBo> encodingContext = new SpanEncodingContext<SpanBo>(spanBo);
Buffer qualifier = wrapBuffer(spanEncoder.encodeSpanQualifier(encodingContext));
Buffer column = wrapBuffer(spanEncoder.encodeSpanColumnValue(encodingContext));
SpanDecodingContext decodingContext = new SpanDecodingContext();
decodingContext.setTransactionId(spanBo.getTransactionId());
decodingContext.setCollectorAcceptedTime(spanBo.getCollectorAcceptTime());
SpanBo decode = (SpanBo) spanDecoder.decode(qualifier, column, decodingContext);
logger.debug("span dump \noriginal spanBo:{} \ndecode spanBo:{} ", spanBo, decode);
List<String> notSerializedField = Lists.newArrayList("parentApplicationId", "parentApplicationServiceType");
List<String> excludeField = Lists.newArrayList("annotationBoList", "spanEventBoList");
notSerializedField.addAll(excludeField);
Assert.assertTrue(EqualsBuilder.reflectionEquals(decode, spanBo, notSerializedField));
logger.debug("{} {}", spanBo.getAnnotationBoList(), decode.getAnnotationBoList());
Assert.assertTrue("annotation", EqualsBuilder.reflectionEquals(spanBo.getAnnotationBoList(), decode.getAnnotationBoList()));
List<SpanEventBo> spanEventBoList = spanBo.getSpanEventBoList();
List<SpanEventBo> decodedSpanEventBoList = decode.getSpanEventBoList();
Assert.assertTrue(EqualsBuilder.reflectionEquals(spanEventBoList, decodedSpanEventBoList));
}
use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.
the class SpanEventBitFieldTest method testRpc_first.
@Test
public void testRpc_first() throws Exception {
SpanEventBo spanEventBo = new SpanEventBo();
spanEventBo.setRpc("Rpc");
SpanEventBitField bitField = SpanEventBitField.buildFirst(spanEventBo);
Assert.assertTrue(bitField.isSetRpc());
bitField.setRpc(false);
Assert.assertFalse(bitField.isSetRpc());
}
Aggregations