Class OpenTelemetryHttpServiceFilter
java.lang.Object
io.servicetalk.opentelemetry.http.OpenTelemetryHttpServiceFilter
- All Implemented Interfaces:
HttpExecutionStrategyInfluencer,StreamingHttpServiceFilterFactory,ExecutionStrategyInfluencer<HttpExecutionStrategy>
A
StreamingHttpService that supports
open telemetry.
The filter gets a Tracer with "io.servicetalk" instrumentation scope name.
This filter propagates the OpenTelemetry Context (thus Span) so the ordering of filters is crucial.
- Append this filter before others that are expected to see the
Spanfor this request/response. - If you want to see the correct
Spaninformation for auto-drained requests (when a streaming request body was not consumed by the service), add theHttpRequestAutoDrainingServiceFilterimmediately after. - To ensure tracing sees the same result status codes as the calling client, add the
HttpExceptionMapperServiceFilterafter this filter. - If you intend to use a
HttpLifecycleObserver, add it using the HttpLifecycleObserverServiceFilter after the tracing filter to ensure the correctSpaninformation is present.
HttpServerBuilder.appendNonOffloadingServiceFilter(StreamingHttpServiceFilterFactory)
method for adding these filters as non-offloading filters are always added before offloading filters.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder for constructingOpenTelemetryHttpServiceFilterfilter instances. -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.OpenTelemetryHttpServiceFilter(OpenTelemetryOptions openTelemetryOptions) Deprecated.use theOpenTelemetryHttpServiceFilter.Builderto construct filter instances. -
Method Summary
Modifier and TypeMethodDescriptioncreate(StreamingHttpService service) Create aStreamingHttpServiceFilterusing the providedStreamingHttpService.final HttpExecutionStrategyReturn 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, requiredOffloads
-
Constructor Details
-
OpenTelemetryHttpServiceFilter
Deprecated.use theOpenTelemetryHttpServiceFilter.Builderto construct filter instances.Create a new instance using theOpenTelemetryfromGlobalOpenTelemetry.get()with defaultOpenTelemetryOptions. -
OpenTelemetryHttpServiceFilter
Deprecated.use theOpenTelemetryHttpServiceFilter.Builderto construct filter instances.Create a new instance.- Parameters:
openTelemetryOptions- extra options to create the opentelemetry filter. Client-specific options (componentName, openTelemetry, ignoreSpanSuppression) will be ignored for server filters.
-
-
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.
-
OpenTelemetryHttpServiceFilter.Builderto construct filter instances.