use of com.navercorp.pinpoint.bootstrap.context.TraceId in project pinpoint by naver.
the class DefaultBaseTraceFactory method newTraceObject.
@Override
public Trace newTraceObject() {
// TODO need to modify how to inject a datasender
final boolean sampling = sampler.isSampling();
if (sampling) {
final Storage storage = storageFactory.createStorage();
final TraceId traceId = traceIdFactory.newTraceId();
final long localTransactionId = traceId.getTransactionSequence();
final Trace trace = new DefaultTrace(callStackFactory, storage, traceId, localTransactionId, asyncIdGenerator, true, spanFactory, recorderFactory);
return trace;
} else {
return newDisableTrace();
}
}
use of com.navercorp.pinpoint.bootstrap.context.TraceId 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.bootstrap.context.TraceId in project pinpoint by naver.
the class DefaultAsyncTraceIdTest method nextAsyncSequence.
@Test
public void nextAsyncSequence() throws Exception {
long agentStartTime = System.currentTimeMillis();
TraceId traceId = new DefaultTraceId("testAgentId", agentStartTime, 0);
AsyncTraceId asyncTraceId = new DefaultAsyncTraceId(traceId, 0, agentStartTime + 10);
Assert.assertEquals(asyncTraceId.nextAsyncSequence(), 1);
Assert.assertEquals(asyncTraceId.nextAsyncSequence(), 2);
Assert.assertEquals(asyncTraceId.nextAsyncSequence(), 3);
}
Aggregations