Skip to content

Add metrics-server healthcheck - #871

Merged
i386 merged 1 commit into
Mesh-LLM:mainfrom
i386:codex/metrics-server-health
Jun 18, 2026
Merged

Add metrics-server healthcheck#871
i386 merged 1 commit into
Mesh-LLM:mainfrom
i386:codex/metrics-server-health

Conversation

@i386

@i386 i386 commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a process-level HTTP healthcheck for metrics-server at GET /health, returning 200 OK with {"status":"ok"}. This gives deploy and orchestration tooling a simple URL to verify that the metrics-server HTTP listener is alive without touching run lifecycle or OTLP ingest APIs.

Changes

  • Adds the health HTTP handler.
  • Wires GET /health into the metrics-server Axum router.
  • Adds a focused unit test for the handler.
  • Documents the healthcheck URL in the metrics-server README.

Validation

  • cargo fmt --all -- --check
  • cargo check -p metrics-server
  • cargo test -p metrics-server --lib
  • cargo clippy -p metrics-server --all-targets -- -D warnings
  • cargo build -p metrics-server
  • Live smoke: GET http://127.0.0.1:18080/health returned {"status":"ok"}

Summary by CodeRabbit

  • New Features

    • Added HTTP health-check endpoint (/health) that returns JSON status confirmation. Enables external monitoring systems and orchestration platforms to verify service availability and operational readiness.
  • Documentation

    • Updated README documentation to describe the health-check endpoint, including sample curl command demonstrating usage.

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a GET /health endpoint to the metrics-server crate. A new health async handler in api.rs returns {"status":"ok"} as JSON. The route is registered on the Axum router in server.rs. A unit test verifies the handler returns HTTP 200, and the README is updated with the endpoint description and a curl example.

Changes

Health endpoint for metrics-server

Layer / File(s) Summary
Health handler and route wiring
crates/metrics-server/src/api.rs, crates/metrics-server/src/server.rs
Adds pub(crate) async fn health() -> Json<Value> returning {"status":"ok"}, imports it in server.rs, and registers GET /health on the Axum router in serve_http.
Unit test and README docs
crates/metrics-server/src/lib.rs, crates/metrics-server/README.md
Adds health_endpoint_reports_ok tokio test asserting StatusCode::OK; updates test imports; adds /health bullet to the Responsibilities list and a sample curl invocation.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add metrics-server healthcheck' accurately summarizes the main change: adding a health check endpoint to the metrics-server.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@i386 i386 changed the title [codex] Add metrics-server healthcheck Add metrics-server healthcheck Jun 18, 2026
@i386
i386 marked this pull request as ready for review June 18, 2026 05:51

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/metrics-server/src/lib.rs`:
- Around line 141-145: The test function health_endpoint_reports_ok currently
only validates the HTTP status code but does not verify the response body
structure. Add an assertion to extract the response body and validate that it
contains the expected JSON payload with the status field set to "ok". This will
ensure the endpoint contract is fully tested and will catch any future changes
to the response body structure, not just the status code.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: aa0fd27c-321f-4d0f-af57-477a44960d03

📥 Commits

Reviewing files that changed from the base of the PR and between 9b961c0 and 891f629.

📒 Files selected for processing (4)
  • crates/metrics-server/README.md
  • crates/metrics-server/src/api.rs
  • crates/metrics-server/src/lib.rs
  • crates/metrics-server/src/server.rs

Comment on lines +141 to +145
#[tokio::test]
async fn health_endpoint_reports_ok() {
let response = health().await.into_response();
assert_eq!(response.status(), StatusCode::OK);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Assert the health response body contract, not only status.

This test passes even if the payload stops returning {"status":"ok"}. Add a body assertion to lock the endpoint contract.

Suggested test hardening
     #[tokio::test]
     async fn health_endpoint_reports_ok() {
         let response = health().await.into_response();
         assert_eq!(response.status(), StatusCode::OK);
+        let body = axum::body::to_bytes(response.into_body(), usize::MAX)
+            .await
+            .unwrap();
+        assert_eq!(body.as_ref(), br#"{"status":"ok"}"#);
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/metrics-server/src/lib.rs` around lines 141 - 145, The test function
health_endpoint_reports_ok currently only validates the HTTP status code but
does not verify the response body structure. Add an assertion to extract the
response body and validate that it contains the expected JSON payload with the
status field set to "ok". This will ensure the endpoint contract is fully tested
and will catch any future changes to the response body structure, not just the
status code.

@i386
i386 merged commit 10bc0e0 into Mesh-LLM:main Jun 18, 2026
28 of 41 checks passed
@github-actions
github-actions Bot requested a review from michaelneale June 18, 2026 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant