Search in sources :

Example 11 with TransactionId

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

the class SpanFactory method newSpanBo.

// for test
SpanBo newSpanBo(TSpan tSpan) {
    final SpanBo spanBo = new SpanBo();
    spanBo.setAgentId(tSpan.getAgentId());
    spanBo.setApplicationId(tSpan.getApplicationName());
    spanBo.setAgentStartTime(tSpan.getAgentStartTime());
    final TransactionId transactionId = newTransactionId(tSpan.getTransactionId(), spanBo.getAgentId());
    spanBo.setTransactionId(transactionId);
    spanBo.setSpanId(tSpan.getSpanId());
    spanBo.setParentSpanId(tSpan.getParentSpanId());
    spanBo.setStartTime(tSpan.getStartTime());
    spanBo.setElapsed(tSpan.getElapsed());
    spanBo.setRpc(tSpan.getRpc());
    spanBo.setServiceType(tSpan.getServiceType());
    spanBo.setEndPoint(tSpan.getEndPoint());
    spanBo.setFlag(tSpan.getFlag());
    spanBo.setApiId(tSpan.getApiId());
    spanBo.setErrCode(tSpan.getErr());
    spanBo.setAcceptorHost(tSpan.getAcceptorHost());
    spanBo.setRemoteAddr(tSpan.getRemoteAddr());
    spanBo.setLoggingTransactionInfo(tSpan.getLoggingTransactionInfo());
    // applicationServiceType is not saved for older versions where applicationServiceType does not exist.
    if (tSpan.isSetApplicationServiceType()) {
        spanBo.setApplicationServiceType(tSpan.getApplicationServiceType());
    } else {
        spanBo.setApplicationServiceType(tSpan.getServiceType());
    }
    spanBo.setParentApplicationId(tSpan.getParentApplicationName());
    spanBo.setParentApplicationServiceType(tSpan.getParentApplicationType());
    // FIXME span.errCode contains error of span and spanEvent
    // because exceptionInfo is the error information of span itself, exceptionInfo can be null even if errCode is not 0
    final TIntStringValue exceptionInfo = tSpan.getExceptionInfo();
    if (exceptionInfo != null) {
        spanBo.setExceptionInfo(exceptionInfo.getIntValue(), exceptionInfo.getStringValue());
    }
    List<AnnotationBo> annotationBoList = buildAnnotationList(tSpan.getAnnotations());
    spanBo.setAnnotationBoList(annotationBoList);
    return spanBo;
}
Also used : TIntStringValue(com.navercorp.pinpoint.thrift.dto.TIntStringValue) AnnotationBo(com.navercorp.pinpoint.common.server.bo.AnnotationBo) SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) TransactionId(com.navercorp.pinpoint.common.profiler.util.TransactionId)

Example 12 with TransactionId

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

the class SpanUtils method getVarTransactionId.

public static byte[] getVarTransactionId(SpanBo span) {
    Objects.requireNonNull(span, "span");
    final TransactionId transactionId = span.getTransactionId();
    String agentId = transactionId.getAgentId();
    if (agentId == null) {
        agentId = span.getAgentId();
    }
    final Buffer buffer = new AutomaticBuffer(32);
    buffer.putPrefixedString(agentId);
    buffer.putSVLong(transactionId.getAgentStartTime());
    buffer.putVLong(transactionId.getTransactionSequence());
    return buffer.getBuffer();
}
Also used : Buffer(com.navercorp.pinpoint.common.buffer.Buffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) TransactionId(com.navercorp.pinpoint.common.profiler.util.TransactionId)

Example 13 with TransactionId

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

the class DefaultTransactionIdEncoderTest method testCompressedTransactionId.

