Skip to content

@opentelemetry/api adapter for the Tracer interface #63

@pathosDev

Description

@pathosDev

The OTel-style tracing layer (#10) ships with the framework's own minimal `Tracer` interface plus a `RecordingTracer` reference impl. It does not depend on `@opentelemetry/api`.

Most production users will want to plug into the real OTel SDK (Jaeger / Tempo / Honeycomb / Datadog). Instead of asking each user to write the same adapter, ship one in the framework as a thin optional wrapper.

Scope:

  • New file `src/tracing/OtelAdapter.ts` (peer-dep: `@opentelemetry/api`).
  • Exports `otelTracer(otelApi: trace.Tracer)` that returns our `Tracer` shape.
  • Methods translate:
    • `startSpan(name, opts)` → `otelApi.startSpan(name, opts)`
    • `withActiveSpan(span, fn)` → `context.with(trace.setSpan(context.active(), span), fn)`
    • `injectContext` / `extractContext` → `propagation.inject` / `propagation.extract` with the W3C `TraceContextPropagator`
  • Tests against the OTel SDK's `InMemorySpanExporter` so we can assert spans without HTTP exporters.
  • Example: `examples/management/otel-jaeger.ts` showing OTLP-HTTP exporter setup.

Estimate: 1-2 days.

Verification:

  • Round-trip an actor.receive span through the adapter, observe in the OTel exporter that traceId / spanId / parent are preserved.
  • Cross-wire propagation: A's tell with the OTel-tracer enabled produces a `traceparent` header B can extract, then chain into B's actor.receive span.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions