Package brave.messaging
Class MessagingTracing
java.lang.Object
brave.messaging.MessagingTracing
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class MessagingTracing extends Object implements Closeable
Instances built via
create(Tracing)
or newBuilder(Tracing)
are registered
automatically such that statically configured instrumentation like HTTP producers can use current()
.- Since:
- 5.9
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MessagingTracing.Builder
-
Method Summary
Modifier and Type Method Description void
close()
SamplerFunction<MessagingRequest>
consumerSampler()
Returns an overriding sampling decision for a new trace.static MessagingTracing
create(Tracing tracing)
static MessagingTracing
current()
Returns the most recently created tracing component iff it hasn't been closed.static MessagingTracing.Builder
newBuilder(Tracing tracing)
SamplerFunction<MessagingRequest>
producerSampler()
Returns an overriding sampling decision for a new trace.MessagingTracing.Builder
toBuilder()
Tracing
tracing()
-
Method Details
-
create
- Since:
- 5.9
-
newBuilder
- Since:
- 5.9
-
tracing
- Since:
- 5.9
-
producerSampler
Returns an overriding sampling decision for a new trace. Defaults to ignore the request and use thetrace ID instead
.This decision happens when a trace was not yet started in process. For example, you may be making an messaging request as a part of booting your application. You may want to opt-out of tracing producer requests that did not originate from a consumer request.
- Since:
- 5.9
- See Also:
SamplerFunctions
,MessagingRuleSampler
-
consumerSampler
Returns an overriding sampling decision for a new trace. Defaults to ignore the request and use thetrace ID instead
.This decision happens when trace IDs were not in headers, or a sampling decision has not yet been made. For example, if a trace is already in progress, this function is not called. You can implement this to skip channels that you never want to trace.
- Since:
- 5.9
- See Also:
SamplerFunctions
,MessagingRuleSampler
-
toBuilder
-
current
Returns the most recently created tracing component iff it hasn't been closed. null otherwise.This object should not be cached.
- Since:
- 5.9
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Since:
- 5.9
-