Search in sources :

Example 36 with TransactionId

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

the class TraceRowKeyEncoderV2Test method encodeRowKey.

@Test
public void encodeRowKey() throws Exception {
    TransactionId spanTransactionId = new TransactionId("traceAgentId", System.currentTimeMillis(), RandomUtils.nextLong(0, 10000));
    byte[] rowKey = traceRowKeyEncoder.encodeRowKey(spanTransactionId);
    TransactionId transactionId = traceRowKeyDecoder.decodeRowKey(rowKey);
    Assert.assertEquals(transactionId, spanTransactionId);
}
Also used : TransactionId(com.navercorp.pinpoint.common.util.TransactionId) Test(org.junit.Test)

Example 37 with TransactionId

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

the class DefaultTraceContextTest method parseTest.

@Test
public void parseTest() {
    String agent = "test";
    long agentStartTime = System.currentTimeMillis();
    long agentTransactionCount = 10;
    TraceId traceId = new DefaultTraceId(agent, agentStartTime, agentTransactionCount);
    String id = traceId.getTransactionId();
    logger.debug("id={}", id);
    TransactionId transactionid = TransactionIdUtils.parseTransactionId(id);
    Assert.assertEquals(transactionid.getAgentId(), agent);
    Assert.assertEquals(transactionid.getAgentStartTime(), agentStartTime);
    Assert.assertEquals(transactionid.getTransactionSequence(), agentTransactionCount);
}
Also used : DefaultTraceId(com.navercorp.pinpoint.profiler.context.id.DefaultTraceId) TraceId(com.navercorp.pinpoint.bootstrap.context.TraceId) DefaultTraceId(com.navercorp.pinpoint.profiler.context.id.DefaultTraceId) TransactionId(com.navercorp.pinpoint.common.util.TransactionId) Test(org.junit.Test)

Example 38 with TransactionId

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

the class BusinessTransactionController method transactionInfo.

/**
     * info lookup for a selected transaction
     *
     * @param traceIdParam
     * @param focusTimestamp
     * @return
     */
@RequestMapping(value = "/transactionInfo", method = RequestMethod.GET)
@ResponseBody
public TransactionInfoViewModel transactionInfo(@RequestParam("traceId") String traceIdParam, @RequestParam(value = "focusTimestamp", required = false, defaultValue = "0") long focusTimestamp, @RequestParam(value = "agentId", required = false) String agentId, @RequestParam(value = "spanId", required = false, defaultValue = "-1") long spanId, @RequestParam(value = "v", required = false, defaultValue = "0") int viewVersion) {
    logger.debug("GET /transactionInfo params {traceId={}, focusTimestamp={}, agentId={}, spanId={}, v={}}", traceIdParam, focusTimestamp, agentId, spanId, viewVersion);
    final TransactionId transactionId = TransactionIdUtils.parseTransactionId(traceIdParam);
    // select spans
    final SpanResult spanResult = this.spanService.selectSpan(transactionId, focusTimestamp);
    final CallTreeIterator callTreeIterator = spanResult.getCallTree();
    // application map
    ApplicationMap map = filteredMapService.selectApplicationMap(transactionId);
    RecordSet recordSet = this.transactionInfoService.createRecordSet(callTreeIterator, focusTimestamp, agentId, spanId);
    TransactionInfoViewModel result = new TransactionInfoViewModel(transactionId, map.getNodes(), map.getLinks(), recordSet, spanResult.getCompleteTypeString(), logLinkEnable, logButtonName, logPageUrl, disableButtonMessage);
    return result;
}
Also used : ApplicationMap(com.navercorp.pinpoint.web.applicationmap.ApplicationMap) CallTreeIterator(com.navercorp.pinpoint.web.calltree.span.CallTreeIterator) SpanResult(com.navercorp.pinpoint.web.service.SpanResult) TransactionInfoViewModel(com.navercorp.pinpoint.web.view.TransactionInfoViewModel) RecordSet(com.navercorp.pinpoint.web.vo.callstacks.RecordSet) TransactionId(com.navercorp.pinpoint.common.util.TransactionId) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 39 with TransactionId

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

the class HbaseApplicationTraceIndexDao method scanTraceIndex.

