Search in sources :

Example 11 with Span

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

the class DefaultSpanRecorderTest method testRecordApiId.

@Test
public void testRecordApiId() throws Exception {
    Span span = new Span(traceRoot);
    SpanRecorder recorder = new DefaultSpanRecorder(span, true, true, stringMetaDataService, sqlMetaDataService, errorHandler);
    final int API_ID = 1000;
    recorder.recordApiId(API_ID);
    Assert.assertEquals("API ID", span.getApiId(), API_ID);
}
Also used : SpanRecorder(com.navercorp.pinpoint.bootstrap.context.SpanRecorder) Span(com.navercorp.pinpoint.profiler.context.Span) Test(org.junit.Test)

Example 12 with Span

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

the class DefaultSpanRecorderTest method testRecordEndPoint.

@Test
public void testRecordEndPoint() throws Exception {
    when(traceRoot.getShared()).thenReturn(shared);
    Span span = new Span(traceRoot);
    SpanRecorder recorder = new DefaultSpanRecorder(span, true, true, stringMetaDataService, sqlMetaDataService, errorHandler);
    final String endPoint = "endPoint";
    recorder.recordEndPoint(endPoint);
    verify(traceRoot.getShared()).setEndPoint(endPoint);
}
Also used : SpanRecorder(com.navercorp.pinpoint.bootstrap.context.SpanRecorder) Span(com.navercorp.pinpoint.profiler.context.Span) Test(org.junit.Test)

Example 13 with Span

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

the class BufferedStorageTest method testStore_spanFlush.

@Test
public void testStore_spanFlush() throws Exception {
    BufferedStorage bufferedStorage = newBufferedStorage(10);
    Span span = new Span(internalTraceId);
    bufferedStorage.store(span);
    bufferedStorage.store(span);
    bufferedStorage.store(span);
    Assert.assertEquals(3, countingDataSender.getSenderCounter());
    Assert.assertEquals(3, countingDataSender.getTotalCount());
    Assert.assertEquals(3, countingDataSender.getSpanCounter());
    Assert.assertEquals(0, countingDataSender.getSpanChunkCounter());
}
Also used : Span(com.navercorp.pinpoint.profiler.context.Span) Test(org.junit.Test)

Example 14 with Span

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

the class BufferedStorageTest method testStore_manual_flush.

@Test
public void testStore_manual_flush() throws Exception {
    BufferedStorage bufferedStorage = newBufferedStorage(10);
    Span span = new Span(internalTraceId);
    SpanEvent spanEvent = new SpanEvent();
    bufferedStorage.store(spanEvent);
    bufferedStorage.store(spanEvent);
    bufferedStorage.flush();
    Assert.assertEquals(1, countingDataSender.getSenderCounter());
    Assert.assertEquals(1, countingDataSender.getTotalCount());
    Assert.assertEquals(0, countingDataSender.getSpanCounter());
    Assert.assertEquals(1, countingDataSender.getSpanChunkCounter());
}
Also used : SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent) Span(com.navercorp.pinpoint.profiler.context.Span) Test(org.junit.Test)

Example 15 with Span

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

the class BufferedStorageTest method testStore_Noflush.

@Test
public void testStore_Noflush() throws Exception {
    BufferedStorage bufferedStorage = newBufferedStorage(10);
    Span span = new Span(internalTraceId);
    SpanEvent spanEvent = new SpanEvent();
    bufferedStorage.store(spanEvent);
    bufferedStorage.store(spanEvent);
    Assert.assertEquals(0, countingDataSender.getTotalCount());
}
Also used : SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent) Span(com.navercorp.pinpoint.profiler.context.Span) Test(org.junit.Test)

Aggregations

Span (com.navercorp.pinpoint.profiler.context.Span)34 SpanEvent (com.navercorp.pinpoint.profiler.context.SpanEvent)18 Test (org.junit.Test)16 TSpanEvent (com.navercorp.pinpoint.thrift.dto.TSpanEvent)11 TSpan (com.navercorp.pinpoint.thrift.dto.TSpan)8 DefaultTraceId (com.navercorp.pinpoint.profiler.context.id.DefaultTraceId)7 ArrayList (java.util.ArrayList)7 SpanChunk (com.navercorp.pinpoint.profiler.context.SpanChunk)6 DefaultTraceRoot (com.navercorp.pinpoint.profiler.context.id.DefaultTraceRoot)6 TraceRoot (com.navercorp.pinpoint.profiler.context.id.TraceRoot)6 TraceId (com.navercorp.pinpoint.bootstrap.context.TraceId)5 PSpan (com.navercorp.pinpoint.grpc.trace.PSpan)5 SpanType (com.navercorp.pinpoint.profiler.context.SpanType)4 SpanRecorder (com.navercorp.pinpoint.bootstrap.context.SpanRecorder)3 DefaultAsyncSpanChunk (com.navercorp.pinpoint.profiler.context.DefaultAsyncSpanChunk)3 DefaultLocalAsyncId (com.navercorp.pinpoint.profiler.context.DefaultLocalAsyncId)3 DefaultSpanChunk (com.navercorp.pinpoint.profiler.context.DefaultSpanChunk)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 PrintStream (java.io.PrintStream)3 PSpanEvent (com.navercorp.pinpoint.grpc.trace.PSpanEvent)2