Search in sources :

Example 21 with TraceRoot

use of com.navercorp.pinpoint.profiler.context.id.TraceRoot in project pinpoint by naver.

the class ActiveThreadServiceTest method addActiveTrace.

private void addActiveTrace(ActiveTraceRepository activeTraceRepository, long executionTime, int addCount) {
    for (int i = 0; i < addCount; i++) {
        TraceRoot traceRoot = createTraceRoot(executionTime);
        activeTraceRepository.register(traceRoot);
    }
}
Also used : TraceRoot(com.navercorp.pinpoint.profiler.context.id.TraceRoot)

Example 22 with TraceRoot

use of com.navercorp.pinpoint.profiler.context.id.TraceRoot 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 TraceSampler.State state = traceSampler.isContinueSampled();
    final boolean sampling = state.isSampled();
    if (sampling) {
        final TraceRoot traceRoot = traceRootFactory.continueTraceRoot(traceId, state.nextId());
        final Span span = spanFactory.newSpan(traceRoot);
        final SpanChunkFactory spanChunkFactory = new DefaultSpanChunkFactory(traceRoot);
        final Storage storage = storageFactory.createStorage(spanChunkFactory);
        final CallStack<SpanEvent> callStack = callStackFactory.newCallStack();
        final ActiveTraceHandle handle = registerActiveTrace(traceRoot);
        final SpanAsyncStateListener asyncStateListener = new SpanAsyncStateListener(span, storageFactory);
        final AsyncState asyncState = new ListenableAsyncState(asyncStateListener, handle);
        final SpanRecorder spanRecorder = recorderFactory.newSpanRecorder(span, traceId.isRoot(), sampling);
        final WrappedSpanEventRecorder wrappedSpanEventRecorder = recorderFactory.newWrappedSpanEventRecorder(traceRoot, asyncState);
        final DefaultTrace trace = new DefaultTrace(span, callStack, storage, sampling, spanRecorder, wrappedSpanEventRecorder, ActiveTraceHandle.EMPTY_HANDLE);
        final AsyncTrace asyncTrace = new AsyncTrace(traceRoot, trace, asyncState);
        return asyncTrace;
    } else {
        return newDisableTrace(state.nextId());
    }
}
Also used : TraceSampler(com.navercorp.pinpoint.bootstrap.sampler.TraceSampler) ActiveTraceHandle(com.navercorp.pinpoint.profiler.context.active.ActiveTraceHandle) ListenableAsyncState(com.navercorp.pinpoint.profiler.context.id.ListenableAsyncState) AsyncState(com.navercorp.pinpoint.bootstrap.context.AsyncState) WrappedSpanEventRecorder(com.navercorp.pinpoint.profiler.context.recorder.WrappedSpanEventRecorder) ListenableAsyncState(com.navercorp.pinpoint.profiler.context.id.ListenableAsyncState) SpanRecorder(com.navercorp.pinpoint.bootstrap.context.SpanRecorder) Storage(com.navercorp.pinpoint.profiler.context.storage.Storage) TraceRoot(com.navercorp.pinpoint.profiler.context.id.TraceRoot)

Example 23 with TraceRoot

