Search in sources :

Example 1 with PIntStringValue

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

the class GrpcSpanMessageConverter method buildPSpanEvent.

@VisibleForTesting
public PSpanEvent.Builder buildPSpanEvent(SpanEvent spanEvent) {
    final PSpanEvent.Builder pSpanEvent = getSpanEventBuilder();
    // tSpanEvent.setStartElapsed(spanEvent.getStartElapsed());
    if (spanEvent.getElapsedTime() != 0) {
        pSpanEvent.setEndElapsed(spanEvent.getElapsedTime());
    }
    pSpanEvent.setSequence(spanEvent.getSequence());
    // tSpanEvent.setRpc(spanEvent.getRpc());
    pSpanEvent.setServiceType(spanEvent.getServiceType());
    // tSpanEvent.setAnnotations();
    if (spanEvent.getDepth() != -1) {
        pSpanEvent.setDepth(spanEvent.getDepth());
    }
    pSpanEvent.setApiId(spanEvent.getApiId());
    final IntStringValue exceptionInfo = spanEvent.getExceptionInfo();
    if (exceptionInfo != null) {
        PIntStringValue pIntStringValue = buildPIntStringValue(exceptionInfo);
        pSpanEvent.setExceptionInfo(pIntStringValue);
    }
    final PNextEvent nextEvent = buildNextEvent(spanEvent);
    if (nextEvent != null) {
        pSpanEvent.setNextEvent(nextEvent);
    }
    final AsyncId asyncIdObject = spanEvent.getAsyncIdObject();
    if (asyncIdObject != null) {
        pSpanEvent.setAsyncEvent(asyncIdObject.getAsyncId());
    }
    final List<Annotation<?>> annotations = spanEvent.getAnnotations();
    if (CollectionUtils.hasLength(annotations)) {
        final List<PAnnotation> pAnnotations = buildPAnnotation(annotations);
        pSpanEvent.addAllAnnotation(pAnnotations);
    }
    return pSpanEvent;
}
Also used : PNextEvent(com.navercorp.pinpoint.grpc.trace.PNextEvent) PIntStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringValue) PAnnotation(com.navercorp.pinpoint.grpc.trace.PAnnotation) IntStringValue(com.navercorp.pinpoint.common.util.IntStringValue) PIntStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringValue) PLocalAsyncId(com.navercorp.pinpoint.grpc.trace.PLocalAsyncId) AsyncId(com.navercorp.pinpoint.profiler.context.AsyncId) LocalAsyncId(com.navercorp.pinpoint.profiler.context.LocalAsyncId) PSpanEvent(com.navercorp.pinpoint.grpc.trace.PSpanEvent) Annotation(com.navercorp.pinpoint.profiler.context.Annotation) PAnnotation(com.navercorp.pinpoint.grpc.trace.PAnnotation) VisibleForTesting(com.navercorp.pinpoint.common.annotations.VisibleForTesting)

Example 2 with PIntStringValue

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

the class GrpcSpanMessageConverter method buildPSpan.

