Skip to main content
The @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 the restate.run.name attribute
  • Suppresses span events during replay (to avoid duplicate events)

Setup

Install the package:
Then add the hook to your service or endpoint:
Check the TSDocs to see the full list of options.

Full example

For a complete end-to-end tracing example with Jaeger, see the OpenTelemetry integration example.