use of com.navercorp.pinpoint.profiler.context.id.TraceRoot 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.
    // Check max throughput(permits per seconds)
    final TraceSampler.State state = traceSampler.isContinueSampled();
    if (state.isSampled()) {
        final TraceRoot traceRoot = traceRootFactory.continueTraceRoot(traceId, state.nextId());
        final Span span = spanFactory.newSpan(traceRoot);
        final SpanChunkFactory spanChunkFactory = new DefaultSpanChunkFactory(traceRoot);
        final Storage storage = storageFactory.createStorage(spanChunkFactory);
        final CallStack<SpanEvent> callStack = callStackFactory.newCallStack();
        final boolean samplingEnable = true;
        final SpanRecorder spanRecorder = recorderFactory.newSpanRecorder(span, traceId.isRoot(), samplingEnable);
        final WrappedSpanEventRecorder wrappedSpanEventRecorder = recorderFactory.newWrappedSpanEventRecorder(traceRoot);
        final ActiveTraceHandle handle = registerActiveTrace(traceRoot);
        final DefaultTrace trace = new DefaultTrace(span, callStack, storage, samplingEnable, spanRecorder, wrappedSpanEventRecorder, handle);
        return trace;
    } else {
        return newDisableTrace(state.nextId());
    }
}
Also used : TraceSampler(com.navercorp.pinpoint.bootstrap.sampler.TraceSampler) ActiveTraceHandle(com.navercorp.pinpoint.profiler.context.active.ActiveTraceHandle) WrappedSpanEventRecorder(com.navercorp.pinpoint.profiler.context.recorder.WrappedSpanEventRecorder) SpanRecorder(com.navercorp.pinpoint.bootstrap.context.SpanRecorder) Storage(com.navercorp.pinpoint.profiler.context.storage.Storage) TraceRoot(com.navercorp.pinpoint.profiler.context.id.TraceRoot)

Example 24 with TraceRoot

use of com.navercorp.pinpoint.profiler.context.id.TraceRoot in project pinpoint by naver.

the class DefaultBaseTraceFactory method newAsyncTraceObject.

// entry point async trace.
@InterfaceAudience.LimitedPrivate("vert.x")
@Override
public Trace newAsyncTraceObject() {
    final TraceSampler.State state = traceSampler.isNewSampled();
    final boolean sampling = state.isSampled();
    if (sampling) {
        final TraceRoot traceRoot = traceRootFactory.newTraceRoot(state.nextId());
        final Span span = spanFactory.newSpan(traceRoot);
        final SpanChunkFactory spanChunkFactory = new DefaultSpanChunkFactory(traceRoot);
        final Storage storage = storageFactory.createStorage(spanChunkFactory);
        final CallStack<SpanEvent> callStack = callStackFactory.newCallStack();
        final ActiveTraceHandle handle = registerActiveTrace(traceRoot);
        final SpanAsyncStateListener asyncStateListener = new SpanAsyncStateListener(span, storageFactory);
        final AsyncState asyncState = new ListenableAsyncState(asyncStateListener, handle);
        final TraceId traceId = traceRoot.getTraceId();
        final SpanRecorder spanRecorder = recorderFactory.newSpanRecorder(span, traceId.isRoot(), sampling);
        final WrappedSpanEventRecorder wrappedSpanEventRecorder = recorderFactory.newWrappedSpanEventRecorder(traceRoot, asyncState);
        final DefaultTrace trace = new DefaultTrace(span, callStack, storage, sampling, spanRecorder, wrappedSpanEventRecorder, ActiveTraceHandle.EMPTY_HANDLE);
        final AsyncTrace asyncTrace = new AsyncTrace(traceRoot, trace, asyncState);
        return asyncTrace;
    } else {
        return newDisableTrace(state.nextId());
    }
}
Also used : TraceSampler(com.navercorp.pinpoint.bootstrap.sampler.TraceSampler) ActiveTraceHandle(com.navercorp.pinpoint.profiler.context.active.ActiveTraceHandle) ListenableAsyncState(com.navercorp.pinpoint.profiler.context.id.ListenableAsyncState) AsyncState(com.navercorp.pinpoint.bootstrap.context.AsyncState) WrappedSpanEventRecorder(com.navercorp.pinpoint.profiler.context.recorder.WrappedSpanEventRecorder) ListenableAsyncState(com.navercorp.pinpoint.profiler.context.id.ListenableAsyncState) SpanRecorder(com.navercorp.pinpoint.bootstrap.context.SpanRecorder) Storage(com.navercorp.pinpoint.profiler.context.storage.Storage) TraceId(com.navercorp.pinpoint.bootstrap.context.TraceId) TraceRoot(com.navercorp.pinpoint.profiler.context.id.TraceRoot)