@VisibleForTesting
PSpan buildPSpan(Span span) {
    final PSpan.Builder pSpan = PSpan.newBuilder();
    pSpan.setVersion(SpanVersion.TRACE_V2);
    pSpan.setApplicationServiceType(applicationServiceType);
    final TraceRoot traceRoot = span.getTraceRoot();
    final TraceId traceId = traceRoot.getTraceId();
    final PTransactionId transactionId = newTransactionId(traceId);
    pSpan.setTransactionId(transactionId);
    pSpan.setSpanId(traceId.getSpanId());
    pSpan.setParentSpanId(traceId.getParentSpanId());
    pSpan.setStartTime(span.getStartTime());
    pSpan.setElapsed(span.getElapsedTime());
    pSpan.setServiceType(span.getServiceType());
    PAcceptEvent pAcceptEvent = newAcceptEvent(span);
    pSpan.setAcceptEvent(pAcceptEvent);
    pSpan.setFlag(traceId.getFlags());
    Shared shared = span.getTraceRoot().getShared();
    pSpan.setErr(shared.getErrorCode());
    pSpan.setApiId(span.getApiId());
    final IntStringValue exceptionInfo = span.getExceptionInfo();
    if (exceptionInfo != null) {
        PIntStringValue pIntStringValue = buildPIntStringValue(exceptionInfo);
        pSpan.setExceptionInfo(pIntStringValue);
    }
    pSpan.setLoggingTransactionInfo(shared.getLoggingInfo());
    final List<Annotation<?>> annotations = span.getAnnotations();
    if (CollectionUtils.hasLength(annotations)) {
        final List<PAnnotation> tAnnotations = buildPAnnotation(annotations);
        pSpan.addAllAnnotation(tAnnotations);
    }
    this.spanProcessor.preProcess(span, pSpan);
    final List<SpanEvent> spanEventList = span.getSpanEventList();
    if (CollectionUtils.hasLength(spanEventList)) {
        final List<PSpanEvent> pSpanEvents = buildPSpanEventList(spanEventList);
        pSpan.addAllSpanEvent(pSpanEvents);
    }
    this.spanProcessor.postProcess(span, pSpan);
    return pSpan.build();
}
Also used : PAnnotation(com.navercorp.pinpoint.grpc.trace.PAnnotation) PTransactionId(com.navercorp.pinpoint.grpc.trace.PTransactionId) Shared(com.navercorp.pinpoint.profiler.context.id.Shared) Annotation(com.navercorp.pinpoint.profiler.context.Annotation) PAnnotation(com.navercorp.pinpoint.grpc.trace.PAnnotation) PSpan(com.navercorp.pinpoint.grpc.trace.PSpan) PIntStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringValue) IntStringValue(com.navercorp.pinpoint.common.util.IntStringValue) PIntStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringValue) PSpanEvent(com.navercorp.pinpoint.grpc.trace.PSpanEvent) SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent) TraceId(com.navercorp.pinpoint.bootstrap.context.TraceId) TraceRoot(com.navercorp.pinpoint.profiler.context.id.TraceRoot) PAcceptEvent(com.navercorp.pinpoint.grpc.trace.PAcceptEvent) PSpanEvent(com.navercorp.pinpoint.grpc.trace.PSpanEvent) VisibleForTesting(com.navercorp.pinpoint.common.annotations.VisibleForTesting)

Example 3 with PIntStringValue

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

the class DataTypeAnnotation method apply.

