Skip to content

refactor(controller): route metrics through observability/metrics Emitter#227

Merged
xytan0056 merged 2 commits into
mainfrom
pr2-controller-metrics
Jul 21, 2026
Merged

refactor(controller): route metrics through observability/metrics Emitter#227
xytan0056 merged 2 commits into
mainfrom
pr2-controller-metrics

Conversation

@xytan0056

@xytan0056 xytan0056 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

redo: #215 , which landed on the wrong branch

  • Ports the controller off raw tally.Scope counters/timers to *metrics.Emitter with the Begin/Complete lifecycle helper.
  • Params keeps Scope tally.Scope; NewController subscopes it to controller and builds its own emitter (nil → no-op).
  • Each RPC bakes the repo tag once, then Begin/Complete emit start + result-tagged finish (replacing calls/success/failure + total_duration timers).
  • Sub-ops get_graph and compare_target_graphs get their own lifecycle; compare_target_graphs flattens to its own op.
  • Other timers → DurationHistogram with package-level buckets (controller/metrics.go); emitFailureMetric keeps the failure_type/failure_reason axis.

Replaces #215 (auto-closed when base branch pr1-emitter-core merged).

Test plan

  • make build passes
  • make test — all 21 tests pass

…tter

Port the controller off tally.Scope to *metrics.Emitter using the
Begin/Complete lifecycle helper per docs/observability/metrics.md.

- Params.Scope tally.Scope -> Emitter *metrics.Emitter (optional, nil->Nop)
- Each RPC bakes the repo tag into a per-request emitter, then Begin/Complete
  emit start + result-tagged finish (replacing calls/success/failure and the
  total_duration timers); no domain metrics struct or memoization
- Sub-operations (get_graph, compare_target_graphs) get their own Begin/Complete
  lifecycle; compare_target_graphs flattens to its own op
- Custom timers -> DurationHistogram on the repo-tagged emitter with explicit
  package-level buckets (controller/metrics.go)
- emitFailureMetric(e, op, err) keeps the failure_type/reason axis
- Add controller/metrics_test.go asserting the start/finish path shape
@xytan0056
xytan0056 requested review from a team as code owners July 21, 2026 20:27
@xytan0056
xytan0056 merged commit 33973a0 into main Jul 21, 2026
10 checks passed
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.

2 participants