Class TracingHttpServiceFilter
- All Implemented Interfaces:
HttpExecutionStrategyInfluencer,StreamingHttpServiceFilterFactory,ExecutionStrategyInfluencer<HttpExecutionStrategy>
StreamingHttpService 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 on
response meta data or the response message body
(e.g. Publisher.afterFinally(Runnable)) will execute after this filter invokes Scope.close() and
therefore will not see the Span for the current request/response.
-
Constructor Summary
ConstructorsConstructorDescriptionTracingHttpServiceFilter(io.opentracing.Tracer tracer, io.opentracing.propagation.Format<io.opentracing.propagation.TextMap> format, String componentName) Create a new instance.TracingHttpServiceFilter(io.opentracing.Tracer tracer, String componentName) Create a new instance.TracingHttpServiceFilter(io.opentracing.Tracer tracer, String componentName, boolean validateTraceKeyFormat) Create a new instance.TracingHttpServiceFilter(io.opentracing.Tracer tracer, String componentName, io.opentracing.propagation.Format<HttpHeaders> format) Create a new instance. -
Method Summary
Modifier and TypeMethodDescriptioncreate(StreamingHttpService service) Create aStreamingHttpServiceFilterusing the providedStreamingHttpService.protected StringgetOperationName(String componentName, HttpRequestMetaData metaData) Get the operation name to build the span with.protected booleaninjectSpanContextIntoResponse(io.opentracing.SpanContext parentSpanContext) Determine if the current span context should be injected into the response.Return anExecutionStrategythat describes the offloads required by the influencer.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.servicetalk.http.api.HttpExecutionStrategyInfluencer
influenceStrategy
-
Constructor Details
-
TracingHttpServiceFilter
Create a new instance.- Parameters:
tracer- TheTracer.componentName- The component name used during building new spans.
-
TracingHttpServiceFilter
public TracingHttpServiceFilter(io.opentracing.Tracer tracer, String componentName, boolean validateTraceKeyFormat) Create a new instance.- Parameters:
tracer- TheTracer.componentName- The component name used during building new spans.validateTraceKeyFormat-trueto validate the contents of the trace ids.
-
TracingHttpServiceFilter
public TracingHttpServiceFilter(io.opentracing.Tracer tracer, String componentName, io.opentracing.propagation.Format<HttpHeaders> format) Create a new instance.- Parameters:
tracer- TheTracer.componentName- The component name used during building new spans.format- theFormatto use to inject/extract trace info to/fromHttpHeaders.
-
TracingHttpServiceFilter
public TracingHttpServiceFilter(io.opentracing.Tracer tracer, io.opentracing.propagation.Format<io.opentracing.propagation.TextMap> format, String componentName) Create a new instance.- Parameters:
tracer- TheTracer.format- theFormatto use to inject/extract trace info to/fromTextMap.componentName- The component name used during building new spans.
-
-
Method Details
-
create
Description copied from interface:StreamingHttpServiceFilterFactoryCreate aStreamingHttpServiceFilterusing the providedStreamingHttpService.- Specified by:
createin interfaceStreamingHttpServiceFilterFactory- Parameters:
service-StreamingHttpServiceto filter- Returns:
StreamingHttpServiceFilterusing the providedStreamingHttpService.
-
requiredOffloads
Description copied from interface:HttpExecutionStrategyInfluencerReturn anExecutionStrategythat describes the offloads required by the influencer.The provided default implementation requests offloading of all operations. Implementations that require no offloading should be careful to return
HttpExecutionStrategies.offloadNone()rather thanHttpExecutionStrategies.offloadNever(). Implementations should avoid returningHttpExecutionStrategies.defaultStrategy(), instead returning the strategy they require orHttpExecutionStrategies.offloadAll()if offloading for all paths is required (safe default).- Specified by:
requiredOffloadsin interfaceExecutionStrategyInfluencer<HttpExecutionStrategy>- Specified by:
requiredOffloadsin interfaceHttpExecutionStrategyInfluencer- Returns:
- the
ExecutionStrategyrequired by the influencer.
-
getOperationName
Get the operation name to build the span with.- Parameters:
componentName- The component name.metaData- TheHttpRequestMetaData.- Returns:
- the operation name to build the span with.
-
injectSpanContextIntoResponse
protected boolean injectSpanContextIntoResponse(@Nullable io.opentracing.SpanContext parentSpanContext) Determine if the current span context should be injected into the response.- Parameters:
parentSpanContext- The parent span extracted from the request.- Returns:
trueif the current span context should be injected into the response.
-