Class OpenTelemetryInterceptorFactory
java.lang.Object
dev.restate.sdk.interceptor.opentelemetry.OpenTelemetryInterceptorFactory
- All Implemented Interfaces:
HandlerInterceptor.Factory,RunInterceptor.Factory
public final class OpenTelemetryInterceptorFactory
extends Object
implements HandlerInterceptor.Factory, RunInterceptor.Factory
OpenTelemetry interceptor factory for Java handlers. Implements both
HandlerInterceptor.Factory and RunInterceptor.Factory so a single registration covers
both invocation- and run-level spans.
- Per invocation: opens an
attempt <target>span (server kind) withrestate.invocation.idandrestate.invocation.targetattributes. The parent span context is extracted from the incoming request headers via the configuredTextMapPropagator. - Per
ctx.run(name, ...)call: opens arun (<name>)child span with therestate.run.nameattribute.
Scopes are thread-local. Use with OpenTelemetryRunContextPropagator (registered via
SPI by default) to propagate spans to run closures.
-
Constructor Summary
ConstructorsConstructorDescriptionOpenTelemetryInterceptorFactory(io.opentelemetry.api.OpenTelemetry openTelemetry) -
Method Summary
Modifier and TypeMethodDescription@Nullable HandlerInterceptorCreateHandlerInterceptor.@Nullable RunInterceptorCreateRunInterceptor.
-
Constructor Details
-
OpenTelemetryInterceptorFactory
public OpenTelemetryInterceptorFactory(io.opentelemetry.api.OpenTelemetry openTelemetry)
-
-
Method Details
-
createHandlerInterceptor
Description copied from interface:HandlerInterceptor.FactoryCreateHandlerInterceptor. Invoked once at endpoint initialization, hence the resulting interceptor is cached and reused across all invocations.Return
nullto skip this factory.- Specified by:
createHandlerInterceptorin interfaceHandlerInterceptor.Factory
-
createRunInterceptor
Description copied from interface:RunInterceptor.FactoryCreateRunInterceptor. Invoked once at endpoint initialization, hence the resulting interceptor is cached and reused across all invocations.Return
nullto skip this factory.- Specified by:
createRunInterceptorin interfaceRunInterceptor.Factory
-