Skip to content

feat(health): serve prometheus and thanos under the metricsDb service - #650

Merged
github-actions[bot] merged 1 commit into
developfrom
feat/metricsdb-service
Sep 10, 2026
Merged

github-actions[bot] merged 1 commit into
developfrom
feat/metricsdb-service

Conversation

@Eandalf-Bigstack

Copy link
Copy Markdown
Collaborator

What type of PR is this?

feature


Which issue(s) this PR fixes?

Refs bigstack-oss/cubecos#672


What this PR does?

Serves prometheus and thanos under a new metricsDb service in the infrascope category.

CubeCOS grew Prometheus and Thanos as its metric persistence layer and neither had a service to report under. metrics is collection and visualisation (monasca, telegraf, grafana, lachesis), a different concern from the time-series database behind it, so this is a sibling service rather than an extension of metrics. influxdb and kapacitor stay under notifications: kapacitor is a write proxy and alerting engine here, not only storage, so moving that pair is a separate decision.

Only two things move:

  • internal/cubecos/module.go — the new service entry, both modules repairable
  • api/cube-cos-openapi — submodule pointer 09b7d76a34418d

api/docs.json is gitignored and regenerated from the submodule by task generateApiDocs, so it is deliberately not in the diff.


Test results (optional)

1). make sure the api docs have been updated

The submodule now carries a docs.yaml with the metricsDb service, and the generator reproduces it:

$ git -C api/cube-cos-openapi log --oneline -1
a34418d feat(health): add the metricsDb service under infrascope
$ grep -c metricsDb api/cube-cos-openapi/docs.yaml
4

$ yq -o=json -I=4 api/cube-cos-openapi/docs.yaml > api/docs.json   # task generateApiDocs
$ wc -c < api/docs.json ; grep -c metricsDb api/docs.json
1405915
4

4 occurrences = 1 /services response example + 3 service-name enums (health history ×2, module repair).

2). make sure the api works properly

$ CGO_ENABLED=0 GOWORK=off go build ./api/... ./internal/...   # rc=0
$ CGO_ENABLED=0 GOWORK=off go vet   ./api/... ./internal/...   # rc=0
$ gofmt -l internal/cubecos/module.go                          # (no output)
$ docker compose run --rm cube-cos-api-builder                 # rc=0 -> bin/cube-cos-api

The build matters here specifically because api/docs.json is embedded via //go:embed in api/docs.go — a spec that failed to generate would fail the compile rather than pass silently.


Dependencies

Depends on bigstack-oss/cube-cos-openapi#111 — merge that first.

The submodule is pinned to a34418d, which currently exists only on that PR's feature branch. Once #111 merges, this pointer should be re-pinned to develop so develop here never references a commit reachable only from a feature branch.

Sibling PR, same stack, independent of this one: bigstack-oss/cube-cos-ui (UI labels + regenerated SDK enum). The CubeCOS-side change is in bigstack-oss/cubecos on jim.lin/feat/replace-monasca-1.

@raven-pan raven-pan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Pairs with the cubecos S[MetricsDb] check item and the cube-cos-openapi spec
bump. api/docs.json is gitignored and regenerated from the submodule by
'task generateApiDocs', so only module.go and the submodule pointer move.

The submodule is pinned to a34418d on cube-cos-openapi's feat/metricsdb-service;
re-pin to develop once that PR merges.

Verified: submodule docs.yaml carries metricsDb, yq regenerates a valid
docs.json carrying it too, and CGO_ENABLED=0 go build ./api/... ./internal/...
is clean with it embedded.

Signed-off-by: Jim Lin <jim.lin@bigstack.co>
Co-authored-by: Eandalf <clinah@connect.ust.hk>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Eandalf-Bigstack Eandalf-Bigstack added the done Merge the pull request label Sep 10, 2026
@github-actions
github-actions Bot merged commit 71c68b0 into develop Sep 10, 2026
7 of 8 checks passed
@github-actions
github-actions Bot deleted the feat/metricsdb-service branch September 10, 2026 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

done Merge the pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants