use of com.navercorp.pinpoint.common.profiler.util.TransactionId in project pinpoint by naver.
the class SpanFactory method newSpanBo.
// for test
SpanBo newSpanBo(TSpan tSpan) {
final SpanBo spanBo = new SpanBo();
spanBo.setAgentId(tSpan.getAgentId());
spanBo.setApplicationId(tSpan.getApplicationName());
spanBo.setAgentStartTime(tSpan.getAgentStartTime());
final TransactionId transactionId = newTransactionId(tSpan.getTransactionId(), spanBo.getAgentId());
spanBo.setTransactionId(transactionId);
spanBo.setSpanId(tSpan.getSpanId());
spanBo.setParentSpanId(tSpan.getParentSpanId());
spanBo.setStartTime(tSpan.getStartTime());
spanBo.setElapsed(tSpan.getElapsed());
spanBo.setRpc(tSpan.getRpc());
spanBo.setServiceType(tSpan.getServiceType());
spanBo.setEndPoint(tSpan.getEndPoint());
spanBo.setFlag(tSpan.getFlag());
spanBo.setApiId(tSpan.getApiId());
spanBo.setErrCode(tSpan.getErr());
spanBo.setAcceptorHost(tSpan.getAcceptorHost());
spanBo.setRemoteAddr(tSpan.getRemoteAddr());
spanBo.setLoggingTransactionInfo(tSpan.getLoggingTransactionInfo());
// applicationServiceType is not saved for older versions where applicationServiceType does not exist.
if (tSpan.isSetApplicationServiceType()) {
spanBo.setApplicationServiceType(tSpan.getApplicationServiceType());
} else {
spanBo.setApplicationServiceType(tSpan.getServiceType());
}
spanBo.setParentApplicationId(tSpan.getParentApplicationName());
spanBo.setParentApplicationServiceType(tSpan.getParentApplicationType());
// FIXME span.errCode contains error of span and spanEvent
// because exceptionInfo is the error information of span itself, exceptionInfo can be null even if errCode is not 0
final TIntStringValue exceptionInfo = tSpan.getExceptionInfo();
if (exceptionInfo != null) {
spanBo.setExceptionInfo(exceptionInfo.getIntValue(), exceptionInfo.getStringValue());
}
List<AnnotationBo> annotationBoList = buildAnnotationList(tSpan.getAnnotations());
spanBo.setAnnotationBoList(annotationBoList);
return spanBo;
}
use of com.navercorp.pinpoint.common.profiler.util.TransactionId in project pinpoint by naver.
the class SpanUtils method getVarTransactionId.
public static byte[] getVarTransactionId(SpanBo span) {
Objects.requireNonNull(span, "span");
final TransactionId transactionId = span.getTransactionId();
String agentId = transactionId.getAgentId();
if (agentId == null) {
agentId = span.getAgentId();
}
final Buffer buffer = new AutomaticBuffer(32);
buffer.putPrefixedString(agentId);
buffer.putSVLong(transactionId.getAgentStartTime());
buffer.putVLong(transactionId.getTransactionSequence());
return buffer.getBuffer();
}
use of com.navercorp.pinpoint.common.profiler.util.TransactionId in project pinpoint by naver.
the class DefaultTransactionIdEncoderTest method testCompressedTransactionId.
@Test
public void testCompressedTransactionId() {
TraceRoot traceRoot = getRootTraceId();
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(), agentStartTime);
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(String applicationName, DragArea dragArea, int limit) {
Objects.requireNonNull(applicationName, "applicationName");
Objects.requireNonNull(dragArea, "dragArea");
LastRowAccessor lastRowAccessor = new LastRowAccessor();
final Range range = Range.newUncheckedRange(dragArea.getXLow(), dragArea.getXHigh());
logger.debug("scanTraceIndex range:{}", range);
final Scan scan = newFuzzyScanner(applicationName, dragArea, range);
// TODO
// Predicate<Dot> filter = ElpasedTimeDotPredicate.newDragAreaDotPredicate(dragArea);
final TableName applicationTraceIndexTableName = tableNameProvider.getTableName(DESCRIPTOR.getTable());
List<List<TransactionId>> listList = this.hbaseOperations2.findParallel(applicationTraceIndexTableName, scan, traceIdRowKeyDistributor, limit, traceIndexMapper, lastRowAccessor, APPLICATION_TRACE_INDEX_NUM_PARTITIONS);
List<TransactionId> transactionIdSum = ListListUtils.toList(listList);
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 GetTraceInfoParser method parse.
public List<GetTraceInfo> parse(Map<String, String> requestParam) {
final String applicationName = requestParam.get(APPLICATION_NAME);
List<GetTraceInfo> getTraceInfoList = new ArrayList<>();
int index = 0;
while (true) {
final String transactionId = requestParam.get(PREFIX_TRANSACTION_ID + index);
final String time = requestParam.get(PREFIX_TIME + index);
final String responseTime = requestParam.get(PREFIX_RESPONSE_TIME + index);
if (transactionId == null || time == null || responseTime == null) {
break;
}
TransactionId traceId = TransactionIdUtils.parseTransactionId(transactionId);
SpanHint spanHint = new SpanHint(Long.parseLong(time), Integer.parseInt(responseTime), applicationName);
final GetTraceInfo getTraceInfo = new GetTraceInfo(traceId, spanHint);
getTraceInfoList.add(getTraceInfo);
index++;
}
logger.debug("query:{}", getTraceInfoList);
return getTraceInfoList;
}
Aggregations