Search in sources :

Example 46 with TransactionId

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

the class TraceRowKeyEncoderV2Test method encodeRowKey.

@Test
public void encodeRowKey() {
    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.profiler.util.TransactionId) Test(org.junit.Test)

Example 47 with TransactionId

use of com.navercorp.pinpoint.common.profiler.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.profiler.util.TransactionId) Test(org.junit.Test)

Example 48 with TransactionId

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

the class TransactionIdMapper method mapRow.

@Override
public List<TransactionId> mapRow(Result result, int rowNum) throws Exception {
    if (result.isEmpty()) {
        return Collections.emptyList();
    }
    Cell[] rawCells = result.rawCells();
    List<TransactionId> traceIdList = new ArrayList<>(rawCells.length);
    for (Cell cell : rawCells) {
        final byte[] qualifierArray = cell.getQualifierArray();
        final int qualifierOffset = cell.getQualifierOffset();
        final int qualifierLength = cell.getQualifierLength();
        // increment by value of key
        TransactionId traceId = parseVarTransactionId(qualifierArray, qualifierOffset, qualifierLength);
        traceIdList.add(traceId);
        logger.debug("found traceId {}", traceId);
    }
    return traceIdList;
}
Also used : ArrayList(java.util.ArrayList) Cell(org.apache.hadoop.hbase.Cell) TransactionId(com.navercorp.pinpoint.common.profiler.util.TransactionId)

Example 49 with TransactionId

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

the class TraceIndexScatterMapper method createDot.

static 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();
    final int acceptTimeOffset = cell.getRowOffset() + HbaseTableConstants.APPLICATION_NAME_MAX_LEN + HbaseColumnFamily.APPLICATION_TRACE_INDEX_TRACE.ROW_DISTRIBUTE_SIZE;
    long reverseAcceptedTime = BytesUtils.bytesToLong(cell.getRowArray(), acceptTimeOffset);
    long acceptedTime = TimeUtils.recoveryTimeMillis(reverseAcceptedTime);
    TransactionId transactionId = TransactionIdMapper.parseVarTransactionId(cell.getQualifierArray(), cell.getQualifierOffset(), 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.profiler.util.TransactionId)

Example 50 with TransactionId

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

the class BusinessTransactionController method transactionTimelineInfo.

/**
 * info lookup for a selected transaction
 *
 * @param traceId
 * @param focusTimestamp
 * @return
 */
@GetMapping(value = "/transactionTimelineInfo")
public TransactionTimelineInfoViewModel transactionTimelineInfo(@RequestParam("traceId") String traceId, @RequestParam(value = "focusTimestamp", required = false, defaultValue = DEFAULT_FOCUS_TIMESTAMP) long focusTimestamp, @RequestParam(value = "agentId", required = false) String agentId, @RequestParam(value = "spanId", required = false, defaultValue = DEFAULT_SPANID) long spanId) {
    logger.debug("GET /transactionTimelineInfo params {traceId={}, focusTimestamp={}, agentId={}, spanId={}}", traceId, focusTimestamp, agentId, spanId);
    final TransactionId transactionId = TransactionIdUtils.parseTransactionId(traceId);
    final ColumnGetCount columnGetCount = ColumnGetCountFactory.create(callstackSelectSpansLimit);
    // select spans
    Predicate<SpanBo> spanMatchFilter = SpanFilters.spanFilter(spanId, agentId, focusTimestamp);
    SpanResult spanResult = this.spanService.selectSpan(transactionId, spanMatchFilter, columnGetCount);
    final CallTreeIterator callTreeIterator = spanResult.getCallTree();
    String traceViewerDataURL = ServletUriComponentsBuilder.fromPath("traceViewerData.pinpoint").queryParam("traceId", URLEncoder.encode(traceId, StandardCharsets.UTF_8)).queryParam("focusTimestamp", focusTimestamp).queryParam("agentId", URLEncoder.encode(agentId, StandardCharsets.UTF_8)).queryParam("spanId", spanId).build().toUriString();
    RecordSet recordSet = this.transactionInfoService.createRecordSet(callTreeIterator, spanMatchFilter);
    return new TransactionTimelineInfoViewModel(transactionId, spanId, recordSet, traceViewerDataURL, logConfiguration);
}
Also used : ColumnGetCount(com.navercorp.pinpoint.common.hbase.bo.ColumnGetCount) CallTreeIterator(com.navercorp.pinpoint.web.calltree.span.CallTreeIterator) SpanResult(com.navercorp.pinpoint.web.service.SpanResult) TransactionTimelineInfoViewModel(com.navercorp.pinpoint.web.view.TransactionTimelineInfoViewModel) RecordSet(com.navercorp.pinpoint.web.vo.callstacks.RecordSet) SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) TransactionId(com.navercorp.pinpoint.common.profiler.util.TransactionId) GetMapping(org.springframework.web.bind.annotation.GetMapping)

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