Search in sources :

Example 41 with SpanEvent

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

the class BufferedStorageTest method testStore_flush.

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

Example 42 with SpanEvent

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

the class BufferedStorageTest method testStore_spanLastFlush.

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

Example 43 with SpanEvent

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

the class WrappedSpanEventRecorderTest method testRecordAPIId.

@Test
public void testRecordAPIId() throws Exception {
    SpanEvent spanEvent = new SpanEvent();
    WrappedSpanEventRecorder recorder = new WrappedSpanEventRecorder(traceRoot, asyncContextFactory, stringMetaDataService, sqlMetaDataService, errorHandler);
    recorder.setWrapped(spanEvent);
    final int API_ID = 1000;
    recorder.recordApiId(API_ID);
    Assert.assertEquals("API ID", spanEvent.getApiId(), API_ID);
}
Also used : SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent) Test(org.junit.Test)

Example 44 with SpanEvent

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

the class MSSSqlConnectionIT method testModify.

@Test
public void testModify() throws Exception {
    logger.debug("testModify");
    Connection connection = connectDB();
    logger.debug("Connection class name:{}", connection.getClass().getName());
    logger.debug("Connection class cl:{}", connection.getClass().getClassLoader());
    DatabaseInfo url = ((DatabaseInfoAccessor) connection)._$PINPOINT$_getDatabaseInfo();
    Assert.assertNotNull(url);
    List<SpanEvent> currentSpanEvents = getCurrentSpanEvents();
    logger.debug("{}", currentSpanEvents);
    // Assert.assertEquals(1, currentSpanEvents.size());
    statement(connection);
    currentSpanEvents = getCurrentSpanEvents();
    logger.debug("{}", currentSpanEvents);
    // Assert.assertEquals(2, currentSpanEvents.size());
    preparedStatement(connection);
    preparedStatement2(connection);
    preparedStatement3(connection);
    preparedStatement4(connection);
    preparedStatement5(connection);
    preparedStatement6(connection);
    preparedStatement7(connection);
    preparedStatement8(connection);
    connection.close();
    DatabaseInfo clearUrl = ((DatabaseInfoAccessor) connection)._$PINPOINT$_getDatabaseInfo();
    Assert.assertNull(clearUrl);
}
Also used : DatabaseInfo(com.navercorp.pinpoint.bootstrap.context.DatabaseInfo) DatabaseInfoAccessor(com.navercorp.pinpoint.bootstrap.plugin.jdbc.DatabaseInfoAccessor) Connection(java.sql.Connection) SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent) BasePinpointTest(com.navercorp.pinpoint.test.junit4.BasePinpointTest) Test(org.junit.Test)

Example 45 with SpanEvent

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

the class SpanEventBuilder method addSpanEvent.

public void addSpanEvent() {
    SpanEvent spanEvent = new SpanEvent();
    spanEvent.setSequence(nextSequence());
    spanEvent.setStartTime(nextStartTime());
    spanEventList.add(spanEvent);
}
Also used : SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent)

Aggregations

SpanEvent (com.navercorp.pinpoint.profiler.context.SpanEvent)49 TSpanEvent (com.navercorp.pinpoint.thrift.dto.TSpanEvent)23 Test (org.junit.Test)20 Span (com.navercorp.pinpoint.profiler.context.Span)18 TraceRoot (com.navercorp.pinpoint.profiler.context.id.TraceRoot)10 ArrayList (java.util.ArrayList)10 TSpan (com.navercorp.pinpoint.thrift.dto.TSpan)9 SpanChunk (com.navercorp.pinpoint.profiler.context.SpanChunk)7 PSpanEvent (com.navercorp.pinpoint.grpc.trace.PSpanEvent)6 BasePinpointTest (com.navercorp.pinpoint.test.junit4.BasePinpointTest)6 TraceId (com.navercorp.pinpoint.bootstrap.context.TraceId)5 VisibleForTesting (com.navercorp.pinpoint.common.annotations.VisibleForTesting)5 Shared (com.navercorp.pinpoint.profiler.context.id.Shared)5 DefaultTraceRoot (com.navercorp.pinpoint.profiler.context.id.DefaultTraceRoot)4 TSpanChunk (com.navercorp.pinpoint.thrift.dto.TSpanChunk)4 IntStringValue (com.navercorp.pinpoint.common.util.IntStringValue)3 PSpan (com.navercorp.pinpoint.grpc.trace.PSpan)3 DefaultSpanChunk (com.navercorp.pinpoint.profiler.context.DefaultSpanChunk)3 SpanType (com.navercorp.pinpoint.profiler.context.SpanType)3 DefaultTraceId (com.navercorp.pinpoint.profiler.context.id.DefaultTraceId)3