@Test
public void testCompressedTransactionId() {
    TraceRoot traceRoot = getRootTraceId();
    TraceId traceId = traceRoot.getTraceId();
    ByteBuffer encodeTxId = transactionIdEncoder.encodeTransactionId(traceId);
    byte[] transactionId = Arrays.copyOf(encodeTxId.array(), encodeTxId.remaining());
    TransactionId parsedTxId = TransactionIdUtils.parseTransactionId(transactionId, DEFAULT_AGENT_ID);
    logger.debug("transactionId:{}", parsedTxId);
    Assert.assertEquals(DEFAULT_AGENT_ID, parsedTxId.getAgentId());
    Assert.assertEquals(parsedTxId.getAgentStartTime(), agentStartTime);
    Assert.assertEquals(parsedTxId.getTransactionSequence(), transactionId2);
}
Also used : DefaultTraceId(com.navercorp.pinpoint.profiler.context.id.DefaultTraceId) TraceId(com.navercorp.pinpoint.bootstrap.context.TraceId) DefaultTraceRoot(com.navercorp.pinpoint.profiler.context.id.DefaultTraceRoot) TraceRoot(com.navercorp.pinpoint.profiler.context.id.TraceRoot) ByteBuffer(java.nio.ByteBuffer) TransactionId(com.navercorp.pinpoint.common.profiler.util.TransactionId) Test(org.junit.Test)

Example 14 with TransactionId

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

the class HbaseApplicationTraceIndexDao method scanTraceIndex.

@Override
public LimitedScanResult<List<TransactionId>> scanTraceIndex(String applicationName, DragArea dragArea, int limit) {
    Objects.requireNonNull(applicationName, "applicationName");
    Objects.requireNonNull(dragArea, "dragArea");
    LastRowAccessor lastRowAccessor = new LastRowAccessor();
    final Range range = Range.newUncheckedRange(dragArea.getXLow(), dragArea.getXHigh());
    logger.debug("scanTraceIndex range:{}", range);
    final Scan scan = newFuzzyScanner(applicationName, dragArea, range);
    // TODO
    // Predicate<Dot> filter = ElpasedTimeDotPredicate.newDragAreaDotPredicate(dragArea);
    final TableName applicationTraceIndexTableName = tableNameProvider.getTableName(DESCRIPTOR.getTable());
    List<List<TransactionId>> listList = this.hbaseOperations2.findParallel(applicationTraceIndexTableName, scan, traceIdRowKeyDistributor, limit, traceIndexMapper, lastRowAccessor, APPLICATION_TRACE_INDEX_NUM_PARTITIONS);
    List<TransactionId> transactionIdSum = ListListUtils.toList(listList);
    final long lastTime = getLastTime(range, limit, lastRowAccessor, transactionIdSum);
    return new LimitedScanResult<>(lastTime, transactionIdSum);
}
Also used : TableName(org.apache.hadoop.hbase.TableName) Scan(org.apache.hadoop.hbase.client.Scan) List(java.util.List) Range(com.navercorp.pinpoint.web.vo.Range) LimitedScanResult(com.navercorp.pinpoint.web.vo.LimitedScanResult) TransactionId(com.navercorp.pinpoint.common.profiler.util.TransactionId)

Example 15 with TransactionId

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

the class GetTraceInfoParser method parse.

public List<GetTraceInfo> parse(Map<String, String> requestParam) {
    final String applicationName = requestParam.get(APPLICATION_NAME);
    List<GetTraceInfo> getTraceInfoList = new ArrayList<>();
    int index = 0;
    while (true) {
        final String transactionId = requestParam.get(PREFIX_TRANSACTION_ID + index);
        final String time = requestParam.get(PREFIX_TIME + index);
        final String responseTime = requestParam.get(PREFIX_RESPONSE_TIME + index);
        if (transactionId == null || time == null || responseTime == null) {
            break;
        }
        TransactionId traceId = TransactionIdUtils.parseTransactionId(transactionId);
        SpanHint spanHint = new SpanHint(Long.parseLong(time), Integer.parseInt(responseTime), applicationName);
        final GetTraceInfo getTraceInfo = new GetTraceInfo(traceId, spanHint);
        getTraceInfoList.add(getTraceInfo);
        index++;
    }
    logger.debug("query:{}", getTraceInfoList);
    return getTraceInfoList;
}
Also used : ArrayList(java.util.ArrayList) 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