feat(metrics): add keeperhub-metrics-collector service + image#1437
Closed
chong-techops wants to merge 1 commit into
Closed
feat(metrics): add keeperhub-metrics-collector service + image#1437chong-techops wants to merge 1 commit into
chong-techops wants to merge 1 commit into
Conversation
…6484 A) Standalone single-replica service that serves the DB-sourced Prometheus gauges (the former /api/metrics/db scrape) off the request-serving pods. Executor-style: build-context = repo root, reuses lib/metrics + lib/db verbatim via tsx, so the exposed gauge families are identical. - keeperhub-metrics-collector/: node:http server (PORT 9090) serving GET /metrics (updateDbMetrics -> getDbMetrics) and GET /health, with a test exercising the HTTP wiring on an ephemeral port. - Dockerfile metrics-collector stage (source-only dep, no Next builder) + source-stage wiring. Validated by a real image build: imports resolve, /health 200, /metrics runs the real queries. - docker-bake.hcl target/group + METRICS_COLLECTOR_ECR_REPO var. Inert until a deploy workflow + ECR repo wire it (TECH-6484 B).
This was referenced Jun 2, 2026
Author
🧹 PR Environment Cleaned UpThe PR environment has been successfully deleted. Deleted Resources:
All resources have been cleaned up and will no longer incur costs. |
ℹ️ No PR Environment to Clean UpNo PR environment was found for this PR. This is expected if:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
keeperhub-metrics-collector, a standalone single-replica service that serves the DB-sourced Prometheus gauges (the former/api/metrics/dbscrape) off the request-serving pods, plus its container image wiring. This is the service + image half of TECH-6484; the deploy wiring is a separate, dependent PR.Approach
Executor-style: build-context = repo root, reuses
lib/metrics+lib/dbverbatim viatsx(zero query duplication, zero schema drift).import "server-only"is a no-op under Node/tsx (and shimmed in the image). Single replica → the scrape becomes deterministic from one pod, replacing the reverted hashmod idea.keeperhub-metrics-collector/—node:httpserver (PORT, default 9090) servingGET /metrics(updateDbMetrics→getDbMetrics) andGET /health;server.test.tsexercises the HTTP wiring on an ephemeral port.Dockerfilemetrics-collectorstage — depends onsourceonly (no Next builder): the metrics import graph references no builder-generated file at runtime (lib/db/schemauseslib/types/integrationonly viaimport type, erased by tsx).docker-bake.hcltarget/group +METRICS_COLLECTOR_ECR_REPOvar.Validation
pnpm type-checkclean,pnpm check(biome) clean, collector tests pass (4).docker build --target metrics-collector): no Next build runs,prometheus-api+db-metricsimport cleanly in the trimmed container,/health→ 200, and/metricsconstructs and runs the real aggregate queries (only the DB connection fails under a dummy URL — no missing modules).Safe to merge anytime
Nothing builds or deploys this image yet — it's inert until the deploy PR + ECR repo land. No cutover here; the app's
/api/metrics/dband its ServiceMonitor are untouched.