Search in sources :

Example 31 with TransactionId

use of com.navercorp.pinpoint.common.profiler.util.TransactionId in project pinpoint by naver.

the class ScatterChartServiceImpl method selectScatterData.

@Override
public List<Dot> selectScatterData(List<TransactionId> transactionIdList, String applicationName, Filter<List<SpanBo>> filter) {
    Objects.requireNonNull(transactionIdList, "transactionIdList");
    Objects.requireNonNull(applicationName, "applicationName");
    Objects.requireNonNull(filter, "filter");
    final List<List<SpanBo>> traceList = traceDao.selectAllSpans(transactionIdList);
    final List<Dot> result = new ArrayList<>();
    for (List<SpanBo> trace : traceList) {
        if (!filter.include(trace)) {
            continue;
        }
        for (SpanBo span : trace) {
            if (applicationName.equals(span.getApplicationId())) {
                final TransactionId transactionId = span.getTransactionId();
                final Dot dot = new Dot(transactionId, span.getCollectorAcceptTime(), span.getElapsed(), span.getErrCode(), span.getAgentId());
                result.add(dot);
            }
        }
    }
    return result;
}
Also used : Dot(com.navercorp.pinpoint.web.vo.scatter.Dot) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) TransactionId(com.navercorp.pinpoint.common.profiler.util.TransactionId)

Example 32 with TransactionId

use of com.navercorp.pinpoint.common.profiler.util.TransactionId in project pinpoint by naver.

the class RecordFactoryTest method getException_check_argument.

@Test
public void getException_check_argument() {
    final RecordFactory factory = newRecordFactory();
    SpanBo spanBo = new SpanBo();
    spanBo.setTransactionId(new TransactionId("test", 0, 0));
    spanBo.setExceptionInfo(1, null);
    Align align = new SpanAlign(spanBo);
    Record exceptionRecord = factory.getException(0, 0, align);
    Assert.assertNotNull(exceptionRecord.getArguments());
}
Also used : SpanAlign(com.navercorp.pinpoint.web.calltree.span.SpanAlign) SpanAlign(com.navercorp.pinpoint.web.calltree.span.SpanAlign) Align(com.navercorp.pinpoint.web.calltree.span.Align) SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) TransactionId(com.navercorp.pinpoint.common.profiler.util.TransactionId) Test(org.junit.Test)

Example 33 with TransactionId

use of com.navercorp.pinpoint.common.profiler.util.TransactionId in project pinpoint by naver.

the class HbaseTraceDaoV2 method insert.

@Override
public boolean insert(final SpanBo spanBo) {
    Objects.requireNonNull(spanBo, "spanBo");
    if (logger.isDebugEnabled()) {
        logger.debug("insert trace: {}", spanBo);
    }
    // Assert agentId
    CollectorUtils.checkAgentId(spanBo.getAgentId());
    // Assert applicationName
    CollectorUtils.checkApplicationName(spanBo.getApplicationId());
    long acceptedTime = spanBo.getCollectorAcceptTime();
    TransactionId transactionId = spanBo.getTransactionId();
    final byte[] rowKey = this.rowKeyEncoder.encodeRowKey(transactionId);
    final Put put = new Put(rowKey, acceptedTime);
    this.spanSerializer.serialize(spanBo, put, null);
    TableName traceTableName = tableNameProvider.getTableName(descriptor.getTable());
    return writer.write(traceTableName, put);
}
Also used : TableName(org.apache.hadoop.hbase.TableName) Put(org.apache.hadoop.hbase.client.Put) TransactionId(com.navercorp.pinpoint.common.profiler.util.TransactionId)

Example 34 with TransactionId

use of com.navercorp.pinpoint.common.profiler.util.TransactionId in project pinpoint by naver.

the class HbaseTraceDaoV2 method insertSpanChunk.

@Override
public void insertSpanChunk(SpanChunkBo spanChunkBo) {
    Objects.requireNonNull(spanChunkBo, "spanChunkBo");
    TransactionId transactionId = spanChunkBo.getTransactionId();
    final byte[] rowKey = this.rowKeyEncoder.encodeRowKey(transactionId);
    final long acceptedTime = spanChunkBo.getCollectorAcceptTime();
    final Put put = new Put(rowKey, acceptedTime);
    final List<SpanEventBo> spanEventBoList = spanChunkBo.getSpanEventBoList();
    if (CollectionUtils.isEmpty(spanEventBoList)) {
        return;
    }
    this.spanChunkSerializer.serialize(spanChunkBo, put, null);
    if (!put.isEmpty()) {
        TableName traceTableName = tableNameProvider.getTableName(descriptor.getTable());
        writer.write(traceTableName, put);
    }
}
Also used : TableName(org.apache.hadoop.hbase.TableName) Put(org.apache.hadoop.hbase.client.Put) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo) TransactionId(com.navercorp.pinpoint.common.profiler.util.TransactionId)

Example 35 with TransactionId

use of com.navercorp.pinpoint.common.profiler.util.TransactionId in project pinpoint by naver.

the class GrpcSpanBinder method newSpanBo.

