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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations