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