Package io.opentelemetry.sdk.trace.data
Interface SpanData
-
@Immutable public interface SpanData
Immutable representation of all data collected by theSpan
class.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
SpanData.Event
static interface
SpanData.Link
A link to aSpan
.static interface
SpanData.Status
Defines the status of aSpan
by providing a standardStatusCode
in conjunction with an optional descriptive message.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description io.opentelemetry.api.common.Attributes
getAttributes()
Returns the attributes recorded for thisSpan
.long
getEndEpochNanos()
Returns the end epoch timestamp in nanos of thisSpan
.List<SpanData.Event>
getEvents()
Returns the timed events recorded for thisSpan
.io.opentelemetry.sdk.common.InstrumentationLibraryInfo
getInstrumentationLibraryInfo()
Returns the instrumentation library specified when creating the tracer which produced thisSpan
.io.opentelemetry.api.trace.Span.Kind
getKind()
Returns the kind of thisSpan
.List<SpanData.Link>
getLinks()
Returns links recorded for thisSpan
.String
getName()
Returns the name of thisSpan
.io.opentelemetry.api.trace.SpanContext
getParentSpanContext()
Returns the parentSpanContext
.default String
getParentSpanId()
Returns the parentSpanId
.io.opentelemetry.sdk.resources.Resource
getResource()
Returns the resource of thisSpan
.String
getSpanId()
Gets the span id for this span.long
getStartEpochNanos()
Returns the start epoch timestamp in nanos of thisSpan
.SpanData.Status
getStatus()
Returns theStatus
.int
getTotalAttributeCount()
The total number of attributes that were recorded on this span.int
getTotalRecordedEvents()
The total number ofSpanData.Event
events that were recorded on this span.int
getTotalRecordedLinks()
The total number ofImmutableLink
links that were recorded on this span.String
getTraceId()
Gets the trace id for this span.io.opentelemetry.api.trace.TraceState
getTraceState()
Gets theTraceState
for this span.boolean
hasEnded()
Returns whether this Span has already been ended.default boolean
hasRemoteParent()
Deprecated.boolean
isSampled()
Whether the 'sampled' option set on this span.
-
-
-
Method Detail
-
getTraceId
String getTraceId()
Gets the trace id for this span.- Returns:
- the trace id.
-
getSpanId
String getSpanId()
Gets the span id for this span.- Returns:
- the span id.
-
isSampled
boolean isSampled()
Whether the 'sampled' option set on this span.
-
getTraceState
io.opentelemetry.api.trace.TraceState getTraceState()
Gets theTraceState
for this span.- Returns:
- the
TraceState
for this span.
-
getParentSpanContext
io.opentelemetry.api.trace.SpanContext getParentSpanContext()
Returns the parentSpanContext
. If the span is a root span, theSpanContext
returned will be invalid.
-
getParentSpanId
default String getParentSpanId()
Returns the parentSpanId
. If theSpan
is a rootSpan
, the SpanId returned will be invalid.- Returns:
- the parent
SpanId
or an invalid SpanId if this is a rootSpan
.
-
hasRemoteParent
@Deprecated default boolean hasRemoteParent()
Deprecated.Returnstrue
if the parent is on a different process.false
if this is a root span.- Returns:
true
if the parent is on a different process.false
if this is a root span.
-
getResource
io.opentelemetry.sdk.resources.Resource getResource()
Returns the resource of thisSpan
.- Returns:
- the resource of this
Span
.
-
getInstrumentationLibraryInfo
io.opentelemetry.sdk.common.InstrumentationLibraryInfo getInstrumentationLibraryInfo()
Returns the instrumentation library specified when creating the tracer which produced thisSpan
.- Returns:
- an instance of
InstrumentationLibraryInfo
-
getName
String getName()
Returns the name of thisSpan
.- Returns:
- the name of this
Span
.
-
getKind
io.opentelemetry.api.trace.Span.Kind getKind()
Returns the kind of thisSpan
.- Returns:
- the kind of this
Span
.
-
getStartEpochNanos
long getStartEpochNanos()
Returns the start epoch timestamp in nanos of thisSpan
.- Returns:
- the start epoch timestamp in nanos of this
Span
.
-
getAttributes
io.opentelemetry.api.common.Attributes getAttributes()
Returns the attributes recorded for thisSpan
.- Returns:
- the attributes recorded for this
Span
.
-
getEvents
List<SpanData.Event> getEvents()
Returns the timed events recorded for thisSpan
.- Returns:
- the timed events recorded for this
Span
.
-
getLinks
List<SpanData.Link> getLinks()
Returns links recorded for thisSpan
.- Returns:
- links recorded for this
Span
.
-
getStatus
SpanData.Status getStatus()
Returns theStatus
.- Returns:
- the
Status
.
-
getEndEpochNanos
long getEndEpochNanos()
Returns the end epoch timestamp in nanos of thisSpan
.- Returns:
- the end epoch timestamp in nanos of this
Span
.
-
hasEnded
boolean hasEnded()
Returns whether this Span has already been ended.- Returns:
true
if the span has already been ended,false
if not.
-
getTotalRecordedEvents
int getTotalRecordedEvents()
The total number ofSpanData.Event
events that were recorded on this span. This number may be larger than the number of events that are attached to this span, if the total number recorded was greater than the configured maximum value. See:TraceConfig.getMaxNumberOfEvents()
- Returns:
- The total number of events recorded on this span.
-
getTotalRecordedLinks
int getTotalRecordedLinks()
The total number ofImmutableLink
links that were recorded on this span. This number may be larger than the number of links that are attached to this span, if the total number recorded was greater than the configured maximum value. See:TraceConfig.getMaxNumberOfLinks()
- Returns:
- The total number of links recorded on this span.
-
getTotalAttributeCount
int getTotalAttributeCount()
The total number of attributes that were recorded on this span. This number may be larger than the number of attributes that are attached to this span, if the total number recorded was greater than the configured maximum value. See:TraceConfig.getMaxNumberOfAttributes()
- Returns:
- The total number of attributes on this span.
-
-