Fixed not starting of span for @scheduled. fixes gh-1019

This commit is contained in:
Marcin Grzejszczak
2018-06-28 11:33:49 +02:00
parent da1df97327
commit 6488d2206b
2 changed files with 2 additions and 1 deletions

View File

@@ -62,7 +62,7 @@ public class TraceSchedulingAspect {
}
String spanName = SpanNameUtil.toLowerHyphen(pjp.getSignature().getName());
Span span = startOrContinueRenamedSpan(spanName);
try(Tracer.SpanInScope ws = this.tracer.withSpanInScope(span)) {
try(Tracer.SpanInScope ws = this.tracer.withSpanInScope(span.start())) {
span.tag(CLASS_KEY, pjp.getTarget().getClass().getSimpleName());
span.tag(METHOD_KEY, pjp.getSignature().getName());
return pjp.proceed();

View File

@@ -92,6 +92,7 @@ public class TracingOnScheduledTests {
then(this.reporter.getSpans().get(0).tags())
.contains(new AbstractMap.SimpleEntry<>("class", "TestBeanWithScheduledMethod"),
new AbstractMap.SimpleEntry<>("method", "scheduledMethod"));
then(this.reporter.getSpans().get(0).durationAsLong()).isGreaterThan(0L);
}
private void differentSpanHasBeenSetThan(final Span spanToCompare) {