use of com.navercorp.pinpoint.thrift.dto.TSpanEvent in project pinpoint by naver.
the class SpanChunkStreamSendDataPlanerTest method deserialize.
private List<TSpanEvent> deserialize(byte[] data) throws TException {
ByteBuffer bb = ByteBuffer.wrap(data);
bb.get();
bb.get();
int chunkSize = bb.get();
List<TSpanEvent> eventList = new ArrayList<TSpanEvent>();
for (int i = 0; i < chunkSize; i++) {
short componentSize = bb.getShort();
byte[] component = new byte[componentSize];
bb.get(component);
HeaderTBaseDeserializer deserialize = new HeaderTBaseDeserializerFactory().createDeserializer();
List<TBase<?, ?>> value = deserialize.deserializeList(component);
for (int j = 0; j < value.size(); j++) {
TBase tbase = value.get(j);
if (tbase instanceof TSpanEvent) {
eventList.add((TSpanEvent) tbase);
} else {
}
}
}
return eventList;
}
use of com.navercorp.pinpoint.thrift.dto.TSpanEvent in project pinpoint by naver.
the class SpanStreamSendDataPlanerTest method deserialize.
private List<TSpanEvent> deserialize(byte[] data) throws TException {
ByteBuffer bb = ByteBuffer.wrap(data);
bb.get();
bb.get();
int chunkSize = bb.get();
List<TSpanEvent> eventList = new ArrayList<TSpanEvent>();
for (int i = 0; i < chunkSize; i++) {
short componentSize = bb.getShort();
byte[] component = new byte[componentSize];
bb.get(component);
HeaderTBaseDeserializer deserialize = new HeaderTBaseDeserializerFactory().createDeserializer();
List<TBase<?, ?>> value = deserialize.deserializeList(component);
for (int j = 0; j < value.size(); j++) {
TBase tbase = value.get(j);
if (tbase instanceof TSpanEvent) {
eventList.add((TSpanEvent) tbase);
} else {
}
}
}
return eventList;
}
use of com.navercorp.pinpoint.thrift.dto.TSpanEvent in project pinpoint by naver.
the class SpanStreamSendDataPlanerTest method spanStreamSendDataPlanerTest.
@Test
public void spanStreamSendDataPlanerTest() throws Exception {
int spanEventSize = 10;
SpanStreamSendDataSerializer serializer = new SpanStreamSendDataSerializer();
HeaderTBaseSerializerFactory headerTBaseSerializerFactory = new HeaderTBaseSerializerFactory();
List<SpanEvent> originalSpanEventList = createSpanEventList(spanEventSize);
Span span = createSpan(originalSpanEventList);
PartitionedByteBufferLocator partitionedByteBufferLocator = serializer.serializeSpanStream(headerTBaseSerializerFactory.createSerializer(), span);
SpanStreamSendDataFactory factory = new SpanStreamSendDataFactory(100, 50, objectPool);
List<TSpanEvent> spanEventList = getSpanEventList(partitionedByteBufferLocator, factory);
partitionedByteBufferLocator = serializer.serializeSpanStream(headerTBaseSerializerFactory.createSerializer(), span);
factory = new SpanStreamSendDataFactory(objectPool);
List<TSpanEvent> spanEventList2 = getSpanEventList(partitionedByteBufferLocator, factory);
Assert.assertEquals(spanEventSize, spanEventList.size());
Assert.assertEquals(spanEventSize, spanEventList2.size());
}
use of com.navercorp.pinpoint.thrift.dto.TSpanEvent in project pinpoint by naver.
the class SpanEncoderTest method randomComplexSpanChunk.
public SpanChunkBo randomComplexSpanChunk() {
TSpanChunk tSpanChunk = randomTSpan.randomTSpanChunk();
TSpanEvent tSpanEvent1 = randomTSpan.randomTSpanEvent((short) 1);
TSpanEvent tSpanEvent2 = randomTSpan.randomTSpanEvent((short) 2);
TSpanEvent tSpanEvent3 = randomTSpan.randomTSpanEvent((short) 3);
TSpanEvent tSpanEvent4 = randomTSpan.randomTSpanEvent((short) 5);
tSpanChunk.setSpanEventList(Lists.newArrayList(tSpanEvent1, tSpanEvent2, tSpanEvent3, tSpanEvent4));
return spanFactory.buildSpanChunkBo(tSpanChunk);
}
use of com.navercorp.pinpoint.thrift.dto.TSpanEvent in project pinpoint by naver.
the class SpanFactoryTest method testNewSpanEventBo.
@Test
public void testNewSpanEventBo() throws Exception {
TSpanEvent tSpanEvent = random.randomTSpanEvent((short) RandomUtils.nextInt(0, 100));
SpanEventBo spanEventBo = spanFactory.buildSpanEventBo(tSpanEvent);
spanFactoryAssert.assertSpanEvent(tSpanEvent, spanEventBo);
}
Aggregations