use of com.navercorp.pinpoint.profiler.context.SpanEvent in project pinpoint by naver.
the class WrappedSpanEventRecorderTest method testSetExceptionInfo_RootMarkError.
@Test
public void testSetExceptionInfo_RootMarkError() throws Exception {
when(traceRoot.getShared()).thenReturn(shared);
SpanEvent spanEvent = new SpanEvent();
WrappedSpanEventRecorder recorder = new WrappedSpanEventRecorder(traceRoot, asyncContextFactory, stringMetaDataService, sqlMetaDataService, errorHandler);
recorder.setWrapped(spanEvent);
final String exceptionMessage1 = "exceptionMessage1";
final Exception exception1 = new Exception(exceptionMessage1);
recorder.recordException(false, exception1);
Assert.assertEquals("Exception recoding", exceptionMessage1, spanEvent.getExceptionInfo().getStringValue());
verify(shared, never()).maskErrorCode(anyInt());
final String exceptionMessage2 = "exceptionMessage2";
final Exception exception2 = new Exception(exceptionMessage2);
recorder.recordException(true, exception2);
Assert.assertEquals("Exception recoding", exceptionMessage2, spanEvent.getExceptionInfo().getStringValue());
verify(shared, only()).maskErrorCode(1);
}
use of com.navercorp.pinpoint.profiler.context.SpanEvent in project pinpoint by naver.
the class SpanPostProcessorTest method addSpanEvent.
private void addSpanEvent(List<TSpanEvent> tSpanEvents, List<SpanEvent> spanEvents) {
spanEvents.add(new SpanEvent());
tSpanEvents.add(new TSpanEvent());
}
use of com.navercorp.pinpoint.profiler.context.SpanEvent in project pinpoint by naver.
the class SpanPostProcessorTest method postProcess1.
@Test
public void postProcess1() {
SpanProcessor<TSpan, TSpanChunk> spanChunkPostProcessor = new SpanProcessorV1();
TraceRoot internalTraceId = newInternalTraceId();
TSpanChunk tSpanChunk = new TSpanChunk();
try {
SpanChunk spanChunk = new DefaultSpanChunk(internalTraceId, new ArrayList<SpanEvent>());
spanChunkPostProcessor.postProcess(spanChunk, tSpanChunk);
Assert.fail();
} catch (Exception ignored) {
}
}
use of com.navercorp.pinpoint.profiler.context.SpanEvent in project pinpoint by naver.
the class GrpcSpanProcessorV2Test method postProcess.
@Test
public void postProcess() {
Span span = newSpan();
SpanEventBuilder factory = new SpanEventBuilder();
factory.addSpanEvent();
factory.addSpanEvent();
factory.addSpanEvent();
span.setSpanEventList(factory.getSpanEventList());
PSpan.Builder builder = PSpan.newBuilder();
for (SpanEvent spanEvent : span.getSpanEventList()) {
PSpanEvent.Builder pSpanEvent = converter.buildPSpanEvent(spanEvent);
builder.addSpanEvent(pSpanEvent);
}
spanProcessorProtoV2.postProcess(span, builder);
PSpan pSpan = builder.build();
List<PSpanEvent> pSpanEventList = pSpan.getSpanEventList();
List<SpanEvent> spanEventList = span.getSpanEventList();
long keyStartTime = span.getStartTime();
for (int i = 0; i < pSpanEventList.size(); i++) {
PSpanEvent pSpanEvent = pSpanEventList.get(i);
SpanEvent next = spanEventList.get(i);
long startTime = keyStartTime + pSpanEvent.getStartElapsed();
Assert.assertEquals(startTime, next.getStartTime());
keyStartTime = startTime;
}
}
use of com.navercorp.pinpoint.profiler.context.SpanEvent in project pinpoint by naver.
the class InformixConnectionIT method execute.
@Test
public void execute() throws SQLException {
Connection connection = null;
try {
connection = createConnection("localhost:" + container.getFirstMappedPort() + "/sysmaster", "informix", "in4mix");
statement(connection);
preparedStatement2(connection);
preparedStatement3(connection);
preparedStatement4(connection);
preparedStatement5(connection);
preparedStatement6(connection);
preparedStatement7(connection);
preparedStatement8(connection);
List<SpanEvent> currentSpanEvents = getCurrentSpanEvents();
LOGGER.info("{}", currentSpanEvents);
} finally {
if (connection != null) {
connection.close();
}
}
}
Aggregations