@Override
public LimitedScanResult<List<TransactionId>> scanTraceIndex(final String applicationName, Range range, int limit, boolean scanBackward) {
    if (applicationName == null) {
        throw new NullPointerException("applicationName must not be null");
    }
    if (range == null) {
        throw new NullPointerException("range must not be null");
    }
    if (limit < 0) {
        throw new IllegalArgumentException("negative limit:" + limit);
    }
    logger.debug("scanTraceIndex");
    Scan scan = createScan(applicationName, range, scanBackward);
    final LimitedScanResult<List<TransactionId>> limitedScanResult = new LimitedScanResult<>();
    LastRowAccessor lastRowAccessor = new LastRowAccessor();
    List<List<TransactionId>> traceIndexList = hbaseOperations2.findParallel(HBaseTables.APPLICATION_TRACE_INDEX, scan, traceIdRowKeyDistributor, limit, traceIndexMapper, lastRowAccessor, APPLICATION_TRACE_INDEX_NUM_PARTITIONS);
    List<TransactionId> transactionIdSum = new ArrayList<>(128);
    for (List<TransactionId> transactionId : traceIndexList) {
        transactionIdSum.addAll(transactionId);
    }
    limitedScanResult.setScanData(transactionIdSum);
    if (transactionIdSum.size() >= limit) {
        Long lastRowTimestamp = lastRowAccessor.getLastRowTimestamp();
        limitedScanResult.setLimitedTime(lastRowTimestamp);
        if (logger.isDebugEnabled()) {
            logger.debug("lastRowTimestamp lastTime:{}", DateUtils.longToDateStr(lastRowTimestamp));
        }
    } else {
        if (logger.isDebugEnabled()) {
            logger.debug("scanner start lastTime:{}", DateUtils.longToDateStr(range.getFrom()));
        }
        limitedScanResult.setLimitedTime(range.getFrom());
    }
    return limitedScanResult;
}
Also used : ArrayList(java.util.ArrayList) Scan(org.apache.hadoop.hbase.client.Scan) FilterList(org.apache.hadoop.hbase.filter.FilterList) ArrayList(java.util.ArrayList) List(java.util.List) LimitedScanResult(com.navercorp.pinpoint.web.vo.LimitedScanResult) TransactionId(com.navercorp.pinpoint.common.util.TransactionId)

Example 40 with TransactionId

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

the class TraceIndexScatterMapper method createDot.

private Dot createDot(Cell cell) {
    final Buffer valueBuffer = new OffsetFixedBuffer(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());
    int elapsed = valueBuffer.readVInt();
    int exceptionCode = valueBuffer.readSVInt();
    String agentId = valueBuffer.readPrefixedString();
    long reverseAcceptedTime = BytesUtils.bytesToLong(cell.getRowArray(), cell.getRowOffset() + HBaseTables.APPLICATION_NAME_MAX_LEN + HBaseTables.APPLICATION_TRACE_INDEX_ROW_DISTRIBUTE_SIZE);
    long acceptedTime = TimeUtils.recoveryTimeMillis(reverseAcceptedTime);
    final int qualifierOffset = cell.getQualifierOffset();
    TransactionId transactionId = TransactionIdMapper.parseVarTransactionId(cell.getQualifierArray(), qualifierOffset, cell.getQualifierLength());
    return new Dot(transactionId, acceptedTime, elapsed, exceptionCode, agentId);
}
Also used : Buffer(com.navercorp.pinpoint.common.buffer.Buffer) OffsetFixedBuffer(com.navercorp.pinpoint.common.buffer.OffsetFixedBuffer) Dot(com.navercorp.pinpoint.web.vo.scatter.Dot) OffsetFixedBuffer(com.navercorp.pinpoint.common.buffer.OffsetFixedBuffer) TransactionId(com.navercorp.pinpoint.common.util.TransactionId)

Aggregations

TransactionId (com.navercorp.pinpoint.common.util.TransactionId)44 ArrayList (java.util.ArrayList)11 Dot (com.navercorp.pinpoint.web.vo.scatter.Dot)9 Test (org.junit.Test)9 Buffer (com.navercorp.pinpoint.common.buffer.Buffer)8 SpanBo (com.navercorp.pinpoint.common.server.bo.SpanBo)8 OffsetFixedBuffer (com.navercorp.pinpoint.common.buffer.OffsetFixedBuffer)7 SpanEventBo (com.navercorp.pinpoint.common.server.bo.SpanEventBo)5 List (java.util.List)5 Put (org.apache.hadoop.hbase.client.Put)4 ByteBuffer (java.nio.ByteBuffer)3 Cell (org.apache.hadoop.hbase.Cell)3 SpanChunkBo (com.navercorp.pinpoint.common.server.bo.SpanChunkBo)2 TSpan (com.navercorp.pinpoint.thrift.dto.TSpan)2 TSpanEvent (com.navercorp.pinpoint.thrift.dto.TSpanEvent)2 ScatterData (com.navercorp.pinpoint.web.scatter.ScatterData)2 LimitedScanResult (com.navercorp.pinpoint.web.vo.LimitedScanResult)2 Get (org.apache.hadoop.hbase.client.Get)2 Scan (org.apache.hadoop.hbase.client.Scan)2 FilterList (org.apache.hadoop.hbase.filter.FilterList)2