Search in sources :

Example 26 with TraceId

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();
    }
}
Also used : Trace(com.navercorp.pinpoint.bootstrap.context.Trace) AsyncStorage(com.navercorp.pinpoint.profiler.context.storage.AsyncStorage) Storage(com.navercorp.pinpoint.profiler.context.storage.Storage) TraceId(com.navercorp.pinpoint.bootstrap.context.TraceId) AsyncTraceId(com.navercorp.pinpoint.bootstrap.context.AsyncTraceId)

Example 27 with TraceId

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);
}
Also used : DefaultTraceId(com.navercorp.pinpoint.profiler.context.id.DefaultTraceId) TraceId(com.navercorp.pinpoint.bootstrap.context.TraceId) DefaultTraceId(com.navercorp.pinpoint.profiler.context.id.DefaultTraceId) TransactionId(com.navercorp.pinpoint.common.util.TransactionId) Test(org.junit.Test)

Example 28 with TraceId

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);
}
Also used : DefaultTraceId(com.navercorp.pinpoint.profiler.context.id.DefaultTraceId) AsyncTraceId(com.navercorp.pinpoint.bootstrap.context.AsyncTraceId) DefaultAsyncTraceId(com.navercorp.pinpoint.profiler.context.id.DefaultAsyncTraceId) DefaultTraceId(com.navercorp.pinpoint.profiler.context.id.DefaultTraceId) TraceId(com.navercorp.pinpoint.bootstrap.context.TraceId) AsyncTraceId(com.navercorp.pinpoint.bootstrap.context.AsyncTraceId) DefaultAsyncTraceId(com.navercorp.pinpoint.profiler.context.id.DefaultAsyncTraceId) DefaultAsyncTraceId(com.navercorp.pinpoint.profiler.context.id.DefaultAsyncTraceId) Test(org.junit.Test)

Aggregations

TraceId (com.navercorp.pinpoint.bootstrap.context.TraceId)28 Trace (com.navercorp.pinpoint.bootstrap.context.Trace)17 SpanEventRecorder (com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder)9 DefaultTraceId (com.navercorp.pinpoint.profiler.context.id.DefaultTraceId)9 Test (org.junit.Test)8 AsyncTraceId (com.navercorp.pinpoint.bootstrap.context.AsyncTraceId)6 TraceContext (com.navercorp.pinpoint.bootstrap.context.TraceContext)4 InterceptorScopeInvocation (com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScopeInvocation)3 AsyncIdGenerator (com.navercorp.pinpoint.profiler.context.id.AsyncIdGenerator)3 DefaultRecorderFactory (com.navercorp.pinpoint.profiler.context.recorder.DefaultRecorderFactory)3 RecorderFactory (com.navercorp.pinpoint.profiler.context.recorder.RecorderFactory)3 AsyncStorage (com.navercorp.pinpoint.profiler.context.storage.AsyncStorage)3 SpanStorage (com.navercorp.pinpoint.profiler.context.storage.SpanStorage)3 Storage (com.navercorp.pinpoint.profiler.context.storage.Storage)3 SqlMetaDataService (com.navercorp.pinpoint.profiler.metadata.SqlMetaDataService)3 StringMetaDataService (com.navercorp.pinpoint.profiler.metadata.StringMetaDataService)3 SpanRecorder (com.navercorp.pinpoint.bootstrap.context.SpanRecorder)2 StandardHostValveInvokeInterceptor (com.navercorp.pinpoint.plugin.jboss.interceptor.StandardHostValveInvokeInterceptor)2 ThriftRequestProperty (com.navercorp.pinpoint.plugin.thrift.ThriftRequestProperty)2 StandardHostValveInvokeInterceptor (com.navercorp.pinpoint.plugin.tomcat.interceptor.StandardHostValveInvokeInterceptor)2