Skip to content

Instrument current webhook, approval, queue, lock, and run-start telemetry #64

Description

@ncolesummers

Summary

Instrument only the currently implemented operational paths that ADR 0012 names, without inventing future run execution, stage transition, retry, cancellation, or validation-runner behavior.

This issue now covers the telemetry that can be wired to existing control-plane paths: GitHub webhook outcomes, development-loop run start and trace correlation, approval wait/pending state, queued-run depth, lock contention, and central observability helper boundaries.

Run/step completion, duration, retry, cancellation, stage-transition outcomes, and deterministic validation execution telemetry are deferred to #73 under #14 so those metrics are implemented with the feature that creates the runtime behavior.

Deliverables

  • Emit loopworks.webhook.outcome for existing GitHub webhook route branches: accepted, rejected, duplicate, invalid signature, and unexpected error.
  • Preserve loopworks.run.started for development-loop creation and keep ADR 0012 trace correlation aligned across logs, spans, loop_runs.trace_id, run_steps.trace_id, and durable observability rows.
  • Emit loopworks.approval.wait_time for current approval decision paths and expose loopworks.approval.pending from existing outstanding approval rows.
  • Emit loopworks.queue.depth from existing queued loop_runs state.
  • Emit loopworks.lock.contention from existing idempotency lock conflict paths.
  • Keep all OTel metric/span creation and metric-name literals behind src/lib/observability/ helpers.

Acceptance Criteria

  • Focused tests are written first and demonstrate the red state before production code changes.
  • Emitted metric names, units, and attributes match ADR 0012 exactly for the metrics in this issue.
  • Tests cover webhook outcome branches, approval decision paths, pending approval gauge behavior, queue-depth gauge behavior, and lock contention where currently implemented.
  • trace_id propagation remains aligned with run and step persistence for development-loop run creation.
  • No instrumentation call site bypasses the central observability helpers.
  • No fake production call sites are added for run/step completion, retries, cancellations, stage outcomes, or validation execution metrics.
  • Runtime changes include bun run build; broad observability changes finish with bun run validate.

Notes

Refs #21
Refs #14
Refs #73
Refs ADR 0012

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:loopsLoop registry, manifests, and execution stages.area:observabilityStructured logs, metrics, traces, alerts, and operational visibility.priority:p1High priority after P0 work.

    Projects

    Status
    Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions