use of com.navercorp.pinpoint.common.server.bo.SpanBo in project pinpoint by naver.
the class SpanBitFiledTest method testApplicationServiceTypeEncodingStrategy_PREV_TYPE_EQUALS.
@Test
public void testApplicationServiceTypeEncodingStrategy_PREV_TYPE_EQUALS() {
SpanBo spanBo = new SpanBo();
spanBo.setServiceType((short) 1000);
spanBo.setApplicationServiceType((short) 1000);
SpanBitFiled spanBitFiled = SpanBitFiled.build(spanBo);
Assert.assertEquals(spanBitFiled.getApplicationServiceTypeEncodingStrategy(), ServiceTypeEncodingStrategy.PREV_EQUALS);
}
use of com.navercorp.pinpoint.common.server.bo.SpanBo in project pinpoint by naver.
the class SpanBitFiledTest method testRoot_1.
@Test
public void testRoot_1() throws Exception {
SpanBo spanBo = new SpanBo();
spanBo.setParentSpanId(-1);
SpanBitFiled spanBitFiled = SpanBitFiled.build(spanBo);
Assert.assertTrue(spanBitFiled.isRoot());
spanBitFiled.setRoot(false);
Assert.assertFalse(spanBitFiled.isRoot());
}
use of com.navercorp.pinpoint.common.server.bo.SpanBo in project pinpoint by naver.
the class SpanBitFiledTest method testHasException_2.
@Test
public void testHasException_2() {
SpanBo spanBo = new SpanBo();
SpanBitFiled spanBitFiled = SpanBitFiled.build(spanBo);
Assert.assertFalse(spanBitFiled.isSetHasException());
spanBitFiled.maskAll();
spanBitFiled.setHasException(false);
Assert.assertFalse(spanBitFiled.isSetHasException());
}
use of com.navercorp.pinpoint.common.server.bo.SpanBo in project pinpoint by naver.
the class SpanMapperV2 method bindSpanChunk.
private List<SpanBo> bindSpanChunk(ListMultimap<AgentKey, SpanBo> spanMap, List<SpanChunkBo> spanChunkList) {
for (SpanChunkBo spanChunkBo : spanChunkList) {
AgentKey agentKey = newAgentKey(spanChunkBo);
List<SpanBo> matchedSpanBoList = spanMap.get(agentKey);
if (matchedSpanBoList != null) {
final int spanIdCollisionSize = matchedSpanBoList.size();
if (spanIdCollisionSize > 1) {
// exceptional case dump
logger.warn("spanIdCollision {}", matchedSpanBoList);
}
int agentLevelCollisionCount = 0;
for (SpanBo spanBo : matchedSpanBoList) {
if (StringUtils.equals(spanBo.getAgentId(), spanChunkBo.getAgentId())) {
spanBo.addSpanEventBoList(spanChunkBo.getSpanEventBoList());
agentLevelCollisionCount++;
}
}
if (agentLevelCollisionCount > 1) {
// exceptional case dump
logger.warn("agentLevelCollision {}", matchedSpanBoList);
}
} else {
if (logger.isInfoEnabled()) {
logger.info("Span not exist spanId:{} spanChunk:{}", agentKey, spanChunkBo);
}
}
}
return Lists.newArrayList(spanMap.values());
}
use of com.navercorp.pinpoint.common.server.bo.SpanBo in project pinpoint by naver.
the class SpanMapperV2 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();
ListMultimap<AgentKey, SpanBo> spanMap = LinkedListMultimap.create();
List<SpanChunkBo> spanChunkList = new ArrayList<>();
final SpanDecodingContext decodingContext = new SpanDecodingContext();
decodingContext.setTransactionId(transactionId);
for (Cell cell : rawCells) {
SpanDecoder spanDecoder = null;
// only if family name is "span"
if (CellUtil.matchingFamily(cell, HBaseTables.TRACE_V2_CF_SPAN)) {
decodingContext.setCollectorAcceptedTime(cell.getTimestamp());
final Buffer qualifier = new OffsetFixedBuffer(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength());
final Buffer columnValue = new OffsetFixedBuffer(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());
spanDecoder = resolveDecoder(columnValue);
final Object decodeObject = spanDecoder.decode(qualifier, columnValue, decodingContext);
if (decodeObject instanceof SpanBo) {
SpanBo spanBo = (SpanBo) decodeObject;
if (logger.isDebugEnabled()) {
logger.debug("spanBo:{}", spanBo);
}
AgentKey agentKey = newAgentKey(spanBo);
spanMap.put(agentKey, spanBo);
} else if (decodeObject instanceof SpanChunkBo) {
SpanChunkBo spanChunkBo = (SpanChunkBo) decodeObject;
if (logger.isDebugEnabled()) {
logger.debug("spanChunkBo:{}", spanChunkBo);
}
spanChunkList.add(spanChunkBo);
}
} else {
logger.warn("Unknown ColumnFamily :{}", Bytes.toStringBinary(CellUtil.cloneFamily(cell)));
}
nextCell(spanDecoder, decodingContext);
}
decodingContext.finish();
return buildSpanBoList(spanMap, spanChunkList);
}
Aggregations