Search in sources :

Example 6 with Storage

use of com.navercorp.pinpoint.profiler.context.storage.Storage 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 7 with Storage

use of com.navercorp.pinpoint.profiler.context.storage.Storage in project pinpoint by naver.

the class SpanAsyncStateListenerTest method onComplete.

@Test
public void onComplete() throws Exception {
    Span span = mock(Span.class);
    Storage storage = mock(Storage.class);
    ListenableAsyncState.AsyncStateListener listener = new SpanAsyncStateListener(span, storage);
    listener.finish();
    verify(span, times(1)).isTimeRecording();
    verify(storage, times(1)).store(span);
    //
    listener.finish();
    verify(span, times(1)).isTimeRecording();
    verify(storage, times(1)).store(span);
}
Also used : Storage(com.navercorp.pinpoint.profiler.context.storage.Storage) ListenableAsyncState(com.navercorp.pinpoint.profiler.context.id.ListenableAsyncState) Test(org.junit.Test)

Aggregations

Storage (com.navercorp.pinpoint.profiler.context.storage.Storage)7 AsyncStorage (com.navercorp.pinpoint.profiler.context.storage.AsyncStorage)5 ListenableAsyncState (com.navercorp.pinpoint.profiler.context.id.ListenableAsyncState)4 AsyncTraceId (com.navercorp.pinpoint.bootstrap.context.AsyncTraceId)3 Trace (com.navercorp.pinpoint.bootstrap.context.Trace)3 TraceId (com.navercorp.pinpoint.bootstrap.context.TraceId)3 Test (org.junit.Test)2 AsyncState (com.navercorp.pinpoint.bootstrap.context.AsyncState)1