use of com.navercorp.pinpoint.common.server.bo.AnnotationBo in project pinpoint by naver.
the class SpanDecoderV0 method readFirstSpanEvent.
private SpanEventBo readFirstSpanEvent(Buffer buffer, SpanEventBo firstSpanEvent, SpanDecodingContext decodingContext) {
SpanEventBitField bitField = new SpanEventBitField(buffer.readByte());
firstSpanEvent.setStartElapsed(buffer.readVInt());
firstSpanEvent.setEndElapsed(buffer.readVInt());
firstSpanEvent.setSequence(buffer.readShort());
firstSpanEvent.setDepth(buffer.readSVInt());
firstSpanEvent.setServiceType(buffer.readShort());
if (bitField.isSetRpc()) {
firstSpanEvent.setRpc(buffer.readPrefixedString());
}
if (bitField.isSetEndPoint()) {
firstSpanEvent.setEndPoint(buffer.readPrefixedString());
}
if (bitField.isSetDestinationId()) {
firstSpanEvent.setDestinationId(buffer.readPrefixedString());
}
firstSpanEvent.setApiId(buffer.readSVInt());
if (bitField.isSetNextSpanId()) {
firstSpanEvent.setNextSpanId(buffer.readLong());
}
if (bitField.isSetHasException()) {
int exceptionId = buffer.readSVInt();
String exceptionMessage = buffer.readPrefixedString();
firstSpanEvent.setExceptionInfo(exceptionId, exceptionMessage);
}
if (bitField.isSetAnnotation()) {
List<AnnotationBo> annotationBoList = readAnnotationList(buffer, decodingContext);
firstSpanEvent.setAnnotationBoList(annotationBoList);
}
if (bitField.isSetNextAsyncId()) {
firstSpanEvent.setNextAsyncId(buffer.readSVInt());
}
// }
return firstSpanEvent;
}
use of com.navercorp.pinpoint.common.server.bo.AnnotationBo in project pinpoint by naver.
the class CorruptedSpanAlignFactory method get.
public SpanAlign get(final String title, final SpanBo span, final SpanEventBo spanEvent) {
final SpanEventBo missedEvent = new SpanEventBo();
// TODO use invalid event information ?
missedEvent.setStartElapsed(spanEvent.getStartElapsed());
missedEvent.setEndElapsed(spanEvent.getEndElapsed());
missedEvent.setServiceType(ServiceType.COLLECTOR.getCode());
List<AnnotationBo> annotations = new ArrayList<>();
ApiMetaDataBo apiMetaData = new ApiMetaDataBo();
apiMetaData.setLineNumber(-1);
apiMetaData.setApiInfo("...");
apiMetaData.setMethodTypeEnum(MethodTypeEnum.CORRUPTED);
final AnnotationBo apiMetaDataAnnotation = new AnnotationBo();
apiMetaDataAnnotation.setKey(AnnotationKey.API_METADATA.getCode());
apiMetaDataAnnotation.setValue(apiMetaData);
annotations.add(apiMetaDataAnnotation);
final AnnotationBo argumentAnnotation = new AnnotationBo();
argumentAnnotation.setKey(AnnotationKeyUtils.getArgs(0).getCode());
if (System.currentTimeMillis() - span.getStartTime() < timeoutMillisec) {
argumentAnnotation.setValue("Corrupted(waiting for packet) ");
} else {
if (title != null) {
argumentAnnotation.setValue("Corrupted(" + title + ")");
} else {
argumentAnnotation.setValue("Corrupted");
}
}
annotations.add(argumentAnnotation);
missedEvent.setAnnotationBoList(annotations);
return new SpanAlign(span, missedEvent);
}
use of com.navercorp.pinpoint.common.server.bo.AnnotationBo in project pinpoint by naver.
the class SpanMapper method mapRow.
@Override
public List<SpanBo> mapRow(Result result, int rowNum) throws Exception {
if (result.isEmpty()) {
return Collections.emptyList();
}
byte[] rowKey = result.getRow();
final TransactionId transactionId = this.rowKeyDecoder.decodeRowKey(rowKey);
final Cell[] rawCells = result.rawCells();
Map<AgentKey, SpanBo> spanMap = new LinkedHashMap<>();
ListMultimap<AgentKey, SpanEventBo> spanEventBoListMap = ArrayListMultimap.create();
ListMultimap<Long, AnnotationBo> annotationBoListMap = ArrayListMultimap.create();
final SpanDecodingContext decodingContext = new SpanDecodingContext();
decodingContext.setTransactionId(transactionId);
for (Cell cell : rawCells) {
decodingContext.setCollectorAcceptedTime(cell.getTimestamp());
// only if family name is "span"
if (CellUtil.matchingFamily(cell, HBaseTables.TRACES_CF_SPAN)) {
Buffer qualifierBuffer = new OffsetFixedBuffer(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength());
Buffer valueBuffer = new OffsetFixedBuffer(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());
final SpanBo spanBo = spanDecoder.decodeSpanBo(qualifierBuffer, valueBuffer, decodingContext);
AgentKey agentKey = newAgentKey(spanBo);
spanMap.put(agentKey, spanBo);
} else if (CellUtil.matchingFamily(cell, HBaseTables.TRACES_CF_TERMINALSPAN)) {
final Buffer qualifier = new OffsetFixedBuffer(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength());
final Buffer valueBuffer = new OffsetFixedBuffer(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());
SpanEventBo spanEventBo = spanDecoder.decodeSpanEventBo(qualifier, valueBuffer, decodingContext);
AgentKey agentKey = newAgentKey(decodingContext);
spanEventBoListMap.put(agentKey, spanEventBo);
} else if (CellUtil.matchingFamily(cell, HBaseTables.TRACES_CF_ANNOTATION)) {
final Buffer qualifier = new OffsetFixedBuffer(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength());
final Buffer valueBuffer = new OffsetFixedBuffer(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());
List<AnnotationBo> annotationBoList = annotationBoDecoder.decode(qualifier, valueBuffer, decodingContext);
if (CollectionUtils.isNotEmpty(annotationBoList)) {
long spanId = decodingContext.getSpanId();
annotationBoListMap.putAll(spanId, annotationBoList);
}
}
spanDecoder.next(decodingContext);
}
decodingContext.finish();
for (Map.Entry<AgentKey, SpanEventBo> spanBoEntry : spanEventBoListMap.entries()) {
final AgentKey agentKey = spanBoEntry.getKey();
SpanBo spanBo = spanMap.get(agentKey);
if (spanBo != null) {
SpanEventBo value = spanBoEntry.getValue();
spanBo.addSpanEvent(value);
} else {
if (logger.isInfoEnabled()) {
logger.info("Span not exist spanId:{} spanEvent:{}", spanBoEntry.getKey(), spanBoEntry.getValue());
}
}
}
List<SpanBo> spanList = Lists.newArrayList(spanMap.values());
if (!annotationBoListMap.isEmpty()) {
addAnnotation(spanList, annotationBoListMap);
}
return spanList;
}
use of com.navercorp.pinpoint.common.server.bo.AnnotationBo in project pinpoint by naver.
the class SpanMapper method addAnnotation.
private void addAnnotation(List<SpanBo> spanList, ListMultimap<Long, AnnotationBo> annotationMap) {
for (SpanBo spanBo : spanList) {
long spanId = spanBo.getSpanId();
List<AnnotationBo> anoList = annotationMap.get(spanId);
spanBo.setAnnotationBoList(anoList);
}
}
use of com.navercorp.pinpoint.common.server.bo.AnnotationBo in project pinpoint by naver.
the class SpanServiceImpl method transitionAnnotation.
private void transitionAnnotation(List<Align> spans, AnnotationReplacementCallback annotationReplacementCallback) {
for (Align align : spans) {
List<AnnotationBo> annotationBoList = align.getAnnotationBoList();
if (annotationBoList == null) {
annotationBoList = new ArrayList<>();
align.setAnnotationBoList(annotationBoList);
}
annotationReplacementCallback.replacement(align, annotationBoList);
}
}
Aggregations