Search in sources :

Example 1 with TIntStringValue

use of com.navercorp.pinpoint.thrift.dto.TIntStringValue in project pinpoint by naver.

the class AnnotationTranscoder method encodeIntStringValue.

private byte[] encodeIntStringValue(Object value) {
    final TIntStringValue tIntStringValue = (TIntStringValue) value;
    final int intValue = tIntStringValue.getIntValue();
    final byte[] stringValue = BytesUtils.toBytes(tIntStringValue.getStringValue());
    // TODO increase by a more precise value
    final int bufferSize = getBufferSize(stringValue, 4 + 8);
    final Buffer buffer = new AutomaticBuffer(bufferSize);
    buffer.putSVInt(intValue);
    buffer.putPrefixedBytes(stringValue);
    return buffer.getBuffer();
}
Also used : TIntStringValue(com.navercorp.pinpoint.thrift.dto.TIntStringValue) FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer) Buffer(com.navercorp.pinpoint.common.buffer.Buffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer)

Example 2 with TIntStringValue

use of com.navercorp.pinpoint.thrift.dto.TIntStringValue in project pinpoint by naver.

the class AnnotationTranscoderTest method testIntString.

private void testIntString(int intValue, String stringValue) {
    AnnotationTranscoder transcoder = new AnnotationTranscoder();
    TIntStringValue tIntStringValue = new TIntStringValue(intValue);
    tIntStringValue.setStringValue(stringValue);
    byte[] encode = transcoder.encode(tIntStringValue, AnnotationTranscoder.CODE_INT_STRING);
    IntStringValue decode = (IntStringValue) transcoder.decode(AnnotationTranscoder.CODE_INT_STRING, encode);
    Assert.assertEquals(tIntStringValue.getIntValue(), decode.getIntValue());
    Assert.assertEquals(tIntStringValue.getStringValue(), decode.getStringValue());
}
Also used : TIntStringValue(com.navercorp.pinpoint.thrift.dto.TIntStringValue) TIntStringValue(com.navercorp.pinpoint.thrift.dto.TIntStringValue)

Example 3 with TIntStringValue

use of com.navercorp.pinpoint.thrift.dto.TIntStringValue in project pinpoint by naver.

the class SpanFactory method bind.

private void bind(SpanEventBo spanEvent, TSpanEvent tSpanEvent) {
    spanEvent.setSequence(tSpanEvent.getSequence());
    spanEvent.setStartElapsed(tSpanEvent.getStartElapsed());
    spanEvent.setEndElapsed(tSpanEvent.getEndElapsed());
    spanEvent.setRpc(tSpanEvent.getRpc());
    spanEvent.setServiceType(tSpanEvent.getServiceType());
    spanEvent.setDestinationId(tSpanEvent.getDestinationId());
    spanEvent.setEndPoint(tSpanEvent.getEndPoint());
    spanEvent.setApiId(tSpanEvent.getApiId());
    if (tSpanEvent.isSetDepth()) {
        spanEvent.setDepth(tSpanEvent.getDepth());
    }
    if (tSpanEvent.isSetNextSpanId()) {
        spanEvent.setNextSpanId(tSpanEvent.getNextSpanId());
    }
    List<AnnotationBo> annotationList = buildAnnotationList(tSpanEvent.getAnnotations());
    spanEvent.setAnnotationBoList(annotationList);
    final TIntStringValue exceptionInfo = tSpanEvent.getExceptionInfo();
    if (exceptionInfo != null) {
        spanEvent.setExceptionInfo(exceptionInfo.getIntValue(), exceptionInfo.getStringValue());
    }
    if (tSpanEvent.isSetAsyncId()) {
        spanEvent.setAsyncId(tSpanEvent.getAsyncId());
    }
    if (tSpanEvent.isSetNextAsyncId()) {
        spanEvent.setNextAsyncId(tSpanEvent.getNextAsyncId());
    }
    if (tSpanEvent.isSetAsyncSequence()) {
        spanEvent.setAsyncSequence(tSpanEvent.getAsyncSequence());
    }
}
Also used : TIntStringValue(com.navercorp.pinpoint.thrift.dto.TIntStringValue)

Example 4 with TIntStringValue

use of com.navercorp.pinpoint.thrift.dto.TIntStringValue in project pinpoint by naver.

the class SpanFactory method newSpanBo.

// for test
SpanBo newSpanBo(TSpan tSpan) {
    final SpanBo spanBo = new SpanBo();
    spanBo.setAgentId(tSpan.getAgentId());
    spanBo.setApplicationId(tSpan.getApplicationName());
    spanBo.setAgentStartTime(tSpan.getAgentStartTime());
    final TransactionId transactionId = newTransactionId(tSpan.getTransactionId(), spanBo);
    spanBo.setTransactionId(transactionId);
    spanBo.setSpanId(tSpan.getSpanId());
    spanBo.setParentSpanId(tSpan.getParentSpanId());
    spanBo.setStartTime(tSpan.getStartTime());
    spanBo.setElapsed(tSpan.getElapsed());
    spanBo.setRpc(tSpan.getRpc());
    spanBo.setServiceType(tSpan.getServiceType());
    spanBo.setEndPoint(tSpan.getEndPoint());
    spanBo.setFlag(tSpan.getFlag());
    spanBo.setApiId(tSpan.getApiId());
    spanBo.setErrCode(tSpan.getErr());
    spanBo.setAcceptorHost(tSpan.getAcceptorHost());
    spanBo.setRemoteAddr(tSpan.getRemoteAddr());
    spanBo.setLoggingTransactionInfo(tSpan.getLoggingTransactionInfo());
    // applicationServiceType is not saved for older versions where applicationServiceType does not exist.
    if (tSpan.isSetApplicationServiceType()) {
        spanBo.setApplicationServiceType(tSpan.getApplicationServiceType());
    } else {
        spanBo.setApplicationServiceType(tSpan.getServiceType());
    }
    spanBo.setParentApplicationId(tSpan.getParentApplicationName());
    spanBo.setParentApplicationServiceType(tSpan.getParentApplicationType());
    // FIXME span.errCode contains error of span and spanEvent
    // because exceptionInfo is the error information of span itself, exceptionInfo can be null even if errCode is not 0
    final TIntStringValue exceptionInfo = tSpan.getExceptionInfo();
    if (exceptionInfo != null) {
        spanBo.setExceptionInfo(exceptionInfo.getIntValue(), exceptionInfo.getStringValue());
    }
    List<AnnotationBo> annotationBoList = buildAnnotationList(tSpan.getAnnotations());
    spanBo.setAnnotationBoList(annotationBoList);
    return spanBo;
}
Also used : TIntStringValue(com.navercorp.pinpoint.thrift.dto.TIntStringValue) TransactionId(com.navercorp.pinpoint.common.util.TransactionId)

