Package io.servicetalk.opentracing.http
Class TracingHttpRequesterFilter
- java.lang.Object
-
- io.servicetalk.opentracing.http.TracingHttpRequesterFilter
-
- All Implemented Interfaces:
HttpExecutionStrategyInfluencer
,StreamingHttpClientFilterFactory
,StreamingHttpConnectionFilterFactory
public class TracingHttpRequesterFilter extends java.lang.Object implements StreamingHttpClientFilterFactory, StreamingHttpConnectionFilterFactory, HttpExecutionStrategyInfluencer
An HTTP filter that supports open tracing.Append this filter before others that are expected to to see
Scope
for this request/response. Filters appended after this filter that use operators with the after* prefix onresponse meta data
or theStreamingHttpResponse.transformMessageBody(UnaryOperator)
response message body} (e.g.Publisher.afterFinally(Runnable)
) will execute after this filter invokesScope.close()
and therefore will not see theSpan
for the current request/response.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
componentName
protected InMemoryTraceStateFormat<HttpHeaders>
formatter
protected io.opentracing.Tracer
tracer
-
Constructor Summary
Constructors Constructor Description TracingHttpRequesterFilter(io.opentracing.Tracer tracer, java.lang.String componentName)
Create a new instance.TracingHttpRequesterFilter(io.opentracing.Tracer tracer, java.lang.String componentName, boolean validateTraceKeyFormat)
Create a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StreamingHttpClientFilter
create(FilterableStreamingHttpClient client)
Creates aStreamingHttpClientFilter
using the providedStreamingHttpClientFilter
.StreamingHttpConnectionFilter
create(FilterableStreamingHttpConnection connection)
Create aStreamingHttpConnectionFilter
using the providedFilterableStreamingHttpConnection
.HttpExecutionStrategy
influenceStrategy(HttpExecutionStrategy strategy)
Optionally modify the passedHttpExecutionStrategy
to a newHttpExecutionStrategy
that suits thisHttpExecutionStrategyInfluencer
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.servicetalk.http.api.StreamingHttpClientFilterFactory
append, asMultiAddressClientFilter
-
Methods inherited from interface io.servicetalk.http.api.StreamingHttpConnectionFilterFactory
append
-
-
-
-
Field Detail
-
tracer
protected final io.opentracing.Tracer tracer
-
componentName
protected final java.lang.String componentName
-
formatter
protected final InMemoryTraceStateFormat<HttpHeaders> formatter
-
-
Constructor Detail
-
TracingHttpRequesterFilter
public TracingHttpRequesterFilter(io.opentracing.Tracer tracer, java.lang.String componentName)
Create a new instance.- Parameters:
tracer
- TheTracer
.componentName
- The component name used during building new spans.
-
TracingHttpRequesterFilter
public TracingHttpRequesterFilter(io.opentracing.Tracer tracer, java.lang.String componentName, boolean validateTraceKeyFormat)
Create a new instance.- Parameters:
tracer
- TheTracer
.componentName
- The component name used during building new spans.validateTraceKeyFormat
-true
to validate the contents of the trace ids.
-
-
Method Detail
-
create
public final StreamingHttpClientFilter create(FilterableStreamingHttpClient client)
Description copied from interface:StreamingHttpClientFilterFactory
Creates aStreamingHttpClientFilter
using the providedStreamingHttpClientFilter
.- Specified by:
create
in interfaceStreamingHttpClientFilterFactory
- Parameters:
client
-FilterableStreamingHttpClient
to filter- Returns:
StreamingHttpClientFilter
using the providedStreamingHttpClientFilter
.
-
create
public final StreamingHttpConnectionFilter create(FilterableStreamingHttpConnection connection)
Description copied from interface:StreamingHttpConnectionFilterFactory
Create aStreamingHttpConnectionFilter
using the providedFilterableStreamingHttpConnection
.- Specified by:
create
in interfaceStreamingHttpConnectionFilterFactory
- Parameters:
connection
-FilterableStreamingHttpConnection
to filter- Returns:
StreamingHttpConnectionFilter
using the providedFilterableStreamingHttpConnection
.
-
influenceStrategy
public HttpExecutionStrategy influenceStrategy(HttpExecutionStrategy strategy)
Description copied from interface:HttpExecutionStrategyInfluencer
Optionally modify the passedHttpExecutionStrategy
to a newHttpExecutionStrategy
that suits thisHttpExecutionStrategyInfluencer
.- Specified by:
influenceStrategy
in interfaceHttpExecutionStrategyInfluencer
- Parameters:
strategy
-HttpExecutionStrategy
to influence.- Returns:
HttpExecutionStrategy
that suits thisHttpExecutionStrategyInfluencer
-
-