<#7606 Instrument runs service DB repository layer...
# flyte-github
a
#7606 Instrument runs service DB repository layer with Prometheus metrics Pull request opened by youdie006 Summary Implements #7448 — instruments the flyte2 runs service DB repository layer with Prometheus metrics. Adds a
dbMetrics
helper (
runs/repository/impl/metrics.go
) recording, per DB operation, a calls counter, an errors counter, and a latency stopwatch, built from a
promutils.Scope
sub-scope — mirroring flyte's existing metrics idiom (a
Metrics
struct from a
promutils.Scope
via a
newMetrics(scope)
constructor). A
promutils.Scope
is threaded into the action / task / project / trigger repo constructors (each gets its own named sub-scope), and every DB op is wrapped through a DRY
observe(ctx, operation, fn)
helper. Metrics are labeled by operation name only (low cardinality, never row/project/user values). A nil scope yields a no-op
dbMetrics
, so constructors stay usable in unit tests. Test plan • New
runs/repository/impl/metrics_test.go
(TDD red→green): nil-scope no-op, success/error observation, operation-only labeling, plus an end-to-end
CreateProject
test against the embedded postgres DB asserting the call counter, latency, and error counter. •
go build ./...
exit 0, `gofmt`/`go vet` clean on touched files,
go test ./runs/repository/impl/
ok. Fixes #7448 flyteorg/flyte