Module brave

Class PendingSpans


  • public final class PendingSpans
    extends java.lang.ref.ReferenceQueue<TraceContext>
    Similar to Finagle's deadline span map, except this is GC pressure as opposed to timeout driven. This means there's no bookkeeping thread required in order to flush orphaned spans.

    Spans are weakly referenced by their owning context. When the keys are collected, they are transferred to a queue, waiting to be reported. A call to modify any span will implicitly flush orphans to Zipkin. Spans in this state will have a "brave.flush" annotation added to them.

    The internal implementation is derived from WeakConcurrentMap by Rafael Winterhalter. See https://github.com/raphw/weak-lock-free/blob/master/src/main/java/com/blogspot/mydailyjava/weaklockfree/WeakConcurrentMap.java

    • Constructor Detail

      • PendingSpans

        public PendingSpans​(Clock clock,
                            FinishedSpanHandler zipkinHandler,
                            java.util.concurrent.atomic.AtomicBoolean noop)
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object