Class Link

java.lang.Object
io.opencensus.trace.Link
Direct Known Subclasses:
AutoValue_Link

@Immutable public abstract class Link extends Object
A link to a Span from a different trace.

It requires a Link.Type which describes the relationship with the linked Span and the identifiers of the linked Span.

Used (for example) in batching operations, where a single batch handler processes multiple requests from different traces.

Since:
0.5
  • Field Details

  • Constructor Details

    • Link

      Link()
  • Method Details

    • fromSpanContext

      public static Link fromSpanContext(SpanContext context, Link.Type type)
      Returns a new Link.
      Parameters:
      context - the context of the linked Span.
      type - the type of the relationship with the linked Span.
      Returns:
      a new Link.
      Since:
      0.5
    • fromSpanContext

      public static Link fromSpanContext(SpanContext context, Link.Type type, Map<String,AttributeValue> attributes)
      Returns a new Link.
      Parameters:
      context - the context of the linked Span.
      type - the type of the relationship with the linked Span.
      attributes - the attributes of the Link.
      Returns:
      a new Link.
      Since:
      0.5
    • getTraceId

      public abstract TraceId getTraceId()
      Returns the TraceId.
      Returns:
      the TraceId.
      Since:
      0.5
    • getSpanId

      public abstract SpanId getSpanId()
      Returns the SpanId.
      Returns:
      the SpanId
      Since:
      0.5
    • getType

      public abstract Link.Type getType()
      Returns the Type.
      Returns:
      the Type.
      Since:
      0.5
    • getAttributes

      public abstract Map<String,AttributeValue> getAttributes()
      Returns the set of attributes.
      Returns:
      the set of attributes.
      Since:
      0.5