use of com.navercorp.pinpoint.common.util.TransactionId in project pinpoint by naver.
the class SpanUtils method getTransactionId.
@Deprecated
public static byte[] getTransactionId(TSpan span) {
if (span == null) {
throw new NullPointerException("span must not be null");
}
final byte[] transactionIdBytes = span.getTransactionId();
TransactionId transactionId = TransactionIdUtils.parseTransactionId(transactionIdBytes);
String agentId = transactionId.getAgentId();
if (agentId == null) {
agentId = span.getAgentId();
}
return BytesUtils.stringLongLongToBytes(agentId, AGENT_NAME_MAX_LEN, transactionId.getAgentStartTime(), transactionId.getTransactionSequence());
}
use of com.navercorp.pinpoint.common.util.TransactionId in project pinpoint by naver.
the class SpanUtils method getVarTransactionId.
public static byte[] getVarTransactionId(TSpan span) {
if (span == null) {
throw new NullPointerException("span must not be null");
}
final byte[] transactionIdBytes = span.getTransactionId();
TransactionId transactionId = TransactionIdUtils.parseTransactionId(transactionIdBytes);
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.util.TransactionId in project pinpoint by naver.
the class SpanFactory method newTransactionId.
private TransactionId newTransactionId(byte[] transactionIdBytes, BasicSpan basicSpan) {
final TransactionId transactionId = TransactionIdUtils.parseTransactionId(transactionIdBytes);
String transactionAgentId = transactionId.getAgentId();
if (transactionAgentId != null) {
return transactionId;
}
String spanAgentId = basicSpan.getAgentId();
return new TransactionId(spanAgentId, transactionId.getAgentStartTime(), transactionId.getTransactionSequence());
}
use of com.navercorp.pinpoint.common.util.TransactionId in project pinpoint by naver.
the class SpanFactory method newSpanChunkBo.
// for test
SpanChunkBo newSpanChunkBo(TSpanChunk tSpanChunk) {
final SpanChunkBo spanChunkBo = new SpanChunkBo();
spanChunkBo.setAgentId(tSpanChunk.getAgentId());
spanChunkBo.setApplicationId(tSpanChunk.getApplicationName());
spanChunkBo.setAgentStartTime(tSpanChunk.getAgentStartTime());
spanChunkBo.setServiceType(tSpanChunk.getServiceType());
if (tSpanChunk.isSetApplicationServiceType()) {
spanChunkBo.setApplicationServiceType(tSpanChunk.getApplicationServiceType());
} else {
spanChunkBo.setApplicationServiceType(tSpanChunk.getServiceType());
}
TransactionId transactionId = newTransactionId(tSpanChunk.getTransactionId(), spanChunkBo);
spanChunkBo.setTransactionId(transactionId);
spanChunkBo.setSpanId(tSpanChunk.getSpanId());
spanChunkBo.setEndPoint(tSpanChunk.getEndPoint());
return spanChunkBo;
}
use of com.navercorp.pinpoint.common.util.TransactionId in project pinpoint by naver.
the class TraceRowKeyEncoderV1Test 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);
}
Aggregations