Package io.opentelemetry.sdk.trace.data
Class DelegatingSpanData
java.lang.Object
io.opentelemetry.sdk.trace.data.DelegatingSpanData
- All Implemented Interfaces:
SpanData
A
SpanData
which delegates all methods to another SpanData
. Extend this class to
modify the SpanData
that will be exported, for example by creating a delegating SpanExporter
which wraps SpanData
with a custom
implementation.
// class SpanDataWithClientType extends DelegatingSpanData {
//
// private final Attributes attributes;
//
// SpanDataWithClientType(SpanData delegate) {
// super(delegate);
// String clientType = ClientConfig.parseUserAgent(
// delegate.getAttributes().get(SemanticAttributes.HTTP_USER_AGENT).getStringValue());
// Attributes.Builder newAttributes = Attributes.builder(delegate.getAttributes());
// newAttributes.setAttribute("client_type", clientType);
// attributes = newAttributes.build();
// }
//
// @Override
// public Attributes getAttributes() {
// return attributes;
// }
// }
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
io.opentelemetry.api.common.Attributes
Returns the attributes recorded for thisSpan
.long
Returns the end epoch timestamp in nanos of thisSpan
.Returns the timed events recorded for thisSpan
.io.opentelemetry.sdk.common.InstrumentationLibraryInfo
Deprecated.io.opentelemetry.sdk.common.InstrumentationScopeInfo
Returns the instrumentation scope specified when creating the tracer which produced thisSpan
.io.opentelemetry.api.trace.SpanKind
getKind()
Returns the kind of thisSpan
.getLinks()
Returns links recorded for thisSpan
.getName()
Returns the name of thisSpan
.io.opentelemetry.api.trace.SpanContext
Returns the parentSpanContext
.io.opentelemetry.sdk.resources.Resource
Returns the resource of thisSpan
.io.opentelemetry.api.trace.SpanContext
Returns theSpanContext
of the Span.long
Returns the start epoch timestamp in nanos of thisSpan
.Returns theStatus
.int
The total number of attributes that were recorded on this span.int
The total number ofEventData
events that were recorded on this span.int
The total number ofLinkData
links that were recorded on this span.boolean
hasEnded()
Returns whether this Span has already been ended.int
hashCode()
toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.opentelemetry.sdk.trace.data.SpanData
getParentSpanId, getSpanId, getTraceId
-
Constructor Details
-
DelegatingSpanData
-
-
Method Details
-
getSpanContext
public io.opentelemetry.api.trace.SpanContext getSpanContext()Description copied from interface:SpanData
Returns theSpanContext
of the Span.- Specified by:
getSpanContext
in interfaceSpanData
-
getParentSpanContext
public io.opentelemetry.api.trace.SpanContext getParentSpanContext()Description copied from interface:SpanData
Returns the parentSpanContext
. If the span is a root span, theSpanContext
returned will be invalid.- Specified by:
getParentSpanContext
in interfaceSpanData
-
getResource
public io.opentelemetry.sdk.resources.Resource getResource()Description copied from interface:SpanData
Returns the resource of thisSpan
.- Specified by:
getResource
in interfaceSpanData
- Returns:
- the resource of this
Span
.
-
getInstrumentationLibraryInfo
@Deprecated public io.opentelemetry.sdk.common.InstrumentationLibraryInfo getInstrumentationLibraryInfo()Deprecated.Description copied from interface:SpanData
Returns the instrumentation library specified when creating the tracer which produced thisSpan
.- Specified by:
getInstrumentationLibraryInfo
in interfaceSpanData
- Returns:
- an instance of
InstrumentationLibraryInfo
-
getInstrumentationScopeInfo
public io.opentelemetry.sdk.common.InstrumentationScopeInfo getInstrumentationScopeInfo()Description copied from interface:SpanData
Returns the instrumentation scope specified when creating the tracer which produced thisSpan
.- Specified by:
getInstrumentationScopeInfo
in interfaceSpanData
- Returns:
- an instance of
InstrumentationScopeInfo
-
getName
Description copied from interface:SpanData
Returns the name of thisSpan
. -
getKind
public io.opentelemetry.api.trace.SpanKind getKind()Description copied from interface:SpanData
Returns the kind of thisSpan
. -
getStartEpochNanos
public long getStartEpochNanos()Description copied from interface:SpanData
Returns the start epoch timestamp in nanos of thisSpan
.- Specified by:
getStartEpochNanos
in interfaceSpanData
- Returns:
- the start epoch timestamp in nanos of this
Span
.
-
getAttributes
public io.opentelemetry.api.common.Attributes getAttributes()Description copied from interface:SpanData
Returns the attributes recorded for thisSpan
.- Specified by:
getAttributes
in interfaceSpanData
- Returns:
- the attributes recorded for this
Span
.
-
getEvents
Description copied from interface:SpanData
Returns the timed events recorded for thisSpan
. -
getLinks
Description copied from interface:SpanData
Returns links recorded for thisSpan
. -
getStatus
Description copied from interface:SpanData
Returns theStatus
. -
getEndEpochNanos
public long getEndEpochNanos()Description copied from interface:SpanData
Returns the end epoch timestamp in nanos of thisSpan
.- Specified by:
getEndEpochNanos
in interfaceSpanData
- Returns:
- the end epoch timestamp in nanos of this
Span
.
-
hasEnded
public boolean hasEnded()Description copied from interface:SpanData
Returns whether this Span has already been ended. -
getTotalRecordedEvents
public int getTotalRecordedEvents()Description copied from interface:SpanData
The total number ofEventData
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:SpanLimits.getMaxNumberOfEvents()
- Specified by:
getTotalRecordedEvents
in interfaceSpanData
- Returns:
- The total number of events recorded on this span.
-
getTotalRecordedLinks
public int getTotalRecordedLinks()Description copied from interface:SpanData
The total number ofLinkData
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:SpanLimits.getMaxNumberOfLinks()
- Specified by:
getTotalRecordedLinks
in interfaceSpanData
- Returns:
- The total number of links recorded on this span.
-
getTotalAttributeCount
public int getTotalAttributeCount()Description copied from interface:SpanData
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:SpanLimits.getMaxNumberOfAttributes()
- Specified by:
getTotalAttributeCount
in interfaceSpanData
- Returns:
- The total number of attributes on this span.
-
equals
-
hashCode
public int hashCode() -
toString
-