SofaTracerSpan implements Span { @Override public void finish() { this.finish(System.currentTimeMillis()); } SofaTracerSpan(SofaTracer sofaTracer, long startTime, String operationName,
                          SofaTracerSpanContext sofaTracerSpanContext, Map<String, ?> tags);  SofaTracerSpan(SofaTracer sofaTracer, long startTime,
                          List<SofaTracerSpanReferenceRelationship> spanReferences,
                          String operationName, SofaTracerSpanContext sofaTracerSpanContext,
                          Map<String, ?> tags); SofaTracerSpan cloneInstance(); @Override SpanContext context(); @Override void finish(); @Override void finish(long endTime); @Override void close(); @Override Span setTag(String key, String value); @Override Span setTag(String key, boolean value); @Override Span setTag(String key, Number number); @Override Span log(String eventValue); @Override Span log(long currentTime, String eventValue); Span log(LogData logData); @Override Span log(long currentTime, Map<String, ?> map); @Override Span log(Map<String, ?> map); @Override Span log(String eventName, /* @Nullable */Object payload); @Override Span log(long currentTime, String eventName, /* @Nullable */Object payload); @Override Span setBaggageItem(String key, String value); @Override String getBaggageItem(String key); @Override Span setOperationName(String operationName); void reportError(String errorType, Map<String, String> context, Throwable e,
                            String errorSourceApp, String... errorSources); void profile(String profileApp, String protocolType, String profileMessage); SofaTracerSpan getThisAsParentWhenExceedLayer(); List<SofaTracerSpanReferenceRelationship> getSpanReferences(); SofaTracer getSofaTracer(); long getStartTime(); void setStartTime(long startTime); long getEndTime(); void setEndTime(long endTime); long getDurationMicroseconds(); Map<String, String> getTagsWithStr(); Map<String, Boolean> getTagsWithBool(); Map<String, Number> getTagsWithNumber(); String getOperationName(); SofaTracerSpanContext getSofaTracerSpanContext(); List<LogData> getLogs(); String getLogType(); void setLogType(String logType); SofaTracerSpan getParentSofaTracerSpan(); void setParentSofaTracerSpan(SofaTracerSpan parentSofaTracerSpan); boolean isServer(); boolean isClient(); @Override String toString(); static final char ARRAY_SEPARATOR; }
@Test public void testFinish() throws Exception { SofaTracerSpan span = (SofaTracerSpan) this.sofaTracer.buildSpan("testWithTimestamp") .withStartTimestamp(111).start(); long endTime = System.currentTimeMillis(); span.finish(); assertTrue("Endtime : " + endTime + ", Duration :" + span.getDurationMicroseconds(), 111 < span.getDurationMicroseconds() && span.getDurationMicroseconds() < endTime); }