Skip to content

feat(metrics): Add core/metrics utility package#107

Merged
behinddwalls merged 1 commit into
mainfrom
preetam/metrics
Mar 3, 2026
Merged

feat(metrics): Add core/metrics utility package#107
behinddwalls merged 1 commit into
mainfrom
preetam/metrics

Conversation

@behinddwalls
Copy link
Copy Markdown
Collaborator

Summary

  • Add core/metrics package with reusable helpers for tally.Scope that standardize metric emission across controllers
  • Op lifecycle type (Begin/Complete) tracks operations with automatic called, succeeded/failed counters, latency timer, and latency_histogram — with error-aware tagging via core/errs integration
  • Named* helpers (NamedCounter, NamedTimer, NamedHistogram, NamedGauge) provide consistent {name}.{sub} sub-scope patterns for ad-hoc metrics
  • Pre-defined LatencyBuckets from 5ms to 4h for both fast RPCs and long-running operations

Test plan

  • make test passes (all 21 tests including new core/metrics:metrics_test)
  • make gazelle shows no diff (BUILD files in sync)
  • Table-driven tests cover Begin/Complete lifecycle with nil, generic, retryable, user, and dependency errors
  • Tests verify tag propagation, named helpers, gauge, histogram, and latency bucket ordering

@behinddwalls behinddwalls requested review from a team and sbalabanov as code owners March 2, 2026 07:41
@behinddwalls behinddwalls enabled auto-merge March 2, 2026 07:43
Comment thread core/metrics/metrics.go Outdated
Add reusable metrics helpers for tally.Scope that standardize metric
emission across controllers. Includes Op lifecycle (Begin/Complete) for
operation tracking with automatic counters, timers, histograms, and
error-aware tagging via core/errs integration. Named helpers provide
consistent {name}.{sub} sub-scope patterns for ad-hoc counters, timers,
histograms, and gauges.
@behinddwalls behinddwalls added this pull request to the merge queue Mar 3, 2026
Merged via the queue into main with commit 64fb9d1 Mar 3, 2026
8 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.

3 participants