本文共 2706 字,大约阅读时间需要 9 分钟。
Iterable<Map.Entry<String, String>> baggageItems();
void inject(SpanContext spanContext, Format format, C carrier); SpanContext extract(Format format, C carrier);
public interface Format{ final class Builtin implements Format { public final static Format TEXT_MAP = new Builtin (); public final static Format HTTP_HEADERS = new Builtin (); public final static Format BINARY = new Builtin (); }
interface SpanBuilder extends SpanContext { /** * A shorthand for addReference(References.CHILD_OF, parent). */ SpanBuilder asChildOf(SpanContext parent); /** * A shorthand for addReference(References.CHILD_OF, parent.context()). */ SpanBuilder asChildOf(Span parent); /** * Add a reference from the Span being built to a distinct (usually parent) Span. May be called multiple times to * represent multiple such References. * * @param referenceType the reference type, typically one of the constants defined in References * @param referencedContext the SpanContext being referenced; e.g., for a References.CHILD_OF referenceType, the * referencedContext is the parent * * @see io.opentracing.References */ SpanBuilder addReference(String referenceType, SpanContext referencedContext); /** Same as {@link Span#setTag(String, String)}, but for the span being built. */ SpanBuilder withTag(String key, String value); /** Same as {@link Span#setTag(String, String)}, but for the span being built. */ SpanBuilder withTag(String key, boolean value); /** Same as {@link Span#setTag(String, String)}, but for the span being built. */ SpanBuilder withTag(String key, Number value); /** Specify a timestamp of when the Span was started, represented in microseconds since epoch. */ SpanBuilder withStartTimestamp(long microseconds); /** Returns the started Span. */ Span start(); }