Search in sources :

Example 41 with TransactionId

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

the class DefaultTransactionIdEncoderTest method testNormalTransactionId.

@Test
public void testNormalTransactionId() {
    TraceRoot traceRoot = getExternalTraceId();
    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(parsedTxId.getAgentId(), agentId2);
    Assert.assertEquals(parsedTxId.getAgentStartTime(), agentStartTime2);
    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 42 with TransactionId

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

the class DefaultTransactionIdEncoderTest method testDuplicateAgentId.

@Test
public void testDuplicateAgentId() {
    TraceRoot traceRoot = getDuplicateAgentId();
    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(), agentStartTime2);
    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 43 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(final String applicationName, Range range, int limit, boolean scanBackward) {
    Objects.requireNonNull(applicationName, "applicationName");
    Objects.requireNonNull(range, "range");
    if (limit < 0) {
        throw new IllegalArgumentException("negative limit:" + limit);
    }
    logger.debug("scanTraceIndex {}", range);
    Scan scan = createScan(applicationName, range, scanBackward);
    LastRowAccessor lastRowAccessor = new LastRowAccessor();
    TableName applicationTraceIndexTableName = tableNameProvider.getTableName(DESCRIPTOR.getTable());
    List<List<TransactionId>> traceIndexList = hbaseOperations2.findParallel(applicationTraceIndexTableName, scan, traceIdRowKeyDistributor, limit, traceIndexMapper, lastRowAccessor, APPLICATION_TRACE_INDEX_NUM_PARTITIONS);
    List<TransactionId> transactionIdSum = ListListUtils.toList(traceIndexList);
    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) LimitedScanResult(com.navercorp.pinpoint.web.vo.LimitedScanResult) TransactionId(com.navercorp.pinpoint.common.profiler.util.TransactionId)

Example 44 with TransactionId

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

the class SpanFactoryTest method testTransactionId_skip_agentId.

@Test
public void testTransactionId_skip_agentId() {
    TSpan tSpan = new TSpan();
    tSpan.setAgentId("agentId");
    byte[] transactionIdBytes = TransactionIdUtils.formatBytes(null, 1, 2);
    tSpan.setTransactionId(transactionIdBytes);
    SpanBo spanBo = spanFactory.newSpanBo(tSpan);
    TransactionId transactionId = spanBo.getTransactionId();
    Assert.assertEquals(transactionId.getAgentId(), "agentId");
    Assert.assertEquals(transactionId.getAgentStartTime(), 1);
    Assert.assertEquals(transactionId.getTransactionSequence(), 2);
}
Also used : TSpan(com.navercorp.pinpoint.thrift.dto.TSpan) RandomTSpan(com.navercorp.pinpoint.common.server.bo.RandomTSpan) SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) TransactionId(com.navercorp.pinpoint.common.profiler.util.TransactionId) Test(org.junit.Test)

Example 45 with TransactionId

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

the class SpanFactoryTest method testTransactionId_include_agentId.

@Test
public void testTransactionId_include_agentId() {
    TSpan tSpan = new TSpan();
    tSpan.setAgentId("agentId");
    byte[] transactionIdBytes = TransactionIdUtils.formatBytes("transactionAgentId", 1, 2);
    tSpan.setTransactionId(transactionIdBytes);
    SpanBo spanBo = spanFactory.newSpanBo(tSpan);
    TransactionId transactionId = spanBo.getTransactionId();
    Assert.assertEquals(transactionId.getAgentId(), "transactionAgentId");
    Assert.assertEquals(transactionId.getAgentStartTime(), 1);
    Assert.assertEquals(transactionId.getTransactionSequence(), 2);
}
Also used : TSpan(com.navercorp.pinpoint.thrift.dto.TSpan) RandomTSpan(com.navercorp.pinpoint.common.server.bo.RandomTSpan) SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) TransactionId(com.navercorp.pinpoint.common.profiler.util.TransactionId) Test(org.junit.Test)

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