MutableSpan implements Cloneable { @Nullable public String tag(String key) { if (key == null) throw new NullPointerException("key == null"); if (key.isEmpty()) throw new IllegalArgumentException("key is empty"); for (int i = 0, length = tagCount * 2; i < length; i += 2) { if (key.equals(tags[i])) return (String) tags[i + 1]; } return null; } MutableSpan();  MutableSpan(TraceContext context, @Nullable MutableSpan defaults);  MutableSpan(MutableSpan toCopy); @Deprecated boolean isEmpty(); String traceId(); void traceId(String traceId); @Nullable String localRootId(); void localRootId(String localRootId); @Nullable String parentId(); void parentId(@Nullable String parentId); String id(); void id(String id); @Nullable String name(); void name(@Nullable String name); long startTimestamp(); void startTimestamp(long startTimestamp); long finishTimestamp(); void finishTimestamp(long finishTimestamp); Kind kind(); void kind(@Nullable Kind kind); @Nullable String localServiceName(); void localServiceName(@Nullable String localServiceName); @Nullable String localIp(); boolean localIp(@Nullable String localIp); int localPort(); void localPort(int localPort); @Nullable String remoteServiceName(); void remoteServiceName(@Nullable String remoteServiceName); @Nullable String remoteIp(); void remoteIp(@Nullable String remoteIp); int remotePort(); void remotePort(int remotePort); boolean remoteIpAndPort(@Nullable String remoteIp, int remotePort); Throwable error(); void error(@Nullable Throwable error); boolean debug(); void setDebug(); void unsetDebug(); boolean shared(); void setShared(); void unsetShared(); int annotationCount(); long annotationTimestampAt(int i); String annotationValueAt(int i); Collection<Map.Entry<Long, String>> annotations(); void forEachAnnotation(AnnotationConsumer<T> annotationConsumer, T target); void forEachAnnotation(AnnotationUpdater annotationUpdater); boolean containsAnnotation(String value); void annotate(long timestamp, String value); int tagCount(); String tagKeyAt(int i); String tagValueAt(int i); Map<String, String> tags(); @Nullable String tag(String key); @Nullable String removeTag(String key); void forEachTag(TagConsumer<T> tagConsumer, T target); void forEachTag(TagUpdater tagUpdater); void tag(String key, String value); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object o);  }
@Test public void accessorScansTags() { MutableSpan span = new MutableSpan(); span.tag("http.method", "GET"); span.tag("error", "500"); span.tag("http.path", "/api"); assertThat(span.tag("error")).isEqualTo("500"); assertThat(span.tag("whoops")).isNull(); }