Search in sources :

Example 31 with TraceRoot

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

the class DefaultTransactionIdEncoderTest method testDuplicateAgentId.

@Test
public void testDuplicateAgentId() {
    TraceRoot traceRoot = getDuplicateAgentId();
    TraceId traceId = traceRoot.getTraceId();
    ByteBuffer encodeTxId = transactionIdEncoder.encodeTransactionId(traceId);
    byte[] transactionId = Arrays.copyOf(encodeTxId.array(), encodeTxId.remaining());
    TransactionId parsedTxId = TransactionIdUtils.parseTransactionId(transactionId, DEFAULT_AGENT_ID);
    logger.debug("transactionId:{}", parsedTxId);
    Assert.assertEquals(DEFAULT_AGENT_ID, parsedTxId.getAgentId());
    Assert.assertEquals(parsedTxId.getAgentStartTime(), agentStartTime2);
    Assert.assertEquals(parsedTxId.getTransactionSequence(), transactionId2);
}
Also used : DefaultTraceId(com.navercorp.pinpoint.profiler.context.id.DefaultTraceId) TraceId(com.navercorp.pinpoint.bootstrap.context.TraceId) DefaultTraceRoot(com.navercorp.pinpoint.profiler.context.id.DefaultTraceRoot) TraceRoot(com.navercorp.pinpoint.profiler.context.id.TraceRoot) ByteBuffer(java.nio.ByteBuffer) TransactionId(com.navercorp.pinpoint.common.profiler.util.TransactionId) Test(org.junit.Test)

Example 32 with TraceRoot

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

the class GrpcSpanProcessorV2Test method newSpan.

private Span newSpan() {
    TraceId traceId = new DefaultTraceId("agent", 1, 0);
    TraceRoot traceRoot = new DefaultTraceRoot(traceId, "agent", 0, 3);
    return new Span(traceRoot);
}
Also used : DefaultTraceId(com.navercorp.pinpoint.profiler.context.id.DefaultTraceId) DefaultTraceRoot(com.navercorp.pinpoint.profiler.context.id.DefaultTraceRoot) TraceId(com.navercorp.pinpoint.bootstrap.context.TraceId) DefaultTraceId(com.navercorp.pinpoint.profiler.context.id.DefaultTraceId) DefaultTraceRoot(com.navercorp.pinpoint.profiler.context.id.DefaultTraceRoot) TraceRoot(com.navercorp.pinpoint.profiler.context.id.TraceRoot) PSpan(com.navercorp.pinpoint.grpc.trace.PSpan) Span(com.navercorp.pinpoint.profiler.context.Span)

Example 33 with TraceRoot

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

the class SpanPostProcessorTest method postProcess2.

@Test
public void postProcess2() {
    SpanProcessor<TSpan, TSpanChunk> spanChunkPostProcessor = new SpanProcessorV1();
    TraceRoot internalTraceId = newInternalTraceId();
    List<TSpanEvent> tSpanEvents = new ArrayList<TSpanEvent>();
    TSpanChunk tSpanChunk = new TSpanChunk();
    tSpanChunk.setSpanEventList(tSpanEvents);
    List<SpanEvent> spanEvents = new ArrayList<SpanEvent>();
    SpanChunk spanChunk = new DefaultSpanChunk(internalTraceId, spanEvents);
    // one spanEvent
    addSpanEvent(tSpanEvents, spanEvents);
    spanChunkPostProcessor.postProcess(spanChunk, tSpanChunk);
    // two spanEvent
    addSpanEvent(tSpanEvents, spanEvents);
    spanChunkPostProcessor.postProcess(spanChunk, tSpanChunk);
    // three
    addSpanEvent(tSpanEvents, spanEvents);
    spanChunkPostProcessor.postProcess(spanChunk, tSpanChunk);
}
Also used : TSpanChunk(com.navercorp.pinpoint.thrift.dto.TSpanChunk) DefaultSpanChunk(com.navercorp.pinpoint.profiler.context.DefaultSpanChunk) SpanChunk(com.navercorp.pinpoint.profiler.context.SpanChunk) TSpanChunk(com.navercorp.pinpoint.thrift.dto.TSpanChunk) ArrayList(java.util.ArrayList) SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) TSpan(com.navercorp.pinpoint.thrift.dto.TSpan) DefaultTraceRoot(com.navercorp.pinpoint.profiler.context.id.DefaultTraceRoot) TraceRoot(com.navercorp.pinpoint.profiler.context.id.TraceRoot) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) DefaultSpanChunk(com.navercorp.pinpoint.profiler.context.DefaultSpanChunk) Test(org.junit.Test)

Example 34 with TraceRoot

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

the class DefaultSpanRecorder method recordLogging.

@Override
public void recordLogging(LoggingInfo loggingInfo) {
    final TraceRoot traceRoot = span.getTraceRoot();
    traceRoot.getShared().setLoggingInfo(loggingInfo.getCode());
}
Also used : TraceRoot(com.navercorp.pinpoint.profiler.context.id.TraceRoot)

Example 35 with TraceRoot

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

the class WrappedSpanEventRecorder method recordNextAsyncContext.

@Override
public AsyncContext recordNextAsyncContext() {
    final TraceRoot traceRoot = this.traceRoot;
    final AsyncId asyncIdObject = getNextAsyncId();
    // sequence or stack overflow
    final boolean canSampled = isOverflowState();
    return asyncContextFactory.newAsyncContext(traceRoot, asyncIdObject, canSampled);
}
Also used : AsyncId(com.navercorp.pinpoint.profiler.context.AsyncId) 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