Package io.opencensus.trace
Class Link
- java.lang.Object
-
- io.opencensus.trace.Link
-
- Direct Known Subclasses:
AutoValue_Link
@Immutable public abstract class Link extends java.lang.Object
A link to aSpan
from a different trace.It requires a
Link.Type
which describes the relationship with the linkedSpan
and the identifiers of the linkedSpan
.Used (for example) in batching operations, where a single batch handler processes multiple requests from different traces.
- Since:
- 0.5
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Link.Type
The relationship with the linkedSpan
relative to the currentSpan
.
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Map<java.lang.String,AttributeValue>
EMPTY_ATTRIBUTES
-
Constructor Summary
Constructors Constructor Description Link()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static Link
fromSpanContext(SpanContext context, Link.Type type)
Returns a newLink
.static Link
fromSpanContext(SpanContext context, Link.Type type, java.util.Map<java.lang.String,AttributeValue> attributes)
Returns a newLink
.abstract java.util.Map<java.lang.String,AttributeValue>
getAttributes()
Returns the set of attributes.abstract SpanId
getSpanId()
Returns theSpanId
.abstract TraceId
getTraceId()
Returns theTraceId
.abstract Link.Type
getType()
Returns theType
.
-
-
-
Field Detail
-
EMPTY_ATTRIBUTES
private static final java.util.Map<java.lang.String,AttributeValue> EMPTY_ATTRIBUTES
-
-
Method Detail
-
fromSpanContext
public static Link fromSpanContext(SpanContext context, Link.Type type)
Returns a newLink
.- Parameters:
context
- the context of the linkedSpan
.type
- the type of the relationship with the linkedSpan
.- Returns:
- a new
Link
. - Since:
- 0.5
-
fromSpanContext
public static Link fromSpanContext(SpanContext context, Link.Type type, java.util.Map<java.lang.String,AttributeValue> attributes)
Returns a newLink
.- Parameters:
context
- the context of the linkedSpan
.type
- the type of the relationship with the linkedSpan
.attributes
- the attributes of theLink
.- Returns:
- a new
Link
. - Since:
- 0.5
-
getTraceId
public abstract TraceId getTraceId()
Returns theTraceId
.- Returns:
- the
TraceId
. - Since:
- 0.5
-
getSpanId
public abstract SpanId getSpanId()
Returns theSpanId
.- Returns:
- the
SpanId
- Since:
- 0.5
-
getType
public abstract Link.Type getType()
Returns theType
.- Returns:
- the
Type
. - Since:
- 0.5
-
getAttributes
public abstract java.util.Map<java.lang.String,AttributeValue> getAttributes()
Returns the set of attributes.- Returns:
- the set of attributes.
- Since:
- 0.5
-
-