Search in sources :

Example 6 with PIntStringValue

use of com.navercorp.pinpoint.grpc.trace.PIntStringValue in project pinpoint by naver.

the class GrpcAnnotationValueMapper method newIntStringValue.

public PIntStringValue newIntStringValue(IntStringValue v) {
    final PIntStringValue.Builder builder = this.intStringBuilder;
    builder.setIntValue(v.getIntValue());
    if (v.getStringValue() != null) {
        StringValue stringValue = newStringValue(v.getStringValue());
        builder.setStringValue(stringValue);
    }
    PIntStringValue value = builder.build();
    builder.clear();
    return value;
}
Also used : PIntStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringValue) IntStringValue(com.navercorp.pinpoint.common.util.IntStringValue) PStringStringValue(com.navercorp.pinpoint.grpc.trace.PStringStringValue) StringStringValue(com.navercorp.pinpoint.common.util.StringStringValue) PIntStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringValue) StringValue(com.google.protobuf.StringValue) PLongIntIntByteByteStringValue(com.navercorp.pinpoint.grpc.trace.PLongIntIntByteByteStringValue) IntStringStringValue(com.navercorp.pinpoint.common.util.IntStringStringValue) PIntStringStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringStringValue) LongIntIntByteByteStringValue(com.navercorp.pinpoint.common.util.LongIntIntByteByteStringValue)

Example 7 with PIntStringValue

use of com.navercorp.pinpoint.grpc.trace.PIntStringValue 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;
}
Also used : AnnotationBo(com.navercorp.pinpoint.common.server.bo.AnnotationBo) PIntStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringValue) PParentInfo(com.navercorp.pinpoint.grpc.trace.PParentInfo) PAcceptEvent(com.navercorp.pinpoint.grpc.trace.PAcceptEvent) SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) PTransactionId(com.navercorp.pinpoint.grpc.trace.PTransactionId) TransactionId(com.navercorp.pinpoint.common.profiler.util.TransactionId)

Example 8 with PIntStringValue

use of com.navercorp.pinpoint.grpc.trace.PIntStringValue in project pinpoint by naver.

the class GrpcSpanBinder method bind.

private void bind(SpanEventBo spanEvent, PSpanEvent pSpanEvent, SpanEventBo prevSpanEvent) {
    spanEvent.setSequence((short) pSpanEvent.getSequence());
    if (prevSpanEvent == null) {
        int startElapsed = pSpanEvent.getStartElapsed();
        spanEvent.setStartElapsed(startElapsed);
    } else {
        int startElapsed = pSpanEvent.getStartElapsed() + prevSpanEvent.getStartElapsed();
        spanEvent.setStartElapsed(startElapsed);
    }
    spanEvent.setEndElapsed(pSpanEvent.getEndElapsed());
    spanEvent.setServiceType((short) pSpanEvent.getServiceType());
    spanEvent.setApiId(pSpanEvent.getApiId());
    // v2 spec
    final int depth = pSpanEvent.getDepth();
    if (depth == 0) {
        // depth compact case
        if (prevSpanEvent == null) {
            // first spanEvent
            spanEvent.setDepth(0);
        } else {
            spanEvent.setDepth(prevSpanEvent.getDepth());
        }
    } else {
        spanEvent.setDepth(depth);
    }
    if (pSpanEvent.hasNextEvent()) {
        final PNextEvent nextEvent = pSpanEvent.getNextEvent();
        final PNextEvent.FieldCase fieldCase = nextEvent.getFieldCase();
        if (fieldCase == PNextEvent.FieldCase.MESSAGEEVENT) {
            final PMessageEvent messageEvent = nextEvent.getMessageEvent();
            spanEvent.setNextSpanId(messageEvent.getNextSpanId());
            final String destinationId = messageEvent.getDestinationId();
            if (StringUtils.hasLength(destinationId)) {
                spanEvent.setDestinationId(destinationId);
            }
            final String endPoint = messageEvent.getEndPoint();
            if (StringUtils.hasLength(endPoint)) {
                spanEvent.setEndPoint(endPoint);
            }
        } else {
            logger.info("unknown nextEvent:{}", nextEvent);
        }
    }
    final int asyncEvent = pSpanEvent.getAsyncEvent();
    spanEvent.setNextAsyncId(asyncEvent);
    List<AnnotationBo> annotationList = buildAnnotationList(pSpanEvent.getAnnotationList());
    spanEvent.setAnnotationBoList(annotationList);
    if (pSpanEvent.hasExceptionInfo()) {
        final PIntStringValue exceptionInfo = pSpanEvent.getExceptionInfo();
        spanEvent.setExceptionInfo(exceptionInfo.getIntValue(), getExceptionMessage(exceptionInfo));
    }
}
Also used : AnnotationBo(com.navercorp.pinpoint.common.server.bo.AnnotationBo) PNextEvent(com.navercorp.pinpoint.grpc.trace.PNextEvent) PMessageEvent(com.navercorp.pinpoint.grpc.trace.PMessageEvent) PIntStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringValue)

