use of com.navercorp.pinpoint.common.server.bo.SpanChunkBo in project pinpoint by naver.
the class SpanChunkHandler method handleSimple.
@Override
public void handleSimple(TBase<?, ?> tbase) {
try {
final SpanChunkBo spanChunkBo = newSpanChunkBo(tbase);
traceDao.insertSpanChunk(spanChunkBo);
final ServiceType applicationServiceType = getApplicationServiceType(spanChunkBo);
List<SpanEventBo> spanEventList = spanChunkBo.getSpanEventBoList();
if (spanEventList != null) {
if (logger.isDebugEnabled()) {
logger.debug("SpanChunk Size:{}", spanEventList.size());
}
// TODO need to batch update later.
for (SpanEventBo spanEvent : spanEventList) {
final ServiceType spanEventType = registry.findServiceType(spanEvent.getServiceType());
if (!spanEventType.isRecordStatistics()) {
continue;
}
// if terminal update statistics
final int elapsed = spanEvent.getEndElapsed();
final boolean hasException = spanEvent.hasException();
/*
* save information to draw a server map based on statistics
*/
// save the information of caller (the spanevent that span called)
statisticsHandler.updateCaller(spanChunkBo.getApplicationId(), applicationServiceType, spanChunkBo.getAgentId(), spanEvent.getDestinationId(), spanEventType, spanEvent.getEndPoint(), elapsed, hasException);
// save the information of callee (the span that called spanevent)
statisticsHandler.updateCallee(spanEvent.getDestinationId(), spanEventType, spanChunkBo.getApplicationId(), applicationServiceType, spanChunkBo.getEndPoint(), elapsed, hasException);
}
}
} catch (Exception e) {
logger.warn("SpanChunk handle error Caused:{}", e.getMessage(), e);
}
}
use of com.navercorp.pinpoint.common.server.bo.SpanChunkBo in project pinpoint by naver.
the class SpanFactory method buildSpanChunkBo.
public SpanChunkBo buildSpanChunkBo(TSpanChunk tSpanChunk) {
final SpanChunkBo spanChunkBo = newSpanChunkBo(tSpanChunk);
final LocalAsyncIdBo localAsyncIdBo = getLocalAsyncId(tSpanChunk);
if (localAsyncIdBo != null) {
spanChunkBo.setLocalAsyncId(localAsyncIdBo);
}
List<TSpanEvent> spanEventList = tSpanChunk.getSpanEventList();
List<SpanEventBo> spanEventBoList = buildSpanEventBoList(spanEventList);
spanChunkBo.addSpanEventBoList(spanEventBoList);
long acceptedTime = acceptedTimeService.getAcceptedTime();
spanChunkBo.setCollectorAcceptTime(acceptedTime);
return spanChunkBo;
}
use of com.navercorp.pinpoint.common.server.bo.SpanChunkBo in project pinpoint by naver.
the class GrpcSpanBinder method bindSpanChunkBo.
public SpanChunkBo bindSpanChunkBo(PSpanChunk pSpanChunk, Header header) {
checkVersion(pSpanChunk.getVersion());
final SpanChunkBo spanChunkBo = newSpanChunkBo(pSpanChunk, header);
if (pSpanChunk.hasLocalAsyncId()) {
final PLocalAsyncId pLocalAsyncId = pSpanChunk.getLocalAsyncId();
LocalAsyncIdBo localAsyncIdBo = new LocalAsyncIdBo(pLocalAsyncId.getAsyncId(), pLocalAsyncId.getSequence());
spanChunkBo.setLocalAsyncId(localAsyncIdBo);
}
return spanChunkBo;
}
use of com.navercorp.pinpoint.common.server.bo.SpanChunkBo in project pinpoint by naver.
the class GrpcSpanBinder method newSpanChunkBo.
// for test
SpanChunkBo newSpanChunkBo(PSpanChunk pSpanChunk, Header header) {
final SpanChunkBo spanChunkBo = new SpanChunkBo();
spanChunkBo.setVersion(pSpanChunk.getVersion());
spanChunkBo.setAgentId(header.getAgentId());
spanChunkBo.setApplicationId(header.getApplicationName());
spanChunkBo.setAgentStartTime(header.getAgentStartTime());
spanChunkBo.setApplicationServiceType((short) pSpanChunk.getApplicationServiceType());
if (pSpanChunk.hasTransactionId()) {
PTransactionId pTransactionId = pSpanChunk.getTransactionId();
TransactionId transactionId = newTransactionId(pTransactionId, spanChunkBo.getAgentId());
spanChunkBo.setTransactionId(transactionId);
} else {
logger.warn("PTransactionId is not set {}", pSpanChunk);
throw new IllegalStateException("PTransactionId is not set");
}
spanChunkBo.setKeyTime(pSpanChunk.getKeyTime());
spanChunkBo.setSpanId(pSpanChunk.getSpanId());
spanChunkBo.setEndPoint(pSpanChunk.getEndPoint());
return spanChunkBo;
}
use of com.navercorp.pinpoint.common.server.bo.SpanChunkBo in project pinpoint by naver.
the class SpanDecoderV0 method readSpanChunk.
private SpanChunkBo readSpanChunk(Buffer qualifier, Buffer columnValue, SpanDecodingContext decodingContext) {
final SpanChunkBo spanChunk = new SpanChunkBo();
final TransactionId transactionId = decodingContext.getTransactionId();
spanChunk.setTransactionId(transactionId);
spanChunk.setCollectorAcceptTime(decodingContext.getCollectorAcceptedTime());
readQualifier(spanChunk, qualifier);
readSpanChunkValue(columnValue, spanChunk, decodingContext);
return spanChunk;
}
Aggregations