loop-task

OpenTelemetry

Built-in OpenTelemetry instrumentation for loop runs, tasks, and agent commands. Configure an OTLP endpoint and traces flow automatically.

loop-task includes built-in OpenTelemetry support that automatically instruments loop runs, tasks, and commands. When enabled, it can also configure supported coding agents (OpenCode, Claude Code) to route their telemetry through the same OTLP destination.

Quick Start

  1. Configure an OTLP endpoint:

    loop-task telemetry endpoint http://127.0.0.1:4318
  2. Run your loops normally. Telemetry is emitted automatically.

  3. View the status:

    loop-task telemetry status

Commands

View status

loop-task telemetry
loop-task telemetry status

Output:

OpenTelemetry
  Enabled:                yes
  Endpoint:               http://127.0.0.1:4318
  Protocol:               http/protobuf
  Service:                loop-task
  Auto-instrument agents: yes
  Capture content:        no
  Headers:                not configured

Enable or disable

loop-task telemetry on
loop-task telemetry off

Configure endpoint

loop-task telemetry endpoint http://127.0.0.1:4318

Configure protocol

loop-task telemetry protocol grpc
loop-task telemetry protocol http/protobuf

Test connection

loop-task telemetry test

Command Palette (Ctrl+P)

Inside the TUI board, press Ctrl+P to access:

  • OpenTelemetry status and connection info — shows enabled state, export status, endpoint, protocol, and privacy settings
  • Enable or disable OpenTelemetry — toggles telemetry at runtime without restarting
  • Test OpenTelemetry connection — sends a diagnostic span to verify the endpoint is reachable

Default Behavior

Telemetry is enabled by default but no endpoint is contacted until one is configured. This means:

  • New installations start with telemetry instrumentation active
  • No data is sent anywhere until you explicitly configure an OTLP endpoint
  • No connection errors appear when no endpoint is set
  • The status command reports "enabled" with "not configured" export state

Privacy

Content capture is disabled by default. The following are never exported unless you explicitly enable content capture:

  • Prompt content
  • Model response content
  • Source code
  • Full stdout/stderr
  • Environment variable values
  • Tool arguments containing arbitrary content
  • API keys, tokens, and authentication headers

Command arguments are sanitized: only the executable name and argument count are recorded, not the full arguments (which may contain prompts).

Agent Auto-Instrumentation

When a task executes a supported coding agent, loop-task automatically configures that agent's native OpenTelemetry support to route telemetry to the same OTLP endpoint.

Supported Agents

AgentDetectionAuto-Configuration
OpenCodeopencode run ...Enables experimental OpenTelemetry, sets OTEL_* environment variables
Claude Codeclaude -p ... or claude --print ...Enables telemetry, sets OTEL_* environment variables

You do not need to configure OpenCode or Claude Code telemetry separately. loop-task handles it automatically.

Disabling Auto-Instrumentation

To disable agent auto-instrumentation while keeping loop-task's own telemetry:

# Not yet available via CLI — use settings directly

Environment Variables

loop-task respects the standard OpenTelemetry environment variables:

  • OTEL_EXPORTER_OTLP_ENDPOINT — fallback endpoint if not configured in settings
  • OTEL_EXPORTER_OTLP_PROTOCOL — fallback protocol (grpc or http/protobuf)
  • OTEL_EXPORTER_OTLP_HEADERS — authentication headers for the OTLP endpoint
  • OTEL_RESOURCE_ATTRIBUTES — additional resource attributes (merged with loop-task correlation attributes)

The precedence order is:

  1. Explicit loop-task CLI settings
  2. Daemon telemetry settings (configured via loop-task telemetry endpoint)
  3. Standard OTEL_* environment variables
  4. No exporter configured

Local Collector Example

Here's a minimal OpenTelemetry Collector configuration for local development:

# otel-collector-config.yaml
receivers:
  otlp:
    protocols:
      grpc:
      http:

exporters:
  debug:
    verbosity: detailed

service:
  pipelines:
    traces:
      receivers: [otlp]
      exporters: [debug]
    metrics:
      receivers: [otlp]
      exporters: [debug]

Start with Docker:

docker run --rm -p 4317:4317 -p 4318:4318 \
  -v $(pwd)/otel-collector-config.yaml:/etc/otelcol/config.yaml \
  otel/opentelemetry-collector:latest

Then configure loop-task:

loop-task telemetry endpoint http://127.0.0.1:4318
loop-task telemetry test

Span Names

loop-task uses stable span names that do not include dynamic identifiers:

SpanName
Loop runloop_task.loop.run
Task executeloop_task.task.execute
Command executeloop_task.command.execute
Agent executeloop_task.agent.execute

Dynamic identifiers (run ID, task ID, issue numbers) are recorded as span attributes, not in the span name.

Architecture

loop-task
├── loop-task instrumentation
├── OpenCode instrumentation (auto-configured)
└── Claude Code instrumentation (auto-configured)
        |
        | OTLP
        v
  Configured OTLP destination
        |
        v
  User's observability backend

loop-task supports any OTLP-compatible destination including: OpenTelemetry Collector, Grafana Alloy, Jaeger (via Collector), Grafana Tempo, Honeycomb, Datadog, New Relic, Azure Monitor, and other compatible platforms.