diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/MilliSpan.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/MilliSpan.java index 450068fcc..858060afb 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/MilliSpan.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/MilliSpan.java @@ -30,19 +30,22 @@ public class MilliSpan implements Span { @Override public synchronized void stop() { if (end == 0) { - if (begin == 0) + if (begin == 0) { throw new IllegalStateException("Span for " + name + " has not been started"); + } end = System.currentTimeMillis(); } } @Override public synchronized long getAccumulatedMillis() { - if (begin == 0) + if (begin == 0) { return 0; - if (end > 0) + } + if (end > 0) { return end - begin; + } return System.currentTimeMillis() - begin; }