use of org.apache.skywalking.apm.agent.core.context.trace.LogDataEntity in project incubator-skywalking by apache.
the class TomcatInvokeInterceptorTest method testWithOccurException.
@Test
public void testWithOccurException() throws Throwable {
tomcatInvokeInterceptor.beforeMethod(enhancedInstance, null, arguments, argumentType, methodInterceptResult);
tomcatInvokeInterceptor.handleMethodException(enhancedInstance, null, arguments, argumentType, new RuntimeException());
tomcatInvokeInterceptor.afterMethod(enhancedInstance, null, arguments, argumentType, null);
assertThat(segmentStorage.getTraceSegments().size(), is(1));
TraceSegment traceSegment = segmentStorage.getTraceSegments().get(0);
List<AbstractTracingSpan> spans = SegmentHelper.getSpans(traceSegment);
assertHttpSpan(spans.get(0));
List<LogDataEntity> logDataEntities = SpanHelper.getLogs(spans.get(0));
assertThat(logDataEntities.size(), is(1));
SpanAssert.assertException(logDataEntities.get(0), RuntimeException.class);
}
use of org.apache.skywalking.apm.agent.core.context.trace.LogDataEntity in project incubator-skywalking by apache.
the class MemcachedMethodInterceptorTest method assertLogData.
private void assertLogData(List<LogDataEntity> logDataEntities) {
assertThat(logDataEntities.size(), is(1));
LogDataEntity logData = logDataEntities.get(0);
Assert.assertThat(logData.getLogs().size(), is(4));
Assert.assertThat(logData.getLogs().get(0).getValue(), CoreMatchers.<Object>is("error"));
Assert.assertThat(logData.getLogs().get(1).getValue(), CoreMatchers.<Object>is(RuntimeException.class.getName()));
Assert.assertNull(logData.getLogs().get(2).getValue());
assertNotNull(logData.getLogs().get(3).getValue());
}
use of org.apache.skywalking.apm.agent.core.context.trace.LogDataEntity in project incubator-skywalking by apache.
the class TestException method assertHttpSpanErrorLog.
private void assertHttpSpanErrorLog(List<LogDataEntity> logs) {
assertThat(logs.size(), is(1));
LogDataEntity logData = logs.get(0);
Assert.assertThat(logData.getLogs().size(), is(4));
Assert.assertThat(logData.getLogs().get(0).getValue(), CoreMatchers.<Object>is("error"));
Assert.assertThat(logData.getLogs().get(1).getValue(), CoreMatchers.<Object>is(RuntimeException.class.getName()));
Assert.assertThat(logData.getLogs().get(2).getValue(), is("testException"));
assertNotNull(logData.getLogs().get(3).getValue());
}
use of org.apache.skywalking.apm.agent.core.context.trace.LogDataEntity in project incubator-skywalking by apache.
the class RequestMappingMethodInterceptorTest method testWithOccurException.
@Test
public void testWithOccurException() throws Throwable {
controllerConstructorInterceptor.onConstruct(enhancedInstance, null);
RequestMappingClass1 mappingClass1 = new RequestMappingClass1();
Method m = mappingClass1.getClass().getMethod("testRequestURL");
RequestContextHolder.setRequestAttributes(servletRequestAttributes);
interceptor.beforeMethod(enhancedInstance, m, arguments, argumentType, methodInterceptResult);
interceptor.handleMethodException(enhancedInstance, m, arguments, argumentType, new RuntimeException());
interceptor.afterMethod(enhancedInstance, m, arguments, argumentType, null);
assertThat(segmentStorage.getTraceSegments().size(), is(1));
TraceSegment traceSegment = segmentStorage.getTraceSegments().get(0);
List<AbstractTracingSpan> spans = SegmentHelper.getSpans(traceSegment);
assertHttpSpan(spans.get(0));
List<LogDataEntity> logDataEntities = SpanHelper.getLogs(spans.get(0));
assertThat(logDataEntities.size(), is(1));
SpanAssert.assertException(logDataEntities.get(0), RuntimeException.class);
}
use of org.apache.skywalking.apm.agent.core.context.trace.LogDataEntity in project incubator-skywalking by apache.
the class HandleInterceptorTest method testWithOccurException.
@Test
public void testWithOccurException() throws Throwable {
jettyInvokeInterceptor.beforeMethod(enhancedInstance, null, arguments, argumentType, methodInterceptResult);
jettyInvokeInterceptor.handleMethodException(enhancedInstance, null, arguments, argumentType, new RuntimeException());
jettyInvokeInterceptor.afterMethod(enhancedInstance, null, arguments, argumentType, null);
assertThat(segmentStorage.getTraceSegments().size(), is(1));
TraceSegment traceSegment = segmentStorage.getTraceSegments().get(0);
List<AbstractTracingSpan> spans = SegmentHelper.getSpans(traceSegment);
assertHttpSpan(spans.get(0));
List<LogDataEntity> logDataEntities = SpanHelper.getLogs(spans.get(0));
assertThat(logDataEntities.size(), is(1));
SpanAssert.assertException(logDataEntities.get(0), RuntimeException.class);
}
Aggregations