use of com.navercorp.pinpoint.grpc.trace.PParentInfo in project pinpoint by naver.
the class GrpcSpanMessageConverter method newAcceptEvent.
private PAcceptEvent newAcceptEvent(Span span) {
PAcceptEvent.Builder builder = PAcceptEvent.newBuilder();
builder.setRemoteAddr(span.getRemoteAddr());
final Shared shared = span.getTraceRoot().getShared();
builder.setRpc(shared.getRpcName());
builder.setEndPoint(shared.getEndPoint());
PParentInfo pParentInfo = newParentInfo(span);
if (pParentInfo != null) {
builder.setParentInfo(pParentInfo);
}
return builder.build();
}
use of com.navercorp.pinpoint.grpc.trace.PParentInfo in project pinpoint by naver.
the class GrpcSpanBinder method newSpanBo.
// for test
SpanBo newSpanBo(PSpan pSpan, Header header) {
final SpanBo spanBo = new SpanBo();
spanBo.setVersion(pSpan.getVersion());
spanBo.setAgentId(header.getAgentId());
spanBo.setApplicationId(header.getApplicationName());
spanBo.setAgentStartTime(header.getAgentStartTime());
if (!pSpan.hasTransactionId()) {
throw new IllegalStateException("hasTransactionId() is false " + MessageFormatUtils.debugLog(pSpan));
}
final TransactionId transactionId = newTransactionId(pSpan.getTransactionId(), spanBo.getAgentId());
spanBo.setTransactionId(transactionId);
spanBo.setSpanId(pSpan.getSpanId());
spanBo.setParentSpanId(pSpan.getParentSpanId());
spanBo.setStartTime(pSpan.getStartTime());
spanBo.setElapsed(pSpan.getElapsed());
spanBo.setServiceType((short) pSpan.getServiceType());
spanBo.setFlag((short) pSpan.getFlag());
spanBo.setApiId(pSpan.getApiId());
spanBo.setErrCode(pSpan.getErr());
spanBo.setLoggingTransactionInfo((byte) pSpan.getLoggingTransactionInfo());
spanBo.setApplicationServiceType((short) pSpan.getApplicationServiceType());
if (pSpan.hasAcceptEvent()) {
final PAcceptEvent acceptEvent = pSpan.getAcceptEvent();
final String rpc = acceptEvent.getRpc();
if (StringUtils.hasLength(rpc)) {
spanBo.setRpc(rpc);
}
final String remoteAddr = acceptEvent.getRemoteAddr();
if (StringUtils.hasLength(remoteAddr)) {
spanBo.setRemoteAddr(remoteAddr);
}
final String endPoint = acceptEvent.getEndPoint();
if (StringUtils.hasLength(endPoint)) {
spanBo.setEndPoint(endPoint);
}
if (acceptEvent.hasParentInfo()) {
final PParentInfo parentInfo = acceptEvent.getParentInfo();
final String acceptorHost = parentInfo.getAcceptorHost();
if (StringUtils.hasLength(acceptorHost)) {
spanBo.setAcceptorHost(acceptorHost);
}
final String parentApplicationName = parentInfo.getParentApplicationName();
if (StringUtils.hasLength(parentApplicationName)) {
spanBo.setParentApplicationId(parentApplicationName);
}
spanBo.setParentApplicationServiceType((short) parentInfo.getParentApplicationType());
}
}
// because exceptionInfo is the error information of span itself, exceptionInfo can be null even if errCode is not 0
if (pSpan.hasExceptionInfo()) {
final PIntStringValue exceptionInfo = pSpan.getExceptionInfo();
spanBo.setExceptionInfo(exceptionInfo.getIntValue(), getExceptionMessage(exceptionInfo));
}
List<AnnotationBo> annotationBoList = buildAnnotationList(pSpan.getAnnotationList());
spanBo.setAnnotationBoList(annotationBoList);
return spanBo;
}
Aggregations