- java.lang.Object
-
- brave.handler.FinishedSpanHandler
-
- brave.internal.handler.ZipkinFinishedSpanHandler
-
public final class ZipkinFinishedSpanHandler extends FinishedSpanHandler
logs exceptions instead of raising an error, as the supplied reporter could have bugs
-
-
Field Summary
-
Fields inherited from class brave.handler.FinishedSpanHandler
NOOP
-
-
Constructor Summary
Constructors Constructor Description ZipkinFinishedSpanHandler(zipkin2.reporter.Reporter<zipkin2.Span> spanReporter, ErrorParser errorParser, java.lang.String serviceName, java.lang.String ip, int port)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanhandle(TraceContext context, MutableSpan span)This is invoked after a span is finished, allowing data to be modified or reported out of process.java.lang.StringtoString()-
Methods inherited from class brave.handler.FinishedSpanHandler
alwaysSampleLocal
-
-
-
-
Constructor Detail
-
ZipkinFinishedSpanHandler
public ZipkinFinishedSpanHandler(zipkin2.reporter.Reporter<zipkin2.Span> spanReporter, ErrorParser errorParser, java.lang.String serviceName, java.lang.String ip, int port)
-
-
Method Detail
-
handle
public boolean handle(TraceContext context, MutableSpan span)
Description copied from class:FinishedSpanHandlerThis is invoked after a span is finished, allowing data to be modified or reported out of process. A return value of false means the span should be dropped completely from the stream.Changes to the input span are visible by later finished span handlers. One reason to change the input is to align tags, so that correlation occurs. For example, some may clean the tag "http.path" knowing downstream handlers such as zipkin reporting have the same value.
Returning false is the same effect as if
Span.abandon()was called. Implementations should be careful when returning false as it can lead to broken traces. Acceptable use cases are when the span is a leaf, for example a client call to an uninstrumented database, or a server call which is known to terminate in-process (for example, health-checks). Prefer an instrumentation policy approach to this mechanism as it results in less overhead.Implementations should not hold a reference to it after this method returns. This is to allow object recycling.
- Specified by:
handlein classFinishedSpanHandler- Parameters:
context- the trace context which isSamplingFlags.sampled()orSamplingFlags.sampledLocal(). This includes identifiers and potentiallyextra propagated datasuch as extended sampling configuration.span- a mutable object including all data recorded with span apis. Modifications are visible to later handlers, including Zipkin.- Returns:
- true retains the span, and should almost always be used. false drops the span, making it invisible to later handlers such as Zipkin.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-