feat(metrics): worker job-run counters and business gauges (#60) #165
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
primatekuntech/kws!165
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/worker-metrics-60"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Step 2a of #60 (docs/05-observability.md): the worker's
/metricsnow carries job-run counters and business gauges.What
jobs.Config.Observereports every run (ok,failed,permanent) ->kws_job_runs_total{kind,outcome},kws_job_duration_seconds{kind}.metrics/pgstore, read at most once per 30 s on a scrape (no goroutine), all on the uuidv7 primary-key range:kws_sales_last_hour,kws_payments_last_day,kws_sales_pending,kws_sales_processing,kws_sales_oldest_processing_age_seconds,kws_payments_refund_due.kws_business_snapshot_errors_total, andkws_business_snapshot_timestamp_secondslets an alert catch stale data. No error text is exported.ContinueOnError, uncompressed).Review
Pass 1 (ponytail) and Pass 2 (correctness subagent) done. Pass 2 fixes: the uuidv7 bound floors the millisecond (was rounded), a failed first read is not retried every scrape, the last-good timestamp gauge. Each has a test that failed first.
Coverage
make cover: total 91.4% (minimum 80%).make lint: 0 issues.Rulings / notes (ADR 0036)
max.kws_job_attempts_exhausted_total,kws_sales_pending_overdue(a deadsales.expiremakeskws_sales_pendingfall),refund_dueis a seq scan (partial index past ~1M rows).🤖 Generated with Claude Code