use of com.navercorp.pinpoint.profiler.context.SpanChunk in project pinpoint by naver.
the class BasePinpointTest method getCurrentSpanEvents.
protected List<SpanEvent> getCurrentSpanEvents() {
List<SpanEvent> spanEvents = new ArrayList<>();
for (SpanType value : this.tBaseRecorder) {
if (value instanceof SpanChunk) {
final SpanChunk spanChunk = (SpanChunk) value;
for (SpanEvent tSpanEvent : spanChunk.getSpanEventList()) {
SpanEvent spanEvent = tSpanEvent;
spanEvents.add(spanEvent);
}
}
}
return spanEvents;
}
use of com.navercorp.pinpoint.profiler.context.SpanChunk in project pinpoint by naver.
the class ApplicationContextHandler method getExecutedMethod.
public List<String> getExecutedMethod() {
List<String> list = new ArrayList<>();
for (SpanType item : orderedSpanRecorder) {
if (item instanceof Span) {
Span span = (Span) item;
List<SpanEvent> spanEventList = span.getSpanEventList();
addApiDescription(list, spanEventList);
} else if (item instanceof SpanChunk) {
SpanChunk spanChunk = (SpanChunk) item;
List<SpanEvent> spanEventList = spanChunk.getSpanEventList();
addApiDescription(list, spanEventList);
}
}
return list;
}
use of com.navercorp.pinpoint.profiler.context.SpanChunk in project pinpoint by naver.
the class SpanStreamUDPSenderTest method createSpanChunk.
private SpanChunk createSpanChunk(int spanEventSize) throws InterruptedException {
SpanChunkFactory spanChunkFactory = new DefaultSpanChunkFactory("applicationName", "agentId", 0, ServiceType.STAND_ALONE);
List<SpanEvent> originalSpanEventList = createSpanEventList(spanEventSize);
SpanChunk spanChunk = spanChunkFactory.create(originalSpanEventList);
return spanChunk;
}
use of com.navercorp.pinpoint.profiler.context.SpanChunk in project pinpoint by naver.
the class SpanStreamSendDataSerializerTest method spanStreamSendDataSerializerTest1.
@Test
public void spanStreamSendDataSerializerTest1() throws InterruptedException, TException {
int spanEventSize = 10;
SpanStreamSendDataSerializer serializer = new SpanStreamSendDataSerializer();
HeaderTBaseSerializerFactory factory = new HeaderTBaseSerializerFactory();
SpanChunk spanChunk = spanChunkFactory.create(createSpanEventList(spanEventSize));
PartitionedByteBufferLocator partitionedByteBufferLocator = serializer.serializeSpanChunkStream(factory.createSerializer(), spanChunk);
Assert.assertEquals(spanEventSize + 1, partitionedByteBufferLocator.getPartitionedCount());
HeaderTBaseDeserializer deserializer = new HeaderTBaseDeserializerFactory().createDeserializer();
for (int i = 0; i < partitionedByteBufferLocator.getPartitionedCount(); i++) {
ByteBuffer byteBuffer = partitionedByteBufferLocator.getByteBuffer(i);
byte[] readBuffer = new byte[byteBuffer.remaining()];
byteBuffer.get(readBuffer);
Object o = deserializer.deserialize(readBuffer);
if (o == null) {
Assert.fail();
}
if (i < spanEventSize) {
Assert.assertTrue(o instanceof TSpanEvent);
} else {
Assert.assertTrue(o instanceof TSpanChunk);
}
}
}
use of com.navercorp.pinpoint.profiler.context.SpanChunk in project pinpoint by naver.
the class SpanChunkStreamSendDataPlanerTest method spanChunkStreamSendDataPlanerTest.
@Test
public void spanChunkStreamSendDataPlanerTest() throws Exception {
int spanEventSize = 10;
SpanStreamSendDataSerializer serializer = new SpanStreamSendDataSerializer();
HeaderTBaseSerializerFactory headerTBaseSerializerFactory = new HeaderTBaseSerializerFactory();
List<SpanEvent> originalSpanEventList = createSpanEventList(spanEventSize);
SpanChunk spanChunk = spanChunkFactory.create(originalSpanEventList);
PartitionedByteBufferLocator partitionedByteBufferLocator = serializer.serializeSpanChunkStream(headerTBaseSerializerFactory.createSerializer(), spanChunk);
SpanStreamSendDataFactory factory = new SpanStreamSendDataFactory(100, 50, objectPool);
List<TSpanEvent> spanEventList = getSpanEventList(partitionedByteBufferLocator, factory);
partitionedByteBufferLocator = serializer.serializeSpanChunkStream(headerTBaseSerializerFactory.createSerializer(), spanChunk);
factory = new SpanStreamSendDataFactory(objectPool);
List<TSpanEvent> spanEventList2 = getSpanEventList(partitionedByteBufferLocator, factory);
Assert.assertEquals(spanEventSize, spanEventList.size());
Assert.assertEquals(spanEventSize, spanEventList2.size());
}
Aggregations