Skip to content

feat(observability): instrument REES (review-enrichment service) with real Prometheus metrics #5367

Description

@JSONbored

Part of #5365.

Context: REES (review-enrichment/, a standalone first-party TypeScript/Node HTTP service, src/server.ts) has zero observability today — confirmed live: GET /metrics returns 404. It runs --profile rees-gated, reached only in-network at http://rees:8080, and does heavier/external/historical PR analysis work for the main review engine (analyzers can time out, fail, or degrade — none of that is currently visible).

Requirements:

  1. Add a lightweight in-process Prometheus text-format metrics registry to REES, analogous to src/selfhost/metrics.ts's pattern in the main app (counters/gauges/histograms, a renderMetrics()-style function, a # HELP/# TYPE registry) — scaled to REES's actual needs, not a wholesale copy of the main app's registry.
  2. Instrument the meaningful signal REES already has internally but doesn't expose: per-analyzer request counts, success/failure/timeout counts, and duration histograms; overall /v1/enrich request counts and duration.
  3. Add a GET /metrics route to REES's own src/server.ts.
  4. Add a rees scrape target to prometheus/prometheus.yml, gated the same way the existing GPU/backup targets are documented ("absent target just shows down, no alert fires" — since --profile rees is optional).
  5. Add REES-specific panels to a dashboard (either a new REES-focused dashboard or a section of the new infra-health dashboard from feat(observability): add node-exporter, cAdvisor, redis_exporter, scrape Qdrant + self-monitor the observability stack #5366, whichever is filed first) — per-analyzer success rate, timeout rate, and latency distribution are the highest-value panels.
  6. Full test coverage in review-enrichment/test/ (REES has its own test suite, run via node --test) plus any repo-root observability-config tests that need updating (selfhost-observability-config.test.ts, validate-observability-configs.mjs-covered files).

Deliverables:

  • New metrics module + /metrics route in review-enrichment/src/.
  • Analyzer-level instrumentation (success/failure/timeout/duration) wired into REES's existing analyzer-dispatch code path.
  • prometheus.yml scrape target.
  • Dashboard panel(s) for REES-specific signal.
  • Tests in both review-enrichment/test/ and the root test suite as needed.

Expected outcomes: An operator running --profile rees can see, in Grafana, which analyzers are failing/timing out and how often, and REES's overall request volume/latency — instead of only finding out an analyzer is broken when a PR review visibly lacks enrichment context.

Links/resources:

  • src/selfhost/metrics.ts — the main app's existing metrics-registry pattern to reference (not copy wholesale; REES is a much smaller service).
  • review-enrichment/src/server.ts, review-enrichment/package.json — REES's own structure (Node ≥20, tsc build, node --test test runner).
  • The gpu/gittensory-backup scrape-target comments in prometheus/prometheus.yml for the "optional profile, absent target is fine" convention to mirror.

Metadata

Metadata

Assignees

Labels

maintainer-onlyOwner-only work — yields no Gittensor points.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions