Skip to content

Add OpenTelemetry tracing for task dispatch and execution #56

@conradbzura

Description

@conradbzura

Summary

Instrument task dispatch and execution with OpenTelemetry tracing. Create spans on both the client side (WorkerProxy.dispatch) and worker side (WorkerService.dispatch) so users get end-to-end visibility into dispatch latency, nested task chains, and errors without writing custom instrumentation.

Use a no-op tracer by default so there is zero overhead until the user configures an OTel exporter. No new dependencies required — opentelemetry-api provides the tracer interface and is a no-op when no SDK is installed. Gate the opentelemetry-api dependency behind a telemetry extra.

Motivation

Users currently have no built-in way to monitor dispatch latency, trace nested task chains, or correlate errors across workers. OpenTelemetry is the standard for this and fits Wool's philosophy of integrating with purpose-built tools rather than reinventing them.

The existing Task dataclass already carries the right data for span attributes: task ID, tag, caller (parent task UUID), worker address, and timeout. The caller field maps directly to OTel's parent-child span model, giving nested routine chains automatic trace trees.

Affected code

  • wool/src/wool/runtime/worker/proxy.py — client-side dispatch span
  • wool/src/wool/runtime/worker/service.py — worker-side execution span
  • wool/src/wool/runtime/routine/task.py — span attribute source
  • wool/pyproject.toml — optional opentelemetry-api dependency

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or capability

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions