Search in sources :

Example 16 with SpanChunkBo

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);
    }
}
Also used : SpanChunkBo(com.navercorp.pinpoint.common.server.bo.SpanChunkBo) ServiceType(com.navercorp.pinpoint.common.trace.ServiceType) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo)

Example 17 with SpanChunkBo

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;
}
Also used : SpanChunkBo(com.navercorp.pinpoint.common.server.bo.SpanChunkBo) LocalAsyncIdBo(com.navercorp.pinpoint.common.server.bo.LocalAsyncIdBo) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo)

Example 18 with 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;
}
Also used : SpanChunkBo(com.navercorp.pinpoint.common.server.bo.SpanChunkBo) PLocalAsyncId(com.navercorp.pinpoint.grpc.trace.PLocalAsyncId) LocalAsyncIdBo(com.navercorp.pinpoint.common.server.bo.LocalAsyncIdBo)

Example 19 with 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;
}
Also used : SpanChunkBo(com.navercorp.pinpoint.common.server.bo.SpanChunkBo) PTransactionId(com.navercorp.pinpoint.grpc.trace.PTransactionId) PTransactionId(com.navercorp.pinpoint.grpc.trace.PTransactionId) TransactionId(com.navercorp.pinpoint.common.profiler.util.TransactionId)

Example 20 with 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;
}
Also used : SpanChunkBo(com.navercorp.pinpoint.common.server.bo.SpanChunkBo) TransactionId(com.navercorp.pinpoint.common.profiler.util.TransactionId)

Aggregations

SpanChunkBo (com.navercorp.pinpoint.common.server.bo.SpanChunkBo)27 SpanEventBo (com.navercorp.pinpoint.common.server.bo.SpanEventBo)13 Test (org.junit.Test)8 Header (com.navercorp.pinpoint.grpc.Header)5 TransactionId (com.navercorp.pinpoint.common.profiler.util.TransactionId)4 LocalAsyncIdBo (com.navercorp.pinpoint.common.server.bo.LocalAsyncIdBo)4 PSpanChunk (com.navercorp.pinpoint.grpc.trace.PSpanChunk)4 ByteBuffer (java.nio.ByteBuffer)4 Buffer (com.navercorp.pinpoint.common.buffer.Buffer)3 SpanBo (com.navercorp.pinpoint.common.server.bo.SpanBo)3 ArrayList (java.util.ArrayList)3 FixedBuffer (com.navercorp.pinpoint.common.buffer.FixedBuffer)2 TSpanChunk (com.navercorp.pinpoint.thrift.dto.TSpanChunk)2 TSpanEvent (com.navercorp.pinpoint.thrift.dto.TSpanEvent)2 AutomaticBuffer (com.navercorp.pinpoint.common.buffer.AutomaticBuffer)1 StringCacheableBuffer (com.navercorp.pinpoint.common.buffer.StringCacheableBuffer)1 SpanDecoder (com.navercorp.pinpoint.common.server.bo.serializer.trace.v2.SpanDecoder)1 SpanDecodingContext (com.navercorp.pinpoint.common.server.bo.serializer.trace.v2.SpanDecodingContext)1 ServiceType (com.navercorp.pinpoint.common.trace.ServiceType)1 PLocalAsyncId (com.navercorp.pinpoint.grpc.trace.PLocalAsyncId)1