Package brave.rpc
Class RpcTracing
java.lang.Object
brave.rpc.RpcTracing
- All Implemented Interfaces:
Closeable,AutoCloseable
public class RpcTracing extends Object implements Closeable
Instances built via
create(Tracing) or newBuilder(Tracing) are registered
automatically such that statically configured instrumentation like HTTP clients can use current().- Since:
- 5.8
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRpcTracing.Builder -
Method Summary
Modifier and Type Method Description SamplerFunction<RpcRequest>clientSampler()Returns an overriding sampling decision for a new trace.voidclose()static RpcTracingcreate(Tracing tracing)static RpcTracingcurrent()Returns the most recently created tracing component iff it hasn't been closed.static RpcTracing.BuildernewBuilder(Tracing tracing)SamplerFunction<RpcRequest>serverSampler()Returns an overriding sampling decision for a new trace.RpcTracing.BuildertoBuilder()Tracingtracing()
-
Method Details
-
create
- Since:
- 5.8
-
newBuilder
- Since:
- 5.8
-
tracing
- Since:
- 5.8
-
clientSampler
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 rpc request as a part of booting your application. You may want to opt-out of tracing client requests that did not originate from a server request.
- Since:
- 5.8
- See Also:
SamplerFunctions,RpcRuleSampler
-
serverSampler
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 paths that you never want to trace.
- Since:
- 5.8
- See Also:
SamplerFunctions,RpcRuleSampler
-
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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Since:
- 5.9
-