use of com.navercorp.pinpoint.profiler.context.id.TraceRoot 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.profiler.context.id.TraceRoot in project pinpoint by naver.
the class SpanPostProcessorTest method postProcess1.
@Test
public void postProcess1() {
SpanProcessor<TSpan, TSpanChunk> spanChunkPostProcessor = new SpanProcessorV1();
TraceRoot internalTraceId = newInternalTraceId();
TSpanChunk tSpanChunk = new TSpanChunk();
try {
SpanChunk spanChunk = new DefaultSpanChunk(internalTraceId, new ArrayList<SpanEvent>());
spanChunkPostProcessor.postProcess(spanChunk, tSpanChunk);
Assert.fail();
} catch (Exception ignored) {
}
}
use of com.navercorp.pinpoint.profiler.context.id.TraceRoot in project pinpoint by naver.
the class SpanEventTest method testMarkStartTime.
@Test
public void testMarkStartTime() {
final DefaultTraceId traceId = new DefaultTraceId("agentId", 0, 0);
TraceRoot traceRoot = new DefaultTraceRoot(traceId, "agentId", System.currentTimeMillis(), 0);
Span span = new Span(traceRoot);
span.markBeforeTime();
span.setElapsedTime((int) (span.getStartTime() + 10));
logger.debug("span:{}", span);
final SpanEvent spanEvent = new SpanEvent();
long currentTime = System.currentTimeMillis();
spanEvent.setStartTime(currentTime);
spanEvent.setElapsedTime(10);
logger.debug("spanEvent:{}", spanEvent);
span.setSpanEventList(Arrays.asList(spanEvent));
TSpan tSpan = new TSpan();
TSpanEvent tSpanEvent = new TSpanEvent();
tSpan.addToSpanEventList(tSpanEvent);
compressorV1.preProcess(span, tSpan);
compressorV1.postProcess(span, tSpan);
Assert.assertEquals("startTime", span.getStartTime() + tSpanEvent.getStartElapsed(), spanEvent.getStartTime());
Assert.assertEquals("endTime", span.getStartTime() + tSpanEvent.getStartElapsed() + spanEvent.getElapsedTime(), spanEvent.getAfterTime());
}
use of com.navercorp.pinpoint.profiler.context.id.TraceRoot in project pinpoint by naver.
the class OrderedSpanRecorder method insertSpan.
private void insertSpan(Span span) {
long startTime = span.getStartTime();
TraceRoot traceRoot = span.getTraceRoot();
Item<SpanType> item = new Item<SpanType>(span, startTime, traceRoot, ROOT_SEQUENCE);
insertItem(item);
}
use of com.navercorp.pinpoint.profiler.context.id.TraceRoot in project pinpoint by naver.
the class PluginVerifierExternalAdaptor method verifyIsLoggingTransactionInfo.
@Override
public void verifyIsLoggingTransactionInfo(LoggingInfo loggingInfo) {
final Item<SpanType> item = popItem();
if (item == null) {
throw new AssertionError("Expected a Span isLoggingTransactionInfo value with [" + loggingInfo.getName() + "]" + " but loggingTransactionInfo value invalid.");
}
final TraceRoot traceRoot = item.getTraceRoot();
final byte loggingTransactionInfo = traceRoot.getShared().getLoggingInfo();
if (loggingTransactionInfo != loggingInfo.getCode()) {
LoggingInfo code = LoggingInfo.searchByCode(loggingTransactionInfo);
String codeName = getCodeName(code);
AssertionErrorBuilder builder = new AssertionErrorBuilder("Span.isLoggingTransactionInfo value", loggingInfo.getName(), codeName);
builder.setComparison(loggingInfo.getName(), codeName);
builder.throwAssertionError();
}
}
Aggregations