// for test
SpanBo newSpanBo(PSpan pSpan, Header header) {
    final SpanBo spanBo = new SpanBo();
    spanBo.setVersion(pSpan.getVersion());
    spanBo.setAgentId(header.getAgentId());
    spanBo.setApplicationId(header.getApplicationName());
    spanBo.setAgentStartTime(header.getAgentStartTime());
    if (!pSpan.hasTransactionId()) {
        throw new IllegalStateException("hasTransactionId() is false " + MessageFormatUtils.debugLog(pSpan));
    }
    final TransactionId transactionId = newTransactionId(pSpan.getTransactionId(), spanBo.getAgentId());
    spanBo.setTransactionId(transactionId);
    spanBo.setSpanId(pSpan.getSpanId());
    spanBo.setParentSpanId(pSpan.getParentSpanId());
    spanBo.setStartTime(pSpan.getStartTime());
    spanBo.setElapsed(pSpan.getElapsed());
    spanBo.setServiceType((short) pSpan.getServiceType());
    spanBo.setFlag((short) pSpan.getFlag());
    spanBo.setApiId(pSpan.getApiId());
    spanBo.setErrCode(pSpan.getErr());
    spanBo.setLoggingTransactionInfo((byte) pSpan.getLoggingTransactionInfo());
    spanBo.setApplicationServiceType((short) pSpan.getApplicationServiceType());
    if (pSpan.hasAcceptEvent()) {
        final PAcceptEvent acceptEvent = pSpan.getAcceptEvent();
        final String rpc = acceptEvent.getRpc();
        if (StringUtils.hasLength(rpc)) {
            spanBo.setRpc(rpc);
        }
        final String remoteAddr = acceptEvent.getRemoteAddr();
        if (StringUtils.hasLength(remoteAddr)) {
            spanBo.setRemoteAddr(remoteAddr);
        }
        final String endPoint = acceptEvent.getEndPoint();
        if (StringUtils.hasLength(endPoint)) {
            spanBo.setEndPoint(endPoint);
        }
        if (acceptEvent.hasParentInfo()) {
            final PParentInfo parentInfo = acceptEvent.getParentInfo();
            final String acceptorHost = parentInfo.getAcceptorHost();
            if (StringUtils.hasLength(acceptorHost)) {
                spanBo.setAcceptorHost(acceptorHost);
            }
            final String parentApplicationName = parentInfo.getParentApplicationName();
            if (StringUtils.hasLength(parentApplicationName)) {
                spanBo.setParentApplicationId(parentApplicationName);
            }
            spanBo.setParentApplicationServiceType((short) parentInfo.getParentApplicationType());
        }
    }
    // because exceptionInfo is the error information of span itself, exceptionInfo can be null even if errCode is not 0
    if (pSpan.hasExceptionInfo()) {
        final PIntStringValue exceptionInfo = pSpan.getExceptionInfo();
        spanBo.setExceptionInfo(exceptionInfo.getIntValue(), getExceptionMessage(exceptionInfo));
    }
    List<AnnotationBo> annotationBoList = buildAnnotationList(pSpan.getAnnotationList());
    spanBo.setAnnotationBoList(annotationBoList);
    return spanBo;
}
Also used : AnnotationBo(com.navercorp.pinpoint.common.server.bo.AnnotationBo) PIntStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringValue) PParentInfo(com.navercorp.pinpoint.grpc.trace.PParentInfo) PAcceptEvent(com.navercorp.pinpoint.grpc.trace.PAcceptEvent) SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) PTransactionId(com.navercorp.pinpoint.grpc.trace.PTransactionId) TransactionId(com.navercorp.pinpoint.common.profiler.util.TransactionId)

Aggregations

TransactionId (com.navercorp.pinpoint.common.profiler.util.TransactionId)51 Test (org.junit.Test)18 SpanBo (com.navercorp.pinpoint.common.server.bo.SpanBo)15 ArrayList (java.util.ArrayList)12 Dot (com.navercorp.pinpoint.web.vo.scatter.Dot)9 ByteBuffer (java.nio.ByteBuffer)6 List (java.util.List)6 AnnotationBo (com.navercorp.pinpoint.common.server.bo.AnnotationBo)5 TraceId (com.navercorp.pinpoint.bootstrap.context.TraceId)4 Buffer (com.navercorp.pinpoint.common.buffer.Buffer)4 SpanChunkBo (com.navercorp.pinpoint.common.server.bo.SpanChunkBo)4 DefaultTraceId (com.navercorp.pinpoint.profiler.context.id.DefaultTraceId)4 ColumnGetCount (com.navercorp.pinpoint.common.hbase.bo.ColumnGetCount)3 DefaultTraceRoot (com.navercorp.pinpoint.profiler.context.id.DefaultTraceRoot)3 TraceRoot (com.navercorp.pinpoint.profiler.context.id.TraceRoot)3 CallTreeIterator (com.navercorp.pinpoint.web.calltree.span.CallTreeIterator)3 SpanResult (com.navercorp.pinpoint.web.service.SpanResult)3 RecordSet (com.navercorp.pinpoint.web.vo.callstacks.RecordSet)3 TableName (org.apache.hadoop.hbase.TableName)3 GetMapping (org.springframework.web.bind.annotation.GetMapping)3