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();
}
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());
}
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());
}
}
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;
}
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;
}
Aggregations