@Override
public PAnnotationValue apply(GrpcAnnotationValueMapper context) {
    PAnnotationValue.Builder builder = context.getAnnotationBuilder();
    final DataType dataType = this.value;
    if (dataType instanceof IntStringValue) {
        final IntStringValue v = (IntStringValue) dataType;
        PIntStringValue pIntStringValue = context.newIntStringValue(v);
        builder.setIntStringValue(pIntStringValue);
        return builder.build();
    } else if (dataType instanceof StringStringValue) {
        final StringStringValue v = (StringStringValue) dataType;
        PStringStringValue pStringStringValue = context.newStringStringValue(v);
        builder.setStringStringValue(pStringStringValue);
        return builder.build();
    } else if (dataType instanceof IntStringStringValue) {
        final IntStringStringValue v = (IntStringStringValue) dataType;
        final PIntStringStringValue pIntStringStringValue = context.newIntStringStringValue(v);
        builder.setIntStringStringValue(pIntStringStringValue);
        return builder.build();
    } else if (dataType instanceof LongIntIntByteByteStringValue) {
        final LongIntIntByteByteStringValue v = (LongIntIntByteByteStringValue) dataType;
        final PLongIntIntByteByteStringValue pValue = context.newLongIntIntByteByteStringValue(v);
        builder.setLongIntIntByteByteStringValue(pValue);
        return builder.build();
    } else if (dataType instanceof IntBooleanIntBooleanValue) {
        final IntBooleanIntBooleanValue v = (IntBooleanIntBooleanValue) dataType;
        final PIntBooleanIntBooleanValue pValue = context.newIntBooleanIntBooleanValue(v);
        builder.setIntBooleanIntBooleanValue(pValue);
        return builder.build();
    }
    throw new UnsupportedOperationException("unsupported type:" + dataType);
}
Also used : PAnnotationValue(com.navercorp.pinpoint.grpc.trace.PAnnotationValue) IntBooleanIntBooleanValue(com.navercorp.pinpoint.common.util.IntBooleanIntBooleanValue) PIntBooleanIntBooleanValue(com.navercorp.pinpoint.grpc.trace.PIntBooleanIntBooleanValue) TIntBooleanIntBooleanValue(com.navercorp.pinpoint.thrift.dto.TIntBooleanIntBooleanValue) PLongIntIntByteByteStringValue(com.navercorp.pinpoint.grpc.trace.PLongIntIntByteByteStringValue) TLongIntIntByteByteStringValue(com.navercorp.pinpoint.thrift.dto.TLongIntIntByteByteStringValue) PLongIntIntByteByteStringValue(com.navercorp.pinpoint.grpc.trace.PLongIntIntByteByteStringValue) LongIntIntByteByteStringValue(com.navercorp.pinpoint.common.util.LongIntIntByteByteStringValue) PIntBooleanIntBooleanValue(com.navercorp.pinpoint.grpc.trace.PIntBooleanIntBooleanValue) PStringStringValue(com.navercorp.pinpoint.grpc.trace.PStringStringValue) PIntStringStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringStringValue) IntStringStringValue(com.navercorp.pinpoint.common.util.IntStringStringValue) PIntStringStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringStringValue) TIntStringStringValue(com.navercorp.pinpoint.thrift.dto.TIntStringStringValue) PStringStringValue(com.navercorp.pinpoint.grpc.trace.PStringStringValue) StringStringValue(com.navercorp.pinpoint.common.util.StringStringValue) IntStringStringValue(com.navercorp.pinpoint.common.util.IntStringStringValue) PIntStringStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringStringValue) TStringStringValue(com.navercorp.pinpoint.thrift.dto.TStringStringValue) TIntStringStringValue(com.navercorp.pinpoint.thrift.dto.TIntStringStringValue) PIntStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringValue) IntStringValue(com.navercorp.pinpoint.common.util.IntStringValue) PIntStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringValue) TIntStringValue(com.navercorp.pinpoint.thrift.dto.TIntStringValue) DataType(com.navercorp.pinpoint.common.util.DataType)

Example 4 with PIntStringValue

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

the class GrpcAnnotationHandler method newIntStringValue.

private IntStringValue newIntStringValue(Object annotationValue) {
    final PIntStringValue pValue = (PIntStringValue) annotationValue;
    String stringValue = null;
    if (pValue.hasStringValue()) {
        stringValue = pValue.getStringValue().getValue();
    }
    return new IntStringValue(pValue.getIntValue(), stringValue);
}
Also used : PIntStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringValue) IntStringValue(com.navercorp.pinpoint.common.util.IntStringValue) PIntStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringValue)

Example 5 with PIntStringValue

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

the class GrpcSpanMessageConverter method buildPIntStringValue.

private PIntStringValue buildPIntStringValue(IntStringValue exceptionInfo) {
    PIntStringValue.Builder builder = PIntStringValue.newBuilder();
    builder.setIntValue(exceptionInfo.getIntValue());
    if (exceptionInfo.getStringValue() != null) {
        final StringValue stringValue = StringValue.of(exceptionInfo.getStringValue());
        builder.setStringValue(stringValue);
    }
    return builder.build();
}
Also used : PIntStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringValue) IntStringValue(com.navercorp.pinpoint.common.util.IntStringValue) StringValue(com.google.protobuf.StringValue) PIntStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringValue)

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