Skip to content

fix: only show enabled backends in /health response#6769

Open
koriyoshi2041 wants to merge 1 commit intotensorzero:mainfrom
koriyoshi2041:fix/health-hide-unused-deps
Open

fix: only show enabled backends in /health response#6769
koriyoshi2041 wants to merge 1 commit intotensorzero:mainfrom
koriyoshi2041:fix/health-hide-unused-deps

Conversation

@koriyoshi2041
Copy link
Copy Markdown

Summary

Resolves #6750. The /health endpoint previously always included all backends (ClickHouse, Postgres, Valkey, Valkey cache) in its response, even when they were disabled. This made the response noisy and potentially confusing for operators.

Changes:

  • Added is_clickhouse_enabled(), is_postgres_enabled(), is_valkey_enabled() helpers that check concrete connection types
  • Changed health_check_inner() to accept concrete types instead of dyn HealthCheckable, enabling compile-time backend state inspection
  • Only includes a backend in the JSON response when it is actually configured
  • Replaced futures::join! with tokio::join! (removes an unnecessary dependency)

Before:

{"gateway": "ok", "clickhouse": "ok", "postgres": "ok", "valkey": "ok", "valkey_cache": "ok"}

After (e.g., only ClickHouse + Postgres configured):

{"gateway": "ok", "clickhouse": "ok", "postgres": "ok"}

Test plan

  • Updated existing tests to use concrete types instead of mocks
  • Added test_health_handler_all_disabled — verifies only "gateway" appears when all backends are disabled
  • cargo check -p tensorzero-core passes

@koriyoshi2041
Copy link
Copy Markdown
Author

I have read the Contributor License Agreement (CLA) and hereby sign the CLA.

Copy link
Copy Markdown
Member

these tests will fail.

@shuyangli shuyangli assigned koriyoshi2041 and unassigned shuyangli Mar 6, 2026
@koriyoshi2041
Copy link
Copy Markdown
Author

Could you clarify which tests you expect to fail? The unit tests in endpoints::status::tests all pass locally (4/4):

test endpoints::status::tests::test_health_handler_all_disabled ... ok
test endpoints::status::tests::should_report_error_for_unhealthy_postgres ... ok
test endpoints::status::tests::test_health_handler_all_enabled_and_healthy ... ok
test endpoints::status::tests::should_report_error_for_unhealthy_clickhouse ... ok

Are you referring to specific E2E tests that assert on the health response format? Happy to update those as well.

@shuyangli
Copy link
Copy Markdown
Member

I thought we had e2e tests that assert on the full shape of the response but it should be fine.

/check-fork

…ensorzero#6750)

The /health endpoint previously always included all backends (ClickHouse,
Postgres, Valkey, Valkey cache) in its response regardless of whether
they were actually configured. This changes the health check to only
include a backend in the response when it is enabled, keeping the
response focused on the services that are actually in use.
@koriyoshi2041 koriyoshi2041 force-pushed the fix/health-hide-unused-deps branch from 273935f to 9081251 Compare March 17, 2026 07:06
@shuyangli shuyangli closed this Mar 17, 2026
@shuyangli shuyangli reopened this Mar 17, 2026
@shuyangli
Copy link
Copy Markdown
Member

/check-fork

@github-actions
Copy link
Copy Markdown
Contributor

🚀 General Checks workflow triggered on new branch external-contributor/pr-6769!

View the run: https://github.com/tensorzero/tensorzero/actions/runs/23214904673

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.

Hide unused dependencies from /health

2 participants