Search in sources :

Example 1 with Storage

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

the class DefaultBaseTraceFactory method continueAsyncTraceObject.

// internal async trace.
@Override
public Trace continueAsyncTraceObject(AsyncTraceId traceId, int asyncId, long startTime) {
    final TraceId parentTraceId = traceId.getParentTraceId();
    final Storage storage = storageFactory.createStorage();
    final Storage asyncStorage = new AsyncStorage(storage);
    final Trace trace = new DefaultTrace(callStackFactory, asyncStorage, parentTraceId, AtomicIdGenerator.UNTRACKED_ID, asyncIdGenerator, true, spanFactory, recorderFactory);
    final AsyncTrace asyncTrace = new AsyncTrace(trace, asyncId, traceId.nextAsyncSequence(), startTime);
    return asyncTrace;
}
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) AsyncStorage(com.navercorp.pinpoint.profiler.context.storage.AsyncStorage)

Example 2 with Storage

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

the class SpanAsyncStateListenerTest method onComplete_check_atomicity.

@Test
public void onComplete_check_atomicity() throws Exception {
    Span span = mock(Span.class);
    Storage storage = mock(Storage.class);
    ListenableAsyncState.AsyncStateListener listener = new SpanAsyncStateListener(span, storage);
    listener.finish();
    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)

Example 3 with Storage

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

the class DefaultBaseTraceFactory method continueTraceObject.

// continue to trace the request that has been determined to be sampled on previous nodes
@Override
public Trace continueTraceObject(final TraceId traceId) {
    // TODO need to modify how to bind a datasender
    // always set true because the decision of sampling has been  made on previous nodes
    // TODO need to consider as a target to sample in case Trace object has a sampling flag (true) marked on previous node.
    final Storage storage = storageFactory.createStorage();
    final long localTransactionId = this.idGenerator.nextContinuedTransactionId();
    final Trace trace = new DefaultTrace(callStackFactory, storage, traceId, localTransactionId, asyncIdGenerator, true, spanFactory, recorderFactory);
    return trace;
}
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)

Example 4 with Storage

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

the class DefaultBaseTraceFactory method continueAsyncTraceObject.

// entry point async trace.
@InterfaceAudience.LimitedPrivate("vert.x")
@Override
public Trace continueAsyncTraceObject(final TraceId traceId) {
    final Storage storage = storageFactory.createStorage();
    final long localTransactionId = this.idGenerator.nextContinuedTransactionId();
    final DefaultTrace trace = new DefaultTrace(callStackFactory, storage, traceId, localTransactionId, asyncIdGenerator, true, spanFactory, recorderFactory);
    final SpanAsyncStateListener asyncStateListener = new SpanAsyncStateListener(trace.getSpan(), storageFactory.createStorage());
    final ListenableAsyncState stateListener = new ListenableAsyncState(asyncStateListener);
    final AsyncTrace asyncTrace = new AsyncTrace(trace, stateListener);
    return asyncTrace;
}
Also used : AsyncStorage(com.navercorp.pinpoint.profiler.context.storage.AsyncStorage) Storage(com.navercorp.pinpoint.profiler.context.storage.Storage) ListenableAsyncState(com.navercorp.pinpoint.profiler.context.id.ListenableAsyncState)

Example 5 with Storage

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

the class DefaultBaseTraceFactory method newAsyncTraceObject.

// entry point async trace.
@InterfaceAudience.LimitedPrivate("vert.x")
@Override
public Trace newAsyncTraceObject() {
    final boolean sampling = sampler.isSampling();
    if (sampling) {
        final Storage storage = storageFactory.createStorage();
        final TraceId traceId = traceIdFactory.newTraceId();
        final long localTransactionId = traceId.getTransactionSequence();
        final DefaultTrace trace = new DefaultTrace(callStackFactory, storage, traceId, localTransactionId, asyncIdGenerator, true, spanFactory, recorderFactory);
        final SpanAsyncStateListener asyncStateListener = new SpanAsyncStateListener(trace.getSpan(), storageFactory.createStorage());
        final AsyncState closer = new ListenableAsyncState(asyncStateListener);
        final AsyncTrace asyncTrace = new AsyncTrace(trace, closer);
        return asyncTrace;
    } else {
        return newDisableTrace();
    }
}
Also used : AsyncStorage(com.navercorp.pinpoint.profiler.context.storage.AsyncStorage) Storage(com.navercorp.pinpoint.profiler.context.storage.Storage) ListenableAsyncState(com.navercorp.pinpoint.profiler.context.id.ListenableAsyncState) AsyncState(com.navercorp.pinpoint.bootstrap.context.AsyncState) TraceId(com.navercorp.pinpoint.bootstrap.context.TraceId) AsyncTraceId(com.navercorp.pinpoint.bootstrap.context.AsyncTraceId) ListenableAsyncState(com.navercorp.pinpoint.profiler.context.id.ListenableAsyncState)

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