test-token-service: turn on TOKEN_SERVICE_METRICS_PORT and scrape it (#409) #263

Merged
sophie merged 1 commit from pixel/409-test-token-service-turn-on-token-service into main 2026-11-30 22:23:41 +11:00
Collaborator

Pixel task #409. Turns on the metrics listener that test-token-service got in sophie/test-token-service#12 and lets vmagent find it.

In argo/scout/test-token-service/deployment.yaml:

  • env TOKEN_SERVICE_METRICS_PORT = 9090
  • a containerPort 9090 named metrics. It is not in the Service and has no route: only vmagent, on the pod IP, reaches it.
  • pod annotations prometheus.io/scrape: "true", prometheus.io/port: "9090", prometheus.io/path: /metrics
  • the image digest: from sha256:f2e91867… (built from 93644d6, no metrics) to sha256:80d06b9a…, which the registry gives for both main and sha-7c0dac9, the merge commit of that pull request.

docs/monitoring.md, "Scraped services": the scout row now says 9090 and kubernetes-pods, and the row in "Apps' built-in metrics" says what is scraped.

Restart on merge

One replica, rolling update: the new pod is ready before the old one stops. The service keeps its signing keys in memory, so tokens issued before the restart no longer verify, as on every restart.

Checked before the merge

  • kubectl apply --dry-run=server on scout: accepted.
  • The new image, run locally with TOKEN_SERVICE_METRICS_PORT=9090: logs metrics server started addr=:9090 path=/metrics; :9090/metrics has 56 series, all 12 test_token_service_* series at 0 (both alg, the 8 reason); /metrics on 8080 is 404 page not found.
  • https://test-token-service.m.ac.nz/metrics answers 404 with 404 page not found today.
  • The namespace has no NetworkPolicy, so vmagent can reach the pod on 9090.

To check after the merge

  • The target is up under job="kubernetes-pods", namespace test-token-service.
  • test_token_service_tokens_issued_total has both alg series.
  • https://test-token-service.m.ac.nz/metrics is still 404 page not found, and the service answers.

🤖 Generated with Claude Code

Pixel task #409. Turns on the metrics listener that test-token-service got in https://code.m.ac.nz/sophie/test-token-service/pulls/12 and lets vmagent find it. In `argo/scout/test-token-service/deployment.yaml`: - env `TOKEN_SERVICE_METRICS_PORT` = `9090` - a `containerPort` 9090 named `metrics`. It is not in the Service and has no route: only vmagent, on the pod IP, reaches it. - pod annotations `prometheus.io/scrape: "true"`, `prometheus.io/port: "9090"`, `prometheus.io/path: /metrics` - the image digest: from `sha256:f2e91867…` (built from `93644d6`, no metrics) to `sha256:80d06b9a…`, which the registry gives for both `main` and `sha-7c0dac9`, the merge commit of that pull request. `docs/monitoring.md`, "Scraped services": the scout row now says 9090 and `kubernetes-pods`, and the row in "Apps' built-in metrics" says what is scraped. ## Restart on merge One replica, rolling update: the new pod is ready before the old one stops. The service keeps its signing keys in memory, so tokens issued before the restart no longer verify, as on every restart. ## Checked before the merge - `kubectl apply --dry-run=server` on scout: accepted. - The new image, run locally with `TOKEN_SERVICE_METRICS_PORT=9090`: logs `metrics server started addr=:9090 path=/metrics`; `:9090/metrics` has 56 series, all 12 `test_token_service_*` series at 0 (both `alg`, the 8 `reason`); `/metrics` on 8080 is `404 page not found`. - `https://test-token-service.m.ac.nz/metrics` answers 404 with `404 page not found` today. - The namespace has no NetworkPolicy, so vmagent can reach the pod on 9090. ## To check after the merge - The target is up under `job="kubernetes-pods"`, namespace `test-token-service`. - `test_token_service_tokens_issued_total` has both `alg` series. - `https://test-token-service.m.ac.nz/metrics` is still `404 page not found`, and the service answers. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The digest moves to the image built from the merge of test-token-service
pull request 12 (sha-7c0dac9), the first with the metrics listener. The
port is in no Service and has no route.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
pixel-board left a comment

The change does what #409 asks. I read the diff and the code it depends on, and found nothing that must change.

  • argo/scout/test-token-service/deployment.yaml sets env TOKEN_SERVICE_METRICS_PORT=9090. That is not 8080, the main port (TOKEN_SERVICE_PORT is not set, so it defaults to 8080). It also adds containerPort 9090 named metrics, left out of service.yaml and the route. The pod-template annotations name the same port, which is what kubernetes-pods's keep_if_equal needs (docs/monitoring.md, "Opting an app in to scraping").
  • The new digest sha256:80d06b9a… is what the registry returns today for both main and sha-7c0dac9. 7c0dac9 is the merge commit of test-token-service PR 12 (merged 2026-11-30). In that source, config/config.go reads TOKEN_SERVICE_METRICS_PORT (default 0, off) and main.go serves /metrics, so the annotations match the app.
  • The rows in docs/monitoring.md follow the existing assetstransporter-svc rows (listener of its own, in no Service). The version column (main, 7c0dac9) matches the image.

Still open, and only checkable after the merge, as the author says: the target is up under job=\"kubernetes-pods\", both alg series show up, and the public /metrics returns 404.

Review by pixel: task #453, round 1 of 3, commit d168666853.

The change does what #409 asks. I read the diff and the code it depends on, and found nothing that must change. - `argo/scout/test-token-service/deployment.yaml` sets env `TOKEN_SERVICE_METRICS_PORT=9090`. That is not 8080, the main port (`TOKEN_SERVICE_PORT` is not set, so it defaults to 8080). It also adds `containerPort` 9090 named `metrics`, left out of `service.yaml` and the route. The pod-template annotations name the same port, which is what `kubernetes-pods`'s `keep_if_equal` needs (docs/monitoring.md, "Opting an app in to scraping"). - The new digest `sha256:80d06b9a…` is what the registry returns today for both `main` and `sha-7c0dac9`. 7c0dac9 is the merge commit of test-token-service PR 12 (merged 2026-11-30). In that source, `config/config.go` reads `TOKEN_SERVICE_METRICS_PORT` (default 0, off) and `main.go` serves `/metrics`, so the annotations match the app. - The rows in docs/monitoring.md follow the existing `assetstransporter-svc` rows (listener of its own, in no Service). The version column (main, 7c0dac9) matches the image. Still open, and only checkable after the merge, as the author says: the target is up under `job=\"kubernetes-pods\"`, both `alg` series show up, and the public `/metrics` returns 404. Review by pixel: task #453, round 1 of 3, commit d168666853a4b3bac458d10964ae0151cc63c8c9.
sophie merged commit cdc62fe51d into main 2026-11-30 22:23:41 +11:00
Author
Collaborator

Checked after the merge (scout, 2026-11-30 about 11:25 UTC):

  • Application scout-test-token-service is Synced and Healthy; the new pod runs digest sha256:80d06b9a…, ready, 0 restarts, and logs metrics server started addr=:9090 path=/metrics.
  • vmagent's target http://<pod IP>:9090/metrics is up under job="kubernetes-pods", namespace test-token-service; up is 1 in VictoriaMetrics.
  • test_token_service_tokens_issued_total has both series, alg="RS256" and alg="ES384", at 0. All 4 test_token_service_* names are there; the target gives 63 series with the scrape's own.
  • https://test-token-service.m.ac.nz/metrics is still 404 404 page not found; /.well-known/openid-configuration answers 200.
Checked after the merge (scout, 2026-11-30 about 11:25 UTC): - Application `scout-test-token-service` is Synced and Healthy; the new pod runs digest `sha256:80d06b9a…`, ready, 0 restarts, and logs `metrics server started addr=:9090 path=/metrics`. - vmagent's target `http://<pod IP>:9090/metrics` is up under `job="kubernetes-pods"`, namespace `test-token-service`; `up` is 1 in VictoriaMetrics. - `test_token_service_tokens_issued_total` has both series, `alg="RS256"` and `alg="ES384"`, at 0. All 4 `test_token_service_*` names are there; the target gives 63 series with the scrape's own. - `https://test-token-service.m.ac.nz/metrics` is still 404 `404 page not found`; `/.well-known/openid-configuration` answers 200.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
sophie/homelab!263
No description provided.