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