Example 25 with TraceRoot

use of com.navercorp.pinpoint.profiler.context.id.TraceRoot in project pinpoint by naver.

the class DefaultBaseTraceFactory method newTraceObject.

@Override
public Trace newTraceObject() {
    // TODO need to modify how to inject a datasender
    final TraceSampler.State state = traceSampler.isNewSampled();
    final boolean sampling = state.isSampled();
    if (sampling) {
        final TraceRoot traceRoot = traceRootFactory.newTraceRoot(state.nextId());
        final Span span = spanFactory.newSpan(traceRoot);
        final SpanChunkFactory spanChunkFactory = new DefaultSpanChunkFactory(traceRoot);
        final Storage storage = storageFactory.createStorage(spanChunkFactory);
        final CallStack<SpanEvent> callStack = callStackFactory.newCallStack();
        final TraceId traceId = traceRoot.getTraceId();
        final SpanRecorder spanRecorder = recorderFactory.newSpanRecorder(span, traceId.isRoot(), sampling);
        final WrappedSpanEventRecorder wrappedSpanEventRecorder = recorderFactory.newWrappedSpanEventRecorder(traceRoot);
        final ActiveTraceHandle handle = registerActiveTrace(traceRoot);
        final DefaultTrace trace = new DefaultTrace(span, callStack, storage, sampling, spanRecorder, wrappedSpanEventRecorder, handle);
        return trace;
    } else {
        return newDisableTrace(state.nextId());
    }
}
Also used : TraceSampler(com.navercorp.pinpoint.bootstrap.sampler.TraceSampler) ActiveTraceHandle(com.navercorp.pinpoint.profiler.context.active.ActiveTraceHandle) WrappedSpanEventRecorder(com.navercorp.pinpoint.profiler.context.recorder.WrappedSpanEventRecorder) SpanRecorder(com.navercorp.pinpoint.bootstrap.context.SpanRecorder) Storage(com.navercorp.pinpoint.profiler.context.storage.Storage) TraceId(com.navercorp.pinpoint.bootstrap.context.TraceId) TraceRoot(com.navercorp.pinpoint.profiler.context.id.TraceRoot)

Aggregations

TraceRoot (com.navercorp.pinpoint.profiler.context.id.TraceRoot)36 TraceId (com.navercorp.pinpoint.bootstrap.context.TraceId)17 DefaultTraceRoot (com.navercorp.pinpoint.profiler.context.id.DefaultTraceRoot)16 Test (org.junit.Test)13 DefaultTraceId (com.navercorp.pinpoint.profiler.context.id.DefaultTraceId)12 SpanEvent (com.navercorp.pinpoint.profiler.context.SpanEvent)10 TSpanEvent (com.navercorp.pinpoint.thrift.dto.TSpanEvent)9 DefaultSpanChunk (com.navercorp.pinpoint.profiler.context.DefaultSpanChunk)7 Storage (com.navercorp.pinpoint.profiler.context.storage.Storage)7 SpanRecorder (com.navercorp.pinpoint.bootstrap.context.SpanRecorder)6 Span (com.navercorp.pinpoint.profiler.context.Span)6 SpanChunk (com.navercorp.pinpoint.profiler.context.SpanChunk)6 WrappedSpanEventRecorder (com.navercorp.pinpoint.profiler.context.recorder.WrappedSpanEventRecorder)6 TSpan (com.navercorp.pinpoint.thrift.dto.TSpan)6 SpanType (com.navercorp.pinpoint.profiler.context.SpanType)5 Shared (com.navercorp.pinpoint.profiler.context.id.Shared)5 ByteBuffer (java.nio.ByteBuffer)5 TraceSampler (com.navercorp.pinpoint.bootstrap.sampler.TraceSampler)4 VisibleForTesting (com.navercorp.pinpoint.common.annotations.VisibleForTesting)4 ActiveTraceHandle (com.navercorp.pinpoint.profiler.context.active.ActiveTraceHandle)4