use of com.navercorp.pinpoint.thrift.dto.TSpanEvent in project pinpoint by naver.
the class SpanFactoryAssert method assertSpanEventList.
private void assertSpanEventList(List<SpanEventBo> spanEventBoList, List<TSpanEvent> spanEventList) {
Assert.assertEquals(CollectionUtils.isEmpty(spanEventBoList), CollectionUtils.isEmpty(spanEventList));
if (CollectionUtils.isNotEmpty(spanEventBoList)) {
Map<Long, SpanEventBo> spanEventBoMap = new HashMap<Long, SpanEventBo>();
for (int i = 0; i < spanEventBoList.size(); i++) {
SpanEventBo spanEventBo = spanEventBoList.get(i);
spanEventBoMap.put((long) spanEventBo.getSequence(), spanEventBo);
}
for (int i = 0; i < spanEventList.size(); i++) {
TSpanEvent tSpanEvent = spanEventList.get(i);
SpanEventBo spanEventBo = spanEventBoMap.get((long) tSpanEvent.getSequence());
Assert.assertNotNull(spanEventBo);
assertSpanEvent(tSpanEvent, spanEventBo);
}
}
}
use of com.navercorp.pinpoint.thrift.dto.TSpanEvent in project pinpoint by naver.
the class SpanFactoryTest method testBuildSpanChunkBo.
@Test
public void testBuildSpanChunkBo() throws Exception {
TSpanChunk tSpanChunk = random.randomTSpanChunk();
TSpanEvent tSpanEvent1 = random.randomTSpanEvent((short) 0);
TSpanEvent tSpanEvent2 = random.randomTSpanEvent((short) 1);
TSpanEvent tSpanEvent3 = random.randomTSpanEvent((short) 5);
TSpanEvent tSpanEvent4 = random.randomTSpanEvent((short) 2);
tSpanChunk.setSpanEventList(Lists.newArrayList(tSpanEvent1, tSpanEvent2, tSpanEvent3, tSpanEvent4));
SpanChunkBo spanChunkBo = spanFactory.buildSpanChunkBo(tSpanChunk);
spanFactoryAssert.assertSpanChunk(tSpanChunk, spanChunkBo);
}
use of com.navercorp.pinpoint.thrift.dto.TSpanEvent in project pinpoint by naver.
the class SpanFactory method buildSpanEventBoList.
private List<SpanEventBo> buildSpanEventBoList(List<TSpanEvent> spanEventList) {
if (CollectionUtils.isEmpty(spanEventList)) {
return new ArrayList<SpanEventBo>();
}
List<SpanEventBo> spanEventBoList = new ArrayList<SpanEventBo>(spanEventList.size());
for (TSpanEvent tSpanEvent : spanEventList) {
final SpanEventBo spanEventBo = buildSpanEventBo(tSpanEvent);
if (!spanEventFilter.filter(spanEventBo)) {
continue;
}
spanEventBoList.add(spanEventBo);
}
Collections.sort(spanEventBoList, SpanEventComparator.INSTANCE);
return spanEventBoList;
}
use of com.navercorp.pinpoint.thrift.dto.TSpanEvent in project pinpoint by naver.
the class SpanStreamUDPSenderTest method createSpan.
private Span createSpan(int spanEventSize) throws InterruptedException {
List<SpanEvent> spanEventList = createSpanEventList(spanEventSize);
Span span = new Span();
List<TSpanEvent> tSpanEventList = new ArrayList<>();
for (SpanEvent spanEvent : spanEventList) {
tSpanEventList.add(spanEvent);
}
span.setSpanEventList(tSpanEventList);
return span;
}
use of com.navercorp.pinpoint.thrift.dto.TSpanEvent in project pinpoint by naver.
the class ChunkHeaderBufferedTBaseSerializer method addTSpan.
// TSpan = TSpan + TSpanChunk
private void addTSpan(TBase<?, ?> base) throws TException {
final TSpan span = (TSpan) base;
if (span.getSpanEventList() == null) {
write(base);
return;
}
try {
for (TSpanEvent e : span.getSpanEventList()) {
eventStream.write(e);
}
write(span, FIELD_NAME_SPAN_EVENT_LIST, eventStream.split(chunkSize));
while (!eventStream.isEmpty()) {
final TSpanChunk spanChunk = toSpanChunk(span);
write(spanChunk, FIELD_NAME_SPAN_EVENT_LIST, eventStream.split(chunkSize));
}
} finally {
eventStream.clear();
}
}
Aggregations