use of org.apache.skywalking.apm.agent.core.context.IgnoredTracerContext in project incubator-skywalking by apache.
the class TracingSegmentRunner method withAfters.
@Override
protected Statement withAfters(FrameworkMethod method, Object target, final Statement statement) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
if (field != null) {
try {
tracingData = new SegmentStorage();
field.set(targetObject, tracingData);
} catch (IllegalAccessException e) {
}
}
tracingContextListener = new TracingContextListener() {
@Override
public void afterFinished(TraceSegment traceSegment) {
tracingData.addTraceSegment(traceSegment);
}
};
ignoreTracerContextListener = new IgnoreTracerContextListener() {
@Override
public void afterFinished(IgnoredTracerContext tracerContext) {
tracingData.addIgnoreTraceContext(tracerContext);
}
};
TracingContext.ListenerManager.add(tracingContextListener);
IgnoredTracerContext.ListenerManager.add(ignoreTracerContextListener);
try {
statement.evaluate();
} finally {
TracingContext.ListenerManager.remove(tracingContextListener);
IgnoredTracerContext.ListenerManager.remove(ignoreTracerContextListener);
}
}
};
}
use of org.apache.skywalking.apm.agent.core.context.IgnoredTracerContext in project incubator-skywalking by apache.
the class TracingSegmentRunner method withAfters.
@Override
protected Statement withAfters(FrameworkMethod method, Object target, final Statement statement) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
if (field != null) {
try {
tracingData = new SegmentStorage();
field.set(targetObject, tracingData);
} catch (IllegalAccessException e) {
}
}
tracingContextListener = new TracingContextListener() {
@Override
public void afterFinished(TraceSegment traceSegment) {
tracingData.addTraceSegment(traceSegment);
}
};
ignoreTracerContextListener = new IgnoreTracerContextListener() {
@Override
public void afterFinished(IgnoredTracerContext tracerContext) {
tracingData.addIgnoreTraceContext(tracerContext);
}
};
TracingContext.ListenerManager.add(tracingContextListener);
IgnoredTracerContext.ListenerManager.add(ignoreTracerContextListener);
try {
statement.evaluate();
} finally {
TracingContext.ListenerManager.remove(tracingContextListener);
IgnoredTracerContext.ListenerManager.remove(ignoreTracerContextListener);
}
}
};
}
Aggregations