Skip to content

[BUG](api): Use /heartbeat path in async client#7215

Open
sanidhyasin wants to merge 1 commit into
chroma-core:mainfrom
sanidhyasin:async-fastapi-heartbeat-path
Open

[BUG](api): Use /heartbeat path in async client#7215
sanidhyasin wants to merge 1 commit into
chroma-core:mainfrom
sanidhyasin:async-fastapi-heartbeat-path

Conversation

@sanidhyasin

Copy link
Copy Markdown

Description of changes

Fixes #6870.

AsyncFastAPI.heartbeat() requested the empty path "" instead of
/heartbeat, so await chromadb.AsyncHttpClient(...).heartbeat() hit the
base API URL rather than the health endpoint. The response there does not
contain the expected "nanosecond heartbeat" field, so the async health
check raised even when the server was healthy. The sync FastAPI client
already uses the correct /heartbeat path.

  • Improvements & Bug fixes
    • AsyncFastAPI.heartbeat() now requests /heartbeat, matching the sync
      client and the server contract.
    • Added the same docstring the sync heartbeat() carries.
  • New functionality
    • None

Test plan

How are these changes tested?

  • Tests pass locally with pytest for python, yarn test for js, cargo test for rust

Added test_async_fastapi_heartbeat_uses_heartbeat_path in
chromadb/test/test_client.py, which asserts that heartbeat() issues a
GET /heartbeat request and parses the nanosecond heartbeat payload.

Migration plan

None required — this is a client-side path correction with no
forwards/backwards compatibility impact.

Observability plan

None required. The existing @trace_method("AsyncFastAPI.heartbeat", ...)
span is unchanged.

Documentation Changes

None required. The added docstring mirrors the sync client; no user-facing
API documentation changes are needed.

AsyncFastAPI.heartbeat() requested the empty path "" instead of
/heartbeat, so async health checks hit the API root and failed to
parse the expected "nanosecond heartbeat" payload even when the
server was up. The sync FastAPI client already uses /heartbeat.

Align the async client with the sync client and the server contract,
and add a regression test.
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

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.

[Bug]: Async HTTP client heartbeat calls the API root instead of /heartbeat

1 participant