Class PropagatedSpan
- All Implemented Interfaces:
Span, ImplicitContextKeyed
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final PropagatedSpanprivate final SpanContext -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds an event to theSpan.Adds an event to theSpanwith the giventimestamp, as nanos since epoch.addEvent(String name, Attributes attributes) Adds an event to theSpanwith the givenAttributes.addEvent(String name, Attributes attributes, long timestamp, TimeUnit unit) (package private) static Spancreate(SpanContext spanContext) voidend()Marks the end ofSpanexecution.voidMarks the end ofSpanexecution with the specified timestamp.Returns theSpanContextassociated with thisSpan.booleanReturnstrueif thisSpanrecords tracing events (e.g.recordException(Throwable exception) recordException(Throwable exception, Attributes additionalAttributes) setAllAttributes(Attributes attributes) Sets attributes to theSpan.<T> SpansetAttribute(AttributeKey<T> key, T value) Sets an attribute to theSpan.setAttribute(String key, boolean value) Sets an attribute to theSpan.setAttribute(String key, double value) Sets an attribute to theSpan.setAttribute(String key, long value) Sets an attribute to theSpan.setAttribute(String key, String value) Sets an attribute to theSpan.setStatus(StatusCode statusCode) Sets the status to theSpan.setStatus(StatusCode statusCode, String description) Sets the status to theSpan.toString()updateName(String name) Updates theSpanname.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ImplicitContextKeyed
makeCurrentMethods inherited from interface Span
addEvent, addEvent, addLink, addLink, end, setAttribute, storeInContext
-
Field Details
-
INVALID
-
spanContext
-
-
Constructor Details
-
PropagatedSpan
-
-
Method Details
-
create
-
setAttribute
Description copied from interface:SpanSets an attribute to theSpan. If theSpanpreviously contained a mapping for the key, the old value is replaced by the specified value.Empty String "" and null are valid attribute
value, but not valid keys.Note: It is strongly recommended to use
Span.setAttribute(AttributeKey, Object), and pre-allocate your keys, if possible.- Specified by:
setAttributein interfaceSpan- Parameters:
key- the key for this attribute.value- the value for this attribute.- Returns:
- this.
-
setAttribute
Description copied from interface:SpanSets an attribute to theSpan. If theSpanpreviously contained a mapping for the key, the old value is replaced by the specified value.Note: It is strongly recommended to use
Span.setAttribute(AttributeKey, Object), and pre-allocate your keys, if possible.- Specified by:
setAttributein interfaceSpan- Parameters:
key- the key for this attribute.value- the value for this attribute.- Returns:
- this.
-
setAttribute
Description copied from interface:SpanSets an attribute to theSpan. If theSpanpreviously contained a mapping for the key, the old value is replaced by the specified value.Note: It is strongly recommended to use
Span.setAttribute(AttributeKey, Object), and pre-allocate your keys, if possible.- Specified by:
setAttributein interfaceSpan- Parameters:
key- the key for this attribute.value- the value for this attribute.- Returns:
- this.
-
setAttribute
Description copied from interface:SpanSets an attribute to theSpan. If theSpanpreviously contained a mapping for the key, the old value is replaced by the specified value.Note: It is strongly recommended to use
Span.setAttribute(AttributeKey, Object), and pre-allocate your keys, if possible.- Specified by:
setAttributein interfaceSpan- Parameters:
key- the key for this attribute.value- the value for this attribute.- Returns:
- this.
-
setAttribute
Description copied from interface:SpanSets an attribute to theSpan. If theSpanpreviously contained a mapping for the key, the old value is replaced by the specified value.Note: the behavior of null values is undefined, and hence strongly discouraged.
- Specified by:
setAttributein interfaceSpan- Parameters:
key- the key for this attribute.value- the value for this attribute.- Returns:
- this.
-
setAllAttributes
Description copied from interface:SpanSets attributes to theSpan. If theSpanpreviously contained a mapping for any of the keys, the old values are replaced by the specified values.- Specified by:
setAllAttributesin interfaceSpan- Parameters:
attributes- the attributes- Returns:
- this.
-
addEvent
-
addEvent
Description copied from interface:SpanAdds an event to theSpanwith the giventimestamp, as nanos since epoch. Note, thistimestampis not the same asSystem.nanoTime()but may be computed using it, for example, by taking a difference of readings fromSystem.nanoTime()and adding to the span start time.When possible, it is preferred to use
Span.addEvent(String)at the time the event occurred. -
addEvent
Description copied from interface:SpanAdds an event to theSpanwith the givenAttributes. The timestamp of the event will be the current time. -
addEvent
Description copied from interface:SpanAdds an event to theSpanwith the givenAttributesandtimestamp. Note, thistimestampis not the same asSystem.nanoTime()but may be computed using it, for example, by taking a difference of readings fromSystem.nanoTime()and adding to the span start time.When possible, it is preferred to use
Span.addEvent(String)at the time the event occurred.- Specified by:
addEventin interfaceSpan- Parameters:
name- the name of the event.attributes- the attributes that will be added; these are associated with this event, not theSpanas forsetAttribute().timestamp- the explicit event timestamp since epoch.unit- the unit of the timestamp- Returns:
- this.
-
setStatus
Description copied from interface:SpanSets the status to theSpan.If used, this will override the default
Spanstatus. Default status code isStatusCode.UNSET.Only the value of the last call will be recorded, and implementations are free to ignore previous calls.
- Specified by:
setStatusin interfaceSpan- Parameters:
statusCode- theStatusCodeto set.- Returns:
- this.
-
setStatus
Description copied from interface:SpanSets the status to theSpan.If used, this will override the default
Spanstatus. Default status code isStatusCode.UNSET.Only the value of the last call will be recorded, and implementations are free to ignore previous calls.
- Specified by:
setStatusin interfaceSpan- Parameters:
statusCode- theStatusCodeto set.description- the description of theStatus.- Returns:
- this.
-
recordException
Description copied from interface:SpanRecords information about theThrowableto theSpan.Note that the EXCEPTION_ESCAPED value from the Semantic Conventions cannot be determined by this function. You should record this attribute manually using
Span.recordException(Throwable, Attributes)if you know that an exception is escaping.- Specified by:
recordExceptionin interfaceSpan- Parameters:
exception- theThrowableto record.- Returns:
- this.
-
recordException
Description copied from interface:Span- Specified by:
recordExceptionin interfaceSpan- Parameters:
exception- theThrowableto record.additionalAttributes- the additionalAttributesto record.- Returns:
- this.
-
updateName
Description copied from interface:SpanUpdates theSpanname.If used, this will override the name provided via
Span.Builder.Upon this update, any sampling behavior based on
Spanname will depend on the implementation.- Specified by:
updateNamein interfaceSpan- Parameters:
name- theSpanname.- Returns:
- this.
-
end
-
end
Description copied from interface:SpanMarks the end ofSpanexecution with the specified timestamp.Only the timing of the first end call for a given
Spanwill be recorded, and implementations are free to ignore all further calls.Use this method for specifying explicit end options, such as end
Timestamp. When no explicit values are required, useSpan.end(). -
getSpanContext
Description copied from interface:SpanReturns theSpanContextassociated with thisSpan.- Specified by:
getSpanContextin interfaceSpan- Returns:
- the
SpanContextassociated with thisSpan.
-
isRecording
public boolean isRecording()Description copied from interface:SpanReturnstrueif thisSpanrecords tracing events (e.g.Span.addEvent(String),Span.setAttribute(String, long)).- Specified by:
isRecordingin interfaceSpan- Returns:
trueif thisSpanrecords tracing events.
-
toString
-