Skip to content

feat: add internal/observe package for run-level metrics#66

Open
marcus wants to merge 1 commit intomainfrom
visibility-instrument
Open

feat: add internal/observe package for run-level metrics#66
marcus wants to merge 1 commit intomainfrom
visibility-instrument

Conversation

@marcus
Copy link
Owner

@marcus marcus commented Mar 21, 2026

Summary

  • Add lightweight internal/observe package with thread-safe counters, gauges, and duration histograms (zero external dependencies)
  • Wire Collector into the orchestrator via WithObserver option to capture per-phase timing (plan_duration_ms, implement_duration_ms, review_duration_ms), agent call counts/durations, iteration counts, and task outcome counters
  • Flush all collected metrics as a single structured zerolog JSON log entry at end of each run
  • Add run-level gauges in executeRun: run_duration_ms, projects_processed, tasks_run, tasks_completed, tasks_failed, budget_used_percent

Test plan

  • Unit tests for Counter, Gauge, Duration, Snapshot, nil safety, concurrency, and Flush (go test ./internal/observe/...)
  • Existing orchestrator tests pass unchanged (go test ./internal/orchestrator/...)
  • go vet clean on all affected packages

🤖 Generated with Claude Code


Automated by nightshift

Add a lightweight, zero-dependency observe.Collector with thread-safe
counters, gauges, and duration histograms. Wire it into the orchestrator
to capture per-phase timing, agent call counts, iteration counts, and
task outcome counters. Flush all metrics as a single structured zerolog
JSON entry at the end of each run via the existing logging infrastructure.

Nightshift-Task: visibility-instrument
Nightshift-Ref: https://github.com/marcus/nightshift

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant