Context
Final slice of the review-enrichment track. The engine seam already emits a selfhost_enrichment_failed warn log; add the Prometheus counters so the existing Grafana/Loki stack observes enrichment volume, failures, and latency, matching how the rest of the self-host engine is instrumented.
Requirements
- Add
gittensory_enrichment_requests_total, gittensory_enrichment_failed (or _total), and an elapsed/latency metric (gittensory_enrichment_elapsed), incremented in src/review/enrichment-wire.ts around the POST (success, failure, elapsed) — mirroring how existing self-host counters are registered/incremented.
- Keep the metrics on the engine side (the same Prometheus registry the rest of the engine uses); the service can expose its own
/metrics later if needed but is out of scope here.
- No behavior change when the feature is off (a never-called builder increments nothing).
Deliverables
- Counter registration + increments in
src/review/enrichment-wire.ts (and wherever the engine registers Prometheus metrics).
- Optionally add an enrichment row/panel to the relevant Grafana dashboard JSON so operators see request/failure/latency at a glance.
Acceptance criteria
- With the feature on, a successful enrich increments
_requests_total and records elapsed; a timeout/non-200 increments _failed. With the feature off, no counter moves.
- Tests cover the success and failure increment paths (both arms) to 97% branch-counted patch on the touched
src/** lines.
npm run test:coverage (unsharded) 100% patch; npm run test:ci green; npm audit --audit-level=moderate clean. Grafana JSON (if touched) remains valid.
Parent: #1029
Context
Final slice of the review-enrichment track. The engine seam already emits a
selfhost_enrichment_failedwarn log; add the Prometheus counters so the existing Grafana/Loki stack observes enrichment volume, failures, and latency, matching how the rest of the self-host engine is instrumented.Requirements
gittensory_enrichment_requests_total,gittensory_enrichment_failed(or_total), and an elapsed/latency metric (gittensory_enrichment_elapsed), incremented insrc/review/enrichment-wire.tsaround the POST (success, failure, elapsed) — mirroring how existing self-host counters are registered/incremented./metricslater if needed but is out of scope here.Deliverables
src/review/enrichment-wire.ts(and wherever the engine registers Prometheus metrics).Acceptance criteria
_requests_totaland records elapsed; a timeout/non-200 increments_failed. With the feature off, no counter moves.src/**lines.npm run test:coverage(unsharded) 100% patch;npm run test:cigreen;npm audit --audit-level=moderateclean. Grafana JSON (if touched) remains valid.Parent: #1029