Class OpenTelemetryHttpRequestFilter
- All Implemented Interfaces:
HttpExecutionStrategyInfluencer
,StreamingHttpClientFilterFactory
,StreamingHttpConnectionFilterFactory
,ExecutionStrategyInfluencer<HttpExecutionStrategy>
The filter gets a Tracer
with "io.servicetalk" instrumentation scope name.
Append this filter before others that are expected 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
StreamingHttpResponse.transformMessageBody(UnaryOperator)
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
ConstructorDescriptionCreate a new instance, searching for any instance of an opentelemetry available, using the hostname as the component name.OpenTelemetryHttpRequestFilter
(io.opentelemetry.api.OpenTelemetry openTelemetry, String componentName) Deprecated.OpenTelemetryHttpRequestFilter
(String componentName) Create a new instance, searching for any instance of an opentelemetry available.OpenTelemetryHttpRequestFilter
(String componentName, OpenTelemetryOptions opentelemetryOptions) Create a new instance, searching for any instance of an opentelemetry available. -
Method Summary
Modifier and TypeMethodDescriptioncreate
(FilterableStreamingHttpClient client) Creates aStreamingHttpClientFilter
using the providedStreamingHttpClientFilter
.create
(FilterableStreamingHttpConnection connection) Create aStreamingHttpConnectionFilter
using the providedFilterableStreamingHttpConnection
.final HttpExecutionStrategy
Return anExecutionStrategy
that describes the offloads required by the influencer.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.HttpExecutionStrategyInfluencer
influenceStrategy, requiredOffloads
-
Constructor Details
-
OpenTelemetryHttpRequestFilter
@Deprecated public OpenTelemetryHttpRequestFilter(io.opentelemetry.api.OpenTelemetry openTelemetry, String componentName) Deprecated.this method is internal, no user should be setting theOpenTelemetry
as it is obtained by usingGlobalOpenTelemetry.get()
and there should be no other implementations but the one available in the classpath, this constructor will be removed in the future releases. UseOpenTelemetryHttpRequestFilter(String, OpenTelemetryOptions)
orOpenTelemetryHttpRequestFilter()
instead.Create a new instance.- Parameters:
openTelemetry
- theOpenTelemetry
.componentName
- The component name used during building new spans.
-
OpenTelemetryHttpRequestFilter
Create a new instance, searching for any instance of an opentelemetry available.- Parameters:
componentName
- The component name used during building new spans.
-
OpenTelemetryHttpRequestFilter
public OpenTelemetryHttpRequestFilter(String componentName, OpenTelemetryOptions opentelemetryOptions) Create a new instance, searching for any instance of an opentelemetry available.- Parameters:
componentName
- The component name used during building new spans.opentelemetryOptions
- extra options to create the opentelemetry filter
-
OpenTelemetryHttpRequestFilter
public OpenTelemetryHttpRequestFilter()Create a new instance, searching for any instance of an opentelemetry available, using the hostname as the component name.
-
-
Method Details
-
create
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
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
.
-
requiredOffloads
Description copied from interface:HttpExecutionStrategyInfluencer
Return anExecutionStrategy
that 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:
requiredOffloads
in interfaceExecutionStrategyInfluencer<HttpExecutionStrategy>
- Specified by:
requiredOffloads
in interfaceHttpExecutionStrategyInfluencer
- Returns:
- the
ExecutionStrategy
required by the influencer.
-
OpenTelemetry
as it is obtained by usingGlobalOpenTelemetry.get()
and there should be no other implementations but the one available in the classpath, this constructor will be removed in the future releases.