Class HttpTracing
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class HttpTracing extends Object implements Closeable
create(Tracing)
or newBuilder(Tracing)
are registered
automatically such that statically configured instrumentation like HTTP clients can use current()
.-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
HttpTracing.Builder
-
Method Summary
Modifier and Type Method Description HttpTracing
clientOf(String serverName)
Scopes this component for a client of the indicated server.HttpClientParser
clientParser()
SamplerFunction<HttpRequest>
clientRequestSampler()
Returns an overriding sampling decision for a new trace.HttpSampler
clientSampler()
Deprecated.Since 5.8, useclientRequestSampler()
void
close()
static HttpTracing
create(Tracing tracing)
static HttpTracing
current()
Returns the most recently created tracing component iff it hasn't been closed.static HttpTracing.Builder
newBuilder(Tracing tracing)
String
serverName()
Used by http clients to indicate the name of the destination service.HttpServerParser
serverParser()
SamplerFunction<HttpRequest>
serverRequestSampler()
Returns an overriding sampling decision for a new trace.HttpSampler
serverSampler()
Deprecated.Since 5.8, useserverRequestSampler()
HttpTracing.Builder
toBuilder()
Tracing
tracing()
-
Method Details
-
create
-
newBuilder
-
tracing
-
clientParser
-
serverName
Used by http clients to indicate the name of the destination service. Defaults to "", which will not show in the zipkin UI or end up in the dependency graph.When present, a link from
Tracing.Builder.localServiceName(String)
to this name will increment for each traced client call.As this is endpoint-specific, it is typical to create a scoped instance of HttpTracing to assign this value. For example:
github = TracingHttpClientBuilder.create(httpTracing.serverName("github"));
- See Also:
HttpClientHandler
,Span.remoteServiceName(String)
-
clientOf
Scopes this component for a client of the indicated server.- See Also:
serverName()
-
serverParser
-
clientSampler
Deprecated.Since 5.8, useclientRequestSampler()
-
clientRequestSampler
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 http 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
-
serverSampler
Deprecated.Since 5.8, useserverRequestSampler()
-
serverRequestSampler
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
-
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
-