Example 5 with TIntStringValue

use of com.navercorp.pinpoint.thrift.dto.TIntStringValue in project pinpoint by naver.

the class SpanFactory method newSpanBo.

// for test
SpanBo newSpanBo(TSpan tSpan) {
    final SpanBo spanBo = new SpanBo();
    spanBo.setAgentId(tSpan.getAgentId());
    spanBo.setApplicationId(tSpan.getApplicationName());
    spanBo.setAgentStartTime(tSpan.getAgentStartTime());
    final TransactionId transactionId = newTransactionId(tSpan.getTransactionId(), spanBo.getAgentId());
    spanBo.setTransactionId(transactionId);
    spanBo.setSpanId(tSpan.getSpanId());
    spanBo.setParentSpanId(tSpan.getParentSpanId());
    spanBo.setStartTime(tSpan.getStartTime());
    spanBo.setElapsed(tSpan.getElapsed());
    spanBo.setRpc(tSpan.getRpc());
    spanBo.setServiceType(tSpan.getServiceType());
    spanBo.setEndPoint(tSpan.getEndPoint());
    spanBo.setFlag(tSpan.getFlag());
    spanBo.setApiId(tSpan.getApiId());
    spanBo.setErrCode(tSpan.getErr());
    spanBo.setAcceptorHost(tSpan.getAcceptorHost());
    spanBo.setRemoteAddr(tSpan.getRemoteAddr());
    spanBo.setLoggingTransactionInfo(tSpan.getLoggingTransactionInfo());
    // applicationServiceType is not saved for older versions where applicationServiceType does not exist.
    if (tSpan.isSetApplicationServiceType()) {
        spanBo.setApplicationServiceType(tSpan.getApplicationServiceType());
    } else {
        spanBo.setApplicationServiceType(tSpan.getServiceType());
    }
    spanBo.setParentApplicationId(tSpan.getParentApplicationName());
    spanBo.setParentApplicationServiceType(tSpan.getParentApplicationType());
    // FIXME span.errCode contains error of span and spanEvent
    // because exceptionInfo is the error information of span itself, exceptionInfo can be null even if errCode is not 0
    final TIntStringValue exceptionInfo = tSpan.getExceptionInfo();
    if (exceptionInfo != null) {
        spanBo.setExceptionInfo(exceptionInfo.getIntValue(), exceptionInfo.getStringValue());
    }
    List<AnnotationBo> annotationBoList = buildAnnotationList(tSpan.getAnnotations());
    spanBo.setAnnotationBoList(annotationBoList);
    return spanBo;
}
Also used : TIntStringValue(com.navercorp.pinpoint.thrift.dto.TIntStringValue) AnnotationBo(com.navercorp.pinpoint.common.server.bo.AnnotationBo) SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) TransactionId(com.navercorp.pinpoint.common.profiler.util.TransactionId)

Aggregations

TIntStringValue (com.navercorp.pinpoint.thrift.dto.TIntStringValue)13 TAnnotation (com.navercorp.pinpoint.thrift.dto.TAnnotation)4 IntStringValue (com.navercorp.pinpoint.common.util.IntStringValue)3 TSpanEvent (com.navercorp.pinpoint.thrift.dto.TSpanEvent)3 VisibleForTesting (com.navercorp.pinpoint.common.annotations.VisibleForTesting)2 AnnotationBo (com.navercorp.pinpoint.common.server.bo.AnnotationBo)2 Annotation (com.navercorp.pinpoint.profiler.context.Annotation)2 TSpan (com.navercorp.pinpoint.thrift.dto.TSpan)2 TraceId (com.navercorp.pinpoint.bootstrap.context.TraceId)1 AutomaticBuffer (com.navercorp.pinpoint.common.buffer.AutomaticBuffer)1 Buffer (com.navercorp.pinpoint.common.buffer.Buffer)1 FixedBuffer (com.navercorp.pinpoint.common.buffer.FixedBuffer)1 TransactionId (com.navercorp.pinpoint.common.profiler.util.TransactionId)1 SpanBo (com.navercorp.pinpoint.common.server.bo.SpanBo)1 DataType (com.navercorp.pinpoint.common.util.DataType)1 IntBooleanIntBooleanValue (com.navercorp.pinpoint.common.util.IntBooleanIntBooleanValue)1 IntStringStringValue (com.navercorp.pinpoint.common.util.IntStringStringValue)1 LongIntIntByteByteStringValue (com.navercorp.pinpoint.common.util.LongIntIntByteByteStringValue)1 StringStringValue (com.navercorp.pinpoint.common.util.StringStringValue)1 TransactionId (com.navercorp.pinpoint.common.util.TransactionId)1