Example 9 with PIntStringValue

use of com.navercorp.pinpoint.grpc.trace.PIntStringValue in project pinpoint by naver.

the class GrpcAnnotationValueMapperTest method buildPAnnotationValue_IntString.

@Test
public void buildPAnnotationValue_IntString() {
    IntStringValue intStringValue = new IntStringValue(1, "2");
    PAnnotationValue container = mapper.buildPAnnotationValue(Annotations.of(1, intStringValue));
    PIntStringValue pAnnotation = container.getIntStringValue();
    Assert.assertEquals(pAnnotation.getIntValue(), 1);
    Assert.assertEquals(pAnnotation.getStringValue().getValue(), "2");
}
Also used : PAnnotationValue(com.navercorp.pinpoint.grpc.trace.PAnnotationValue) PIntStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringValue) IntStringValue(com.navercorp.pinpoint.common.util.IntStringValue) PIntStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringValue) Test(org.junit.Test)

Aggregations

PIntStringValue (com.navercorp.pinpoint.grpc.trace.PIntStringValue)9 IntStringValue (com.navercorp.pinpoint.common.util.IntStringValue)7 StringValue (com.google.protobuf.StringValue)2 VisibleForTesting (com.navercorp.pinpoint.common.annotations.VisibleForTesting)2 AnnotationBo (com.navercorp.pinpoint.common.server.bo.AnnotationBo)2 IntStringStringValue (com.navercorp.pinpoint.common.util.IntStringStringValue)2 LongIntIntByteByteStringValue (com.navercorp.pinpoint.common.util.LongIntIntByteByteStringValue)2 StringStringValue (com.navercorp.pinpoint.common.util.StringStringValue)2 PAcceptEvent (com.navercorp.pinpoint.grpc.trace.PAcceptEvent)2 PAnnotation (com.navercorp.pinpoint.grpc.trace.PAnnotation)2 PAnnotationValue (com.navercorp.pinpoint.grpc.trace.PAnnotationValue)2 PIntStringStringValue (com.navercorp.pinpoint.grpc.trace.PIntStringStringValue)2 PLongIntIntByteByteStringValue (com.navercorp.pinpoint.grpc.trace.PLongIntIntByteByteStringValue)2 PNextEvent (com.navercorp.pinpoint.grpc.trace.PNextEvent)2 PSpanEvent (com.navercorp.pinpoint.grpc.trace.PSpanEvent)2 PStringStringValue (com.navercorp.pinpoint.grpc.trace.PStringStringValue)2 PTransactionId (com.navercorp.pinpoint.grpc.trace.PTransactionId)2 Annotation (com.navercorp.pinpoint.profiler.context.Annotation)2 TraceId (com.navercorp.pinpoint.bootstrap.context.TraceId)1 TransactionId (com.navercorp.pinpoint.common.profiler.util.TransactionId)1