-
- All Implemented Interfaces:
-
com.bugsnag.android.performance.HasAttributes,com.bugsnag.android.performance.Span,com.bugsnag.android.performance.SpanContext,java.io.Closeable,java.lang.AutoCloseable
@RestrictTo(value = {RestrictTo.Scope.LIBRARY_GROUP}) public final class SpanImpl implements Span, HasAttributes
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classSpanImpl.Companionpublic interfaceSpanImpl.ConditionRepresents a possible "block" to a Span being ended naturally. Any conditions that are active when SpanImpl.end is called will prevent the span from being batched and processed, until all of the Conditions are either cancelled, timed-out, or closed. A condition is considered "inactive" until it is upgradeed, at which point the Condition.close will cause the span end-time to be adjusted.
These are a way to deal with cases where a span "might have child spans at some point in the future, where the parent span end time should match the last of these children".
-
Field Summary
Fields Modifier and Type Field Description private final Attributesattributesprivate Stringnameprivate final UUIDtraceIdprivate final LongspanIdprivate final LongparentSpanId
-
Method Summary
Modifier and Type Method Description final AttributesgetAttributes()StringgetName()The name of this SpanUnitsetName(String name)UUIDgetTraceId()LonggetSpanId()final LonggetParentSpanId()Unitend(Long endTime)End this with a specified timestamp relative to SystemClock.elapsedRealtimeNanos. Unitend()End this span now. final Unitdiscard()Deliberately discard this SpanImpl.final SpanImpl.Conditionblock(Long timeoutMs)final BooleanisSampled()BooleanisEnded()Returns trueif this span has been closed / ended.final BooleanisOpen()final BooleanisBlocked()StringtoString()UnitsetAttribute(String name, String value)Set or clear a string attribute. UnitsetAttribute(String name, Long value)Set a long integer attribute. UnitsetAttribute(String name, Integer value)Set an integer attribute. UnitsetAttribute(String name, Double value)Set a floating point / double attribute. UnitsetAttribute(String name, Boolean value)Set a boolean attribute. UnitsetAttribute(String name, Array<String> value)Set or clear a string collection attribute. UnitsetAttribute(String name, Collection<Object> value)Set a collection of primitive values as an attribute. UnitsetAttribute(String name, IntArray value)Set an array of integer values. UnitsetAttribute(String name, LongArray value)Set an array of long values. UnitsetAttribute(String name, DoubleArray value)Set an array of double values. Booleanequals(Object other)IntegerhashCode()-
-
Method Detail
-
getAttributes
final Attributes getAttributes()
-
getTraceId
UUID getTraceId()
-
getParentSpanId
final Long getParentSpanId()
-
end
Unit end(Long endTime)
End this with a specified timestamp relative to SystemClock.elapsedRealtimeNanos. If this span has already been closed this will have no effect.
-
discard
final Unit discard()
Deliberately discard this
SpanImpl. This will mark the span as ended, but not record a valid end time. It will also (if required) detach the Span from the SpanContext
-
block
final SpanImpl.Condition block(Long timeoutMs)
-
isEnded
Boolean isEnded()
Returns
trueif this span has been closed / ended. If this returnstruethe span cannot be modified further.
-
setAttribute
Unit setAttribute(String name, String value)
Set or clear a string attribute. Passing
nullwill remove the attribute.- Parameters:
name- the attribute namevalue- the value to set the attribute to
-
setAttribute
Unit setAttribute(String name, Long value)
Set a long integer attribute.
- Parameters:
name- the attribute namevalue- the value to set the attribute to
-
setAttribute
Unit setAttribute(String name, Integer value)
Set an integer attribute.
- Parameters:
name- the attribute namevalue- the value to set the attribute to
-
setAttribute
Unit setAttribute(String name, Double value)
Set a floating point / double attribute.
- Parameters:
name- the attribute namevalue- the value to set the attribute to
-
setAttribute
Unit setAttribute(String name, Boolean value)
Set a boolean attribute.
- Parameters:
name- the attribute namevalue- the value to set the attribute to
-
setAttribute
Unit setAttribute(String name, Array<String> value)
Set or clear a string collection attribute. Passing
nullwill remove the attribute.- Parameters:
name- the attribute namevalue- the value to set the attribute to
-
setAttribute
Unit setAttribute(String name, Collection<Object> value)
Set a collection of primitive values as an attribute. Every element should be of the same type, and only String, Integer, Long, Double and Boolean are supported. If the collection contains mixed values, null, or any other type: the behavior is undefined.
-
setAttribute
Unit setAttribute(String name, IntArray value)
Set an array of integer values.
- Parameters:
name- the attribute namevalue- the value to set the attribute to
-
setAttribute
Unit setAttribute(String name, LongArray value)
Set an array of long values.
- Parameters:
name- the attribute namevalue- the value to set the attribute to
-
setAttribute
Unit setAttribute(String name, DoubleArray value)
Set an array of double values.
- Parameters:
name- the attribute namevalue- the value to set the attribute to
-
-
-
-