Skip to content

fix(service): serve the Service counters through the stop - #7885

Merged
dan-petty merged 2 commits into
mainfrom
fix/4876-service-metrics-grace
Nov 30, 2026
Merged

dan-petty merged 2 commits into
mainfrom
fix/4876-service-metrics-grace

Conversation

@dan-petty

@dan-petty dan-petty commented Nov 30, 2026 •

Copy link
Copy Markdown
Owner

uvicorn closes port 8000 on SIGTERM before the Service drains its rounds, so Prometheus read no count of the drain. The Service now serves GLOBAL_METRICS from a prometheus-client server on port 8001, which stays up until the process exits. After the drain and the return of the Lease, the stop waits 60 s, one scrape interval. The grace period goes from 660 s to 720 s. The Deployment scrapes port 8001, and the NetworkPolicy admits TCP 8001 from monitoring in place of TCP 8000. The homelab egress rule for port 8001 is merged: dan-petty/homelab#422 admits TCP 8001 to the roadmap-service pods, and it is the change that the issue dan-petty/homelab#282 tracked.

Closes #4876

Change: openspec/changes/archive/2026-11-30-4876-service-metrics-grace/

@dan-petty dan-petty added type/bug Type bug: the code does not do what it must scope/service The long-running devops Service and its lanes labels Nov 30, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Fail-to-pass evidence: uv run devops ci fail-to-pass --base origin/main reports that tests.server.test_server and tests.server.test_service_metrics_server error on the base (collection failure: the new constants and start_metrics_server do not exist there) and pass on the head.

Local runs on the head: uv run devops ci test on the 7 touched test files (149 passed) and on the changed source files (582 passed); uv run devops ci --check --only lint,format,constructs,swallowed-failures,deps,uv-check,domain,k8s,docs passed; uv run devops openspec check passed; mypy on the changed modules passed.

@dan-petty
dan-petty marked this pull request as ready for review November 30, 2026 15:10
@dan-petty
dan-petty enabled auto-merge (squash) November 30, 2026 16:03
uvicorn closes port 8000 on SIGTERM before the drain, so each count of the
drain was lost. The Service now serves GLOBAL_METRICS from a
prometheus-client server on port 8001 until the process exits, and waits
one scrape interval after the drain. The grace period goes to 720 s.

Refs #4876
@dan-petty
dan-petty force-pushed the fix/4876-service-metrics-grace branch from b976967 to a13ad42 Compare November 30, 2026 16:10
@dan-petty
dan-petty marked this pull request as draft November 30, 2026 16:11
auto-merge was automatically disabled November 30, 2026 16:11

Pull request was converted to draft

@dan-petty
dan-petty marked this pull request as ready for review November 30, 2026 16:20
@dan-petty
dan-petty merged commit a318e64 into main Nov 30, 2026
40 checks passed
@dan-petty
dan-petty deleted the fix/4876-service-metrics-grace branch November 30, 2026 16:23
dan-petty-release Bot added a commit that referenced this pull request Nov 30, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.263.0](v0.262.0...v0.263.0)
(2026-11-30)


### Features

* **k8s:** check control-plane volumes avoid the k3s root disk
([#7895](#7895))
([ccf34ac](ccf34ac)),
closes [#3985](#3985)


### Bug Fixes

* **deps:** update dan-petty/devtools Docker tag to v1.6.0
([#7897](#7897))
([9c95596](9c95596))
* **service:** serve the Service counters through the stop
([#7885](#7885))
([a318e64](a318e64))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/service The long-running devops Service and its lanes type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(service): keep the counts that the Service makes while it stops

1 participant