use of com.navercorp.pinpoint.common.util.TransactionId in project pinpoint by naver.
the class TransactionMetadataQuery method addQueryCondition.
public void addQueryCondition(String transactionId, long collectorAcceptTime, int responseTime) {
if (transactionId == null) {
throw new NullPointerException("transactionId must not be null");
}
TransactionId traceId = TransactionIdUtils.parseTransactionId(transactionId);
QueryCondition condition = new QueryCondition(traceId, collectorAcceptTime, responseTime);
queryConditionList.add(condition);
}
use of com.navercorp.pinpoint.common.util.TransactionId in project pinpoint by naver.
the class SpanBoTest method serialize_V1.
@Test
public void serialize_V1() {
final SpanBo spanBo = new SpanBo();
spanBo.setAgentId("agentId");
spanBo.setApplicationId("applicationId");
spanBo.setEndPoint("end");
spanBo.setRpc("rpc");
spanBo.setParentSpanId(5);
spanBo.setAgentStartTime(1);
TransactionId transactionId = new TransactionId("agentId", 2, 3);
spanBo.setTransactionId(transactionId);
spanBo.setElapsed(4);
spanBo.setStartTime(5);
spanBo.setServiceType(ServiceType.STAND_ALONE.getCode());
spanBo.setLoggingTransactionInfo(LoggingInfo.INFO.getCode());
spanBo.setExceptionInfo(1000, "Exception");
ByteBuffer bytes = spanSerializer.writeColumnValue(spanBo);
SpanBo newSpanBo = new SpanBo();
Buffer valueBuffer = new OffsetFixedBuffer(bytes.array(), bytes.arrayOffset(), bytes.remaining());
int i = spanDecoder.readSpan(newSpanBo, valueBuffer);
logger.debug("length:{}", i);
Assert.assertEquals(bytes.limit(), i);
Assert.assertEquals(newSpanBo.getAgentId(), spanBo.getAgentId());
Assert.assertEquals(newSpanBo.getApplicationId(), spanBo.getApplicationId());
Assert.assertEquals(newSpanBo.getAgentStartTime(), spanBo.getAgentStartTime());
Assert.assertEquals(newSpanBo.getElapsed(), spanBo.getElapsed());
Assert.assertEquals(newSpanBo.getEndPoint(), spanBo.getEndPoint());
Assert.assertEquals(newSpanBo.getErrCode(), spanBo.getErrCode());
Assert.assertEquals(newSpanBo.getFlag(), spanBo.getFlag());
// not included for serialization
// Assert.assertEquals(newSpanBo.getTraceAgentStartTime(), spanBo.getTraceAgentStartTime());
// Assert.assertEquals(newSpanBo.getTraceTransactionSequence(), spanBo.getTraceTransactionSequence());
Assert.assertEquals(newSpanBo.getParentSpanId(), spanBo.getParentSpanId());
Assert.assertEquals(newSpanBo.getServiceType(), spanBo.getServiceType());
Assert.assertEquals(newSpanBo.getApplicationServiceType(), spanBo.getServiceType());
Assert.assertEquals(newSpanBo.getVersion(), spanBo.getVersion());
Assert.assertEquals(newSpanBo.getLoggingTransactionInfo(), spanBo.getLoggingTransactionInfo());
Assert.assertEquals(newSpanBo.getExceptionId(), spanBo.getExceptionId());
Assert.assertEquals(newSpanBo.getExceptionMessage(), spanBo.getExceptionMessage());
}
use of com.navercorp.pinpoint.common.util.TransactionId in project pinpoint by naver.
the class SpanFactoryTest method testTransactionId_include_agentId.
@Test
public void testTransactionId_include_agentId() throws Exception {
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);
}
use of com.navercorp.pinpoint.common.util.TransactionId in project pinpoint by naver.
the class SpanUtilsTest method testGetTransactionId_BasicSpan.
@Test
public void testGetTransactionId_BasicSpan() {
SpanBo spanBo = new SpanBo();
TransactionId spanTransactionId = new TransactionId("traceAgentId", System.currentTimeMillis(), 1111);
spanBo.setTransactionId(spanTransactionId);
byte[] transactionIdRowkey = SpanUtils.getTransactionId(spanBo);
TraceRowKeyDecoderV2 decoder = new TraceRowKeyDecoderV2();
TransactionId transactionId = decoder.readTransactionId(transactionIdRowkey);
Assert.assertEquals(transactionId, spanBo.getTransactionId());
}
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, SelectedScatterArea area, int limit) {
if (applicationName == null) {
throw new NullPointerException("applicationName must not be null");
}
if (area == null) {
throw new NullPointerException("area must not be null");
}
if (limit < 0) {
throw new IllegalArgumentException("negative limit:" + limit);
}
logger.debug("scanTraceIndex");
Scan scan = createScan(applicationName, area.getTimeRange());
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(area.getTimeRange().getFrom()));
}
limitedScanResult.setLimitedTime(area.getTimeRange().getFrom());
}
return limitedScanResult;
}
Aggregations