use of com.navercorp.pinpoint.common.util.IntStringValue in project pinpoint by naver.
the class SpanThriftMessageConverter method buildTSpan.
@VisibleForTesting
TSpan buildTSpan(Span span) {
final TSpan tSpan = new TSpan();
// tSpan.setVersion(span.getVersion());
tSpan.setApplicationName(applicationName);
tSpan.setAgentId(agentId);
tSpan.setAgentStartTime(agentStartTime);
tSpan.setApplicationServiceType(applicationServiceType);
final TraceRoot traceRoot = span.getTraceRoot();
final TraceId traceId = traceRoot.getTraceId();
final ByteBuffer transactionId = transactionIdEncoder.encodeTransactionId(traceId);
tSpan.setTransactionId(transactionId);
tSpan.setSpanId(traceId.getSpanId());
tSpan.setParentSpanId(traceId.getParentSpanId());
tSpan.setStartTime(span.getStartTime());
tSpan.setElapsed(span.getElapsedTime());
tSpan.setServiceType(span.getServiceType());
tSpan.setRemoteAddr(span.getRemoteAddr());
final Shared shared = traceRoot.getShared();
tSpan.setRpc(shared.getRpcName());
tSpan.setEndPoint(shared.getEndPoint());
tSpan.setFlag(traceId.getFlags());
tSpan.setErr(shared.getErrorCode());
tSpan.setParentApplicationName(span.getParentApplicationName());
tSpan.setParentApplicationType(span.getParentApplicationType());
tSpan.setAcceptorHost(span.getAcceptorHost());
tSpan.setApiId(span.getApiId());
final IntStringValue exceptionInfo = span.getExceptionInfo();
if (exceptionInfo != null) {
TIntStringValue tIntStringValue = buildTIntStringValue(exceptionInfo);
tSpan.setExceptionInfo(tIntStringValue);
}
tSpan.setLoggingTransactionInfo(shared.getLoggingInfo());
final List<Annotation<?>> annotations = span.getAnnotations();
if (CollectionUtils.hasLength(annotations)) {
final List<TAnnotation> tAnnotations = buildTAnnotation(annotations);
tSpan.setAnnotations(tAnnotations);
}
spanPostProcessor.preProcess(span, tSpan);
final List<SpanEvent> spanEventList = span.getSpanEventList();
if (CollectionUtils.hasLength(spanEventList)) {
final List<TSpanEvent> tSpanEvents = buildTSpanEventList(spanEventList);
tSpan.setSpanEventList(tSpanEvents);
}
spanPostProcessor.postProcess(span, tSpan);
return tSpan;
}
Aggregations