Skip to content

Add tracing instrumentation for command execution #241

@joshrotenberg

Description

@joshrotenberg

Context

Cross-language parity gap surfaced while comparing docker-wrapper with the Elixir docker_wrapper_ex. The Elixir side has first-class telemetry integration (events around run/build/compose/stream lifecycle); the Rust side currently emits nothing.

Proposal

Add tracing spans to DockerCommand::execute and execute_stream, plus the compose/buildx/swarm feature-gated paths:

  • Top-level span per command invocation with fields: command (e.g. run, ps, compose up), args_count, platform (docker/podman/nerdctl when detected).
  • tracing::info! on start, tracing::info! on successful exit with duration + exit_code.
  • tracing::warn! / error! on non-zero exit with stderr snippet (bounded length).
  • Stream variant: tracing::debug! per line under a parent span so callers can filter verbose paths at the subscriber level.

Gate behind an optional tracing feature (default on) so no-instrumentation builds stay lean.

Parity reference

docker_wrapper_ex emits [:docker_wrapper, :exec, :start|:stop|:exception] events with equivalent metadata. Matching fields on the Rust side makes it easy to correlate logs when both wrappers run in the same system (e.g. multi-language test harnesses).

Out of scope

  • OpenTelemetry exporter wiring (leave to the consuming binary).
  • Metrics -- add later via a metrics crate bridge if demand surfaces.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions