use of com.navercorp.pinpoint.profiler.context.id.TraceRoot in project pinpoint by naver.
the class SpanThriftMessageConverter method buildTSpanChunk.
@VisibleForTesting
TSpanChunk buildTSpanChunk(SpanChunk spanChunk) {
final TSpanChunk tSpanChunk = new TSpanChunk();
tSpanChunk.setApplicationName(applicationName);
tSpanChunk.setAgentId(agentId);
tSpanChunk.setAgentStartTime(agentStartTime);
tSpanChunk.setApplicationServiceType(applicationServiceType);
final TraceRoot traceRoot = spanChunk.getTraceRoot();
final TraceId traceId = traceRoot.getTraceId();
final ByteBuffer transactionId = transactionIdEncoder.encodeTransactionId(traceId);
tSpanChunk.setTransactionId(transactionId);
tSpanChunk.setSpanId(traceId.getSpanId());
final Shared shared = traceRoot.getShared();
tSpanChunk.setEndPoint(shared.getEndPoint());
if (spanChunk instanceof AsyncSpanChunk) {
final AsyncSpanChunk asyncSpanChunk = (AsyncSpanChunk) spanChunk;
final LocalAsyncId localAsyncId = asyncSpanChunk.getLocalAsyncId();
final TLocalAsyncId tLocalAsyncId = new TLocalAsyncId(localAsyncId.getAsyncId(), localAsyncId.getSequence());
tSpanChunk.setLocalAsyncId(tLocalAsyncId);
}
spanPostProcessor.preProcess(spanChunk, tSpanChunk);
final List<SpanEvent> spanEventList = spanChunk.getSpanEventList();
if (CollectionUtils.hasLength(spanEventList)) {
final List<TSpanEvent> tSpanEvents = buildTSpanEventList(spanEventList);
tSpanChunk.setSpanEventList(tSpanEvents);
}
spanPostProcessor.postProcess(spanChunk, tSpanChunk);
return tSpanChunk;
}
use of com.navercorp.pinpoint.profiler.context.id.TraceRoot in project pinpoint by naver.
the class WrappedAsyncSpanEventRecorder method recordNextAsyncContext.
@Override
public AsyncContext recordNextAsyncContext(boolean asyncStateSupport) {
if (asyncStateSupport) {
final TraceRoot traceRoot = this.traceRoot;
final AsyncId asyncIdObject = getNextAsyncId();
final boolean isDisabled = isOverflowState();
final AsyncState asyncState = this.asyncState;
asyncState.setup();
final AsyncContext asyncContext = asyncContextFactory.newAsyncContext(traceRoot, asyncIdObject, isDisabled, asyncState);
return asyncContext;
}
return recordNextAsyncContext();
}
use of com.navercorp.pinpoint.profiler.context.id.TraceRoot in project pinpoint by naver.
the class DefaultSpanRecorder method maskErrorCode.
@Override
void maskErrorCode(final int errorCode) {
final TraceRoot traceRoot = span.getTraceRoot();
traceRoot.getShared().maskErrorCode(errorCode);
}
use of com.navercorp.pinpoint.profiler.context.id.TraceRoot in project pinpoint by naver.
the class SpanProcessorV1 method postProcess.
@Override
public void postProcess(Span span, TSpan tSpan) {
final TraceRoot traceRoot = span.getTraceRoot();
final long keyTime = traceRoot.getTraceStartTime();
List<SpanEvent> spanEventList = span.getSpanEventList();
if (spanEventList == null) {
spanEventList = Collections.emptyList();
}
List<TSpanEvent> tSpanEventList = tSpan.getSpanEventList();
if (tSpanEventList == null) {
tSpanEventList = Collections.emptyList();
}
postEventProcess(spanEventList, tSpanEventList, keyTime);
}
use of com.navercorp.pinpoint.profiler.context.id.TraceRoot in project pinpoint by naver.
the class ActiveThreadServiceTest method createTraceRoot.
private TraceRoot createTraceRoot(long executionTime) {
TraceRoot traceRoot = Mockito.mock(TraceRoot.class);
Mockito.when(traceRoot.getTraceStartTime()).thenReturn(System.currentTimeMillis() - executionTime);
Mockito.when(traceRoot.getLocalTransactionId()).thenReturn(nextLocalTransactionId());
return traceRoot;
}
Aggregations