use of com.navercorp.pinpoint.grpc.trace.PSpanChunk in project pinpoint by naver.
the class CollectorGrpcSpanFactoryTest method buildSpanChunkBo_first_depth_zero.
@Test
public void buildSpanChunkBo_first_depth_zero() {
final PSpanChunk chunk = newSpanChunk_first_depth_zero();
final Header header = newHeader();
SpanChunkBo spanChunkBo = factory.buildSpanChunkBo(chunk, header);
List<SpanEventBo> spanEventBoList = spanChunkBo.getSpanEventBoList();
SpanEventBo spanEventBo0 = spanEventBoList.get(0);
SpanEventBo spanEventBo1 = spanEventBoList.get(1);
Assert.assertEquals(0, spanEventBo0.getDepth());
Assert.assertEquals(1, spanEventBo1.getDepth());
}
use of com.navercorp.pinpoint.grpc.trace.PSpanChunk in project pinpoint by naver.
the class CollectorGrpcSpanFactoryTest method buildSpanChunkBo_compact_depth_NPE.
@Test
public void buildSpanChunkBo_compact_depth_NPE() {
final PSpanChunk chunk = newSpanChunk_compact_depth_error();
final Header header = newHeader();
SpanChunkBo spanChunkBo = factory.buildSpanChunkBo(chunk, header);
List<SpanEventBo> spanEventBoList = spanChunkBo.getSpanEventBoList();
SpanEventBo spanEventBo0 = spanEventBoList.get(0);
Assert.assertEquals(1, spanEventBo0.getDepth());
}
use of com.navercorp.pinpoint.grpc.trace.PSpanChunk in project pinpoint by naver.
the class GrpcSpanMessageConverter method buildPSpanChunk.
@VisibleForTesting
PSpanChunk buildPSpanChunk(SpanChunk spanChunk) {
final PSpanChunk.Builder pSpanChunk = PSpanChunk.newBuilder();
pSpanChunk.setVersion(SpanVersion.TRACE_V2);
// tSpanChunk.setApplicationName(applicationName);
// tSpanChunk.setAgentId(agentId);
// tSpanChunk.setAgentStartTime(agentStartTime);
pSpanChunk.setApplicationServiceType(applicationServiceType);
final TraceRoot traceRoot = spanChunk.getTraceRoot();
final TraceId traceId = traceRoot.getTraceId();
final PTransactionId transactionId = newTransactionId(traceId);
pSpanChunk.setTransactionId(transactionId);
pSpanChunk.setSpanId(traceId.getSpanId());
final Shared shared = traceRoot.getShared();
final String endPoint = shared.getEndPoint();
if (endPoint != null) {
pSpanChunk.setEndPoint(endPoint);
}
if (spanChunk instanceof AsyncSpanChunk) {
final AsyncSpanChunk asyncSpanChunk = (AsyncSpanChunk) spanChunk;
final LocalAsyncId localAsyncId = asyncSpanChunk.getLocalAsyncId();
final PLocalAsyncId.Builder pAsyncIdBuilder = PLocalAsyncId.newBuilder();
pAsyncIdBuilder.setAsyncId(localAsyncId.getAsyncId());
pAsyncIdBuilder.setSequence(localAsyncId.getSequence());
final PLocalAsyncId pLocalAsyncId = pAsyncIdBuilder.build();
pSpanChunk.setLocalAsyncId(pLocalAsyncId);
}
this.spanProcessor.preProcess(spanChunk, pSpanChunk);
final List<SpanEvent> spanEventList = spanChunk.getSpanEventList();
if (CollectionUtils.hasLength(spanEventList)) {
final List<PSpanEvent> pSpanEvents = buildPSpanEventList(spanEventList);
pSpanChunk.addAllSpanEvent(pSpanEvents);
}
this.spanProcessor.postProcess(spanChunk, pSpanChunk);
return pSpanChunk.build();
}
use of com.navercorp.pinpoint.grpc.trace.PSpanChunk in project pinpoint by naver.
the class GrpcSpanMessageConverter method toMessage.
@Override
public GeneratedMessageV3 toMessage(SpanType message) {
if (message instanceof SpanChunk) {
final SpanChunk spanChunk = (SpanChunk) message;
final PSpanChunk pSpanChunk = buildPSpanChunk(spanChunk);
return pSpanChunk;
}
if (message instanceof Span) {
final Span span = (Span) message;
return buildPSpan(span);
}
return null;
}
use of com.navercorp.pinpoint.grpc.trace.PSpanChunk in project pinpoint by naver.
the class CollectorGrpcSpanFactoryTest method buildSpanChunkBo_sequence_overflow_NPE.
@Test
public void buildSpanChunkBo_sequence_overflow_NPE() {
final PSpanChunk chunk = newSpanChunk_overflow();
final Header header = newHeader();
SpanChunkBo spanChunkBo = factory.buildSpanChunkBo(chunk, header);
List<SpanEventBo> spanEventBoList = spanChunkBo.getSpanEventBoList();
Assert.assertTrue(spanEventBoList.isEmpty());
}
Aggregations