/** * Completes the span, which took {@code duration} microseconds. */ public void finishSpan(long duration) { Span span = currentSpan().get(); if (span == null) return; final Long timestamp; synchronized (span) { timestamp = span.getTimestamp(); } if (timestamp == null) { recorder().flush(span); } else { recorder().finish(span, timestamp + duration); } currentSpan().setCurrentSpan(null); }