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) with restate.invocation.id and restate.invocation.target attributes. The parent span context is extracted from the incoming request headers via the configured TextMapPropagator.
  • Per ctx.run(name, ...) call: opens a run (<name>) child span with the restate.run.name attribute.

Scopes are thread-local. Use with OpenTelemetryRunContextPropagator (registered via SPI by default) to propagate spans to run closures.