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.USER_AGENT_ORIGINAL).getStringValue());
// Attributes.Builder newAttributes = Attributes.builder(delegate.getAttributes());
// newAttributes.setAttribute("client_type", clientType);
// attributes = newAttributes.build();
// }
//
// @Override
// public Attributes getAttributes() {
// return attributes;
// }
// }
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the attributes recorded for thisSpan.longReturns the end epoch timestamp in nanos of thisSpan.Returns the timed events recorded for thisSpan.Deprecated.Returns the instrumentation scope specified when creating the tracer which produced thisSpan.getKind()Returns the kind of thisSpan.getLinks()Returns links recorded for thisSpan.getName()Returns the name of thisSpan.Returns the parentSpanContext.Returns the resource of thisSpan.Returns theSpanContextof the Span.longReturns the start epoch timestamp in nanos of thisSpan.Returns theStatus.intThe total number of attributes that were recorded on this span.intThe total number ofEventDataevents that were recorded on this span.intThe total number ofLinkDatalinks that were recorded on this span.booleanhasEnded()Returns whether this Span has already been ended.inthashCode()toString()Methods inherited from interface SpanData
getParentSpanId, getSpanId, getTraceId
-
Field Details
-
delegate
-
-
Constructor Details
-
DelegatingSpanData
-
-
Method Details
-
getSpanContext
Description copied from interface:SpanDataReturns theSpanContextof the Span.- Specified by:
getSpanContextin interfaceSpanData
-
getParentSpanContext
Description copied from interface:SpanDataReturns the parentSpanContext. If the span is a root span, theSpanContextreturned will be invalid.- Specified by:
getParentSpanContextin interfaceSpanData
-
getResource
Description copied from interface:SpanDataReturns the resource of thisSpan.- Specified by:
getResourcein interfaceSpanData- Returns:
- the resource of this
Span.
-
getInstrumentationLibraryInfo
Deprecated.Description copied from interface:SpanDataReturns the instrumentation library specified when creating the tracer which produced thisSpan.- Specified by:
getInstrumentationLibraryInfoin interfaceSpanData- Returns:
- an instance of
InstrumentationLibraryInfo
-
getInstrumentationScopeInfo
Description copied from interface:SpanDataReturns the instrumentation scope specified when creating the tracer which produced thisSpan.- Specified by:
getInstrumentationScopeInfoin interfaceSpanData- Returns:
- an instance of
InstrumentationScopeInfo
-
getName
-
getKind
-
getStartEpochNanos
public long getStartEpochNanos()Description copied from interface:SpanDataReturns the start epoch timestamp in nanos of thisSpan.- Specified by:
getStartEpochNanosin interfaceSpanData- Returns:
- the start epoch timestamp in nanos of this
Span.
-
getAttributes
Description copied from interface:SpanDataReturns the attributes recorded for thisSpan.- Specified by:
getAttributesin interfaceSpanData- Returns:
- the attributes recorded for this
Span.
-
getEvents
-
getLinks
-
getStatus
Description copied from interface:SpanDataReturns theStatus. -
getEndEpochNanos
public long getEndEpochNanos()Description copied from interface:SpanDataReturns the end epoch timestamp in nanos of thisSpan.- Specified by:
getEndEpochNanosin interfaceSpanData- Returns:
- the end epoch timestamp in nanos of this
Span.
-
hasEnded
-
getTotalRecordedEvents
public int getTotalRecordedEvents()Description copied from interface:SpanDataThe total number ofEventDataevents 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:
getTotalRecordedEventsin interfaceSpanData- Returns:
- The total number of events recorded on this span.
-
getTotalRecordedLinks
public int getTotalRecordedLinks()Description copied from interface:SpanDataThe total number ofLinkDatalinks 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:
getTotalRecordedLinksin interfaceSpanData- Returns:
- The total number of links recorded on this span.
-
getTotalAttributeCount
public int getTotalAttributeCount()Description copied from interface:SpanDataThe 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:
getTotalAttributeCountin interfaceSpanData- Returns:
- The total number of attributes on this span.
-
equals
-
hashCode
-
toString
-