Package brave.handler

Class MutableSpan

java.lang.Object
brave.handler.MutableSpan
All Implemented Interfaces:
Cloneable

public final class MutableSpan
extends Object
implements Cloneable
This represents a span except for its TraceContext. It is mutable, for late adjustments.

Notes

Between SpanHandler.begin(TraceContext, MutableSpan, TraceContext) and SpanHandler.end(TraceContext, MutableSpan, SpanHandler.Cause), Brave owns this reference, synchronizing where necessary as updates come from different application threads.

Upon end, Brave no longer makes updates. It invokes each SpanHandler, one-by-one on the same thread. This means subsequent handlers do not have to synchronize to view updates from a prior one. However, it does imply they must make mutations on the same thread.

In other words, this type is not thread safe. If you need to mutate this span in a different thread, use the copy constructor.

Since:
5.4