use of com.navercorp.pinpoint.grpc.trace.PSpanEvent in project pinpoint by naver.
the class GrpcSpanMessageConverter method buildPSpanEventList.
private List<PSpanEvent> buildPSpanEventList(List<SpanEvent> spanEventList) {
final int eventSize = spanEventList.size();
final List<PSpanEvent> pSpanEventList = new ArrayList<>(eventSize);
for (SpanEvent spanEvent : spanEventList) {
final PSpanEvent.Builder pSpanEvent = buildPSpanEvent(spanEvent);
pSpanEventList.add(pSpanEvent.build());
}
return pSpanEventList;
}
use of com.navercorp.pinpoint.grpc.trace.PSpanEvent in project pinpoint by naver.
the class GrpcSpanProcessorV2 method postProcess.
private void postProcess(long keyTime, List<SpanEvent> spanEventList, List<PSpanEvent.Builder> pSpanEventList) {
final int spanEventSize = CollectionUtils.nullSafeSize(spanEventList);
if (spanEventSize == 0) {
return;
}
if (!(spanEventSize == CollectionUtils.nullSafeSize(pSpanEventList))) {
throw new IllegalStateException("list size not same");
}
// check list type
assert spanEventList instanceof RandomAccess;
int prevDepth = 0;
boolean first = true;
final int listSize = spanEventList.size();
for (int i = 0; i < listSize; i++) {
final SpanEvent spanEvent = spanEventList.get(i);
final PSpanEvent.Builder pSpanEvent = pSpanEventList.get(i);
final long startTime = spanEvent.getStartTime();
final long startElapsedTime = startTime - keyTime;
pSpanEvent.setStartElapsed((int) startElapsedTime);
keyTime = startTime;
if (first) {
first = false;
int depth = spanEvent.getDepth();
prevDepth = depth;
pSpanEvent.setDepth(depth);
} else {
int currentDepth = spanEvent.getDepth();
if (currentDepth == prevDepth) {
// skip
pSpanEvent.setDepth(0);
} else {
pSpanEvent.setDepth(currentDepth);
}
prevDepth = currentDepth;
}
}
}
use of com.navercorp.pinpoint.grpc.trace.PSpanEvent in project pinpoint by naver.
the class GrpcSpanChunkHandler method createSimpleSpanChunkLog.
private String createSimpleSpanChunkLog(PSpanChunk spanChunk) {
if (!isDebug) {
return "";
}
StringBuilder log = new StringBuilder();
PTransactionId transactionId = spanChunk.getTransactionId();
log.append(" transactionId:");
log.append(MessageFormatUtils.debugLog(transactionId));
log.append(" spanId:").append(spanChunk.getSpanId());
StringBuilder spanEventSequenceLog = new StringBuilder();
List<PSpanEvent> spanEventList = spanChunk.getSpanEventList();
for (PSpanEvent pSpanEvent : spanEventList) {
if (pSpanEvent == null) {
continue;
}
spanEventSequenceLog.append(pSpanEvent.getSequence()).append(" ");
}
log.append(" spanEventSequence:").append(spanEventSequenceLog.toString());
return log.toString();
}
use of com.navercorp.pinpoint.grpc.trace.PSpanEvent in project pinpoint by naver.
the class CollectorGrpcSpanFactory method buildSpanBo.
@Override
public SpanBo buildSpanBo(PSpan pSpan, Header header) {
final SpanBo spanBo = this.grpcBinder.bindSpanBo(pSpan, header);
final long acceptedTime = acceptedTimeService.getAcceptedTime();
spanBo.setCollectorAcceptTime(acceptedTime);
final List<PSpanEvent> pSpanEventList = pSpan.getSpanEventList();
List<SpanEventBo> spanEventBos = buildSpanEventBoList(pSpanEventList);
spanBo.addSpanEventBoList(spanEventBos);
return spanBo;
}
use of com.navercorp.pinpoint.grpc.trace.PSpanEvent in project pinpoint by naver.
the class CollectorGrpcSpanFactoryTest method newSpanChunk.
private PSpanChunk newSpanChunk() {
PSpanEvent event0 = newEvent(1, 1);
PSpanEvent event1 = newEvent(2, 0);
return newSpanChunk(event0, event1);
}
Aggregations