@restatedev/restate-sdk-opentelemetry package provides a ready-made OpenTelemetry hook. It:
- Extracts W3C trace context from the Restate attempt headers
- Creates one span per handler attempt with standard attributes (
restate.invocation.id,restate.invocation.target) - Creates child spans for
ctx.run()closures with therestate.run.nameattribute - Suppresses span events during replay (to avoid duplicate events)