use of com.navercorp.pinpoint.common.server.bo.AnnotationBo 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;
}
use of com.navercorp.pinpoint.common.server.bo.AnnotationBo in project pinpoint by naver.
the class SpanEncoderV0 method writeAnnotationList.
private void writeAnnotationList(Buffer buffer, List<AnnotationBo> annotationBoList, SpanEncodingContext<?> encodingContext) {
if (CollectionUtils.isEmpty(annotationBoList)) {
return;
}
buffer.putVInt(annotationBoList.size());
// AnnotationBo prev = encodingCtx.getPrevFirstAnnotationBo();
AnnotationBo prev = null;
for (int i = 0; i < annotationBoList.size(); i++) {
final AnnotationBo current = annotationBoList.get(i);
// first row
if (i == 0) {
// first annotation
buffer.putSVInt(current.getKey());
Object value = current.getValue();
byte valueTypeCode = transcoder.getTypeCode(value);
byte[] valueBytes = transcoder.encode(value, valueTypeCode);
buffer.putByte(valueTypeCode);
buffer.putPrefixedBytes(valueBytes);
// else {
// writeDeltaAnnotationBo(buffer, prev, current);
// }
// save first annotation
// encodingCtx.setPrevFirstAnnotationBo(current);
} else {
writeDeltaAnnotationBo(buffer, prev, current);
}
prev = current;
}
}
use of com.navercorp.pinpoint.common.server.bo.AnnotationBo in project pinpoint by naver.
the class RecordFactory method getDisplayArgument.
private String getDisplayArgument(Align align) {
final AnnotationBo displayArgument = getDisplayArgument0(align.getServiceType(), align.getAnnotationBoList());
if (displayArgument == null) {
return "";
}
final AnnotationKey key = findAnnotationKey(displayArgument.getKey());
return this.annotationRecordFormatter.formatArguments(key, displayArgument, align);
}
use of com.navercorp.pinpoint.common.server.bo.AnnotationBo in project pinpoint by naver.
the class RecordFactory method getApi.
private Api getApi(final Align align) {
final AnnotationBo annotation = AnnotationUtils.findAnnotationBo(align.getAnnotationBoList(), AnnotationKey.API_METADATA);
if (annotation != null) {
final ApiMetaDataBo apiMetaData = (ApiMetaDataBo) annotation.getValue();
String apiInfo = apiMetaData.getDescription();
if (apiMetaData.getMethodTypeEnum() == MethodTypeEnum.DEFAULT) {
ApiParser parser = apiParserProvider.getParser();
return parser.parse(apiMetaData);
}
// parse error
return new Api(apiInfo, "", apiInfo, apiMetaData.getMethodTypeEnum());
} else {
AnnotationKey apiMetaDataError = getApiMetaDataError(align.getAnnotationBoList());
return new Api(apiMetaDataError.getName(), "", "", MethodTypeEnum.DEFAULT);
}
}
use of com.navercorp.pinpoint.common.server.bo.AnnotationBo in project pinpoint by naver.
the class SpanDecoderV0 method readNextSpanEvent.
private SpanEventBo readNextSpanEvent(final Buffer buffer, final SpanEventBo prev, SpanDecodingContext decodingContext) {
final SpanEventBo spanEventBo = new SpanEventBo();
final SpanEventBitField bitField = new SpanEventBitField(buffer.readShort());
switch(bitField.getStartElapsedEncodingStrategy()) {
case PREV_DELTA:
int startTimeDelta = buffer.readVInt();
int startTime = startTimeDelta + prev.getStartElapsed();
spanEventBo.setStartElapsed(startTime);
break;
case PREV_EQUALS:
spanEventBo.setStartElapsed(prev.getStartElapsed());
break;
default:
throw new IllegalStateException("unsupported SequenceEncodingStrategy");
}
spanEventBo.setEndElapsed(buffer.readVInt());
switch(bitField.getSequenceEncodingStrategy()) {
case PREV_DELTA:
int sequenceDelta = buffer.readVInt();
final int sequence = sequenceDelta + prev.getSequence();
spanEventBo.setSequence((short) sequence);
break;
case PREV_ADD1:
spanEventBo.setSequence((short) (prev.getSequence() + 1));
break;
default:
throw new IllegalStateException("unsupported SequenceEncodingStrategy");
}
switch(bitField.getDepthEncodingStrategy()) {
case RAW:
spanEventBo.setDepth(buffer.readSVInt());
break;
case PREV_EQUALS:
spanEventBo.setDepth(prev.getDepth());
break;
default:
throw new IllegalStateException("unsupported DepthEncodingStrategy");
}
switch(bitField.getServiceTypeEncodingStrategy()) {
case RAW:
spanEventBo.setServiceType(buffer.readShort());
break;
case PREV_EQUALS:
spanEventBo.setServiceType(prev.getServiceType());
break;
default:
throw new IllegalStateException("unsupported ServiceTypeEncodingStrategy");
}
spanEventBo.setApiId(buffer.readSVInt());
if (bitField.isSetRpc()) {
spanEventBo.setRpc(buffer.readPrefixedString());
}
if (bitField.isSetEndPoint()) {
spanEventBo.setEndPoint(buffer.readPrefixedString());
}
if (bitField.isSetDestinationId()) {
spanEventBo.setDestinationId(buffer.readPrefixedString());
}
if (bitField.isSetNextSpanId()) {
spanEventBo.setNextSpanId(buffer.readLong());
}
if (bitField.isSetHasException()) {
int exceptionId = buffer.readSVInt();
String exceptionMessage = buffer.readPrefixedString();
spanEventBo.setExceptionInfo(exceptionId, exceptionMessage);
}
if (bitField.isSetAnnotation()) {
List<AnnotationBo> annotationBoList = readAnnotationList(buffer, decodingContext);
spanEventBo.setAnnotationBoList(annotationBoList);
}
if (bitField.isSetNextAsyncId()) {
spanEventBo.setNextAsyncId(buffer.readSVInt());
}
if (bitField.isSetAsyncId()) {
spanEventBo.setAsyncId(buffer.readInt());
spanEventBo.setAsyncSequence((short) buffer.readVInt());
}
return spanEventBo;
}
Aggregations