Skip to content

Add dedicated /ready endpoint#4445

Draft
MartinquaXD wants to merge 3 commits into
mainfrom
dedicated-ready-endpoint
Draft

Add dedicated /ready endpoint#4445
MartinquaXD wants to merge 3 commits into
mainfrom
dedicated-ready-endpoint

Conversation

@MartinquaXD
Copy link
Copy Markdown
Contributor

Description

Currently we are getting a few alerts complaining about high p95 latency on the /auction endpoint. This endpoint is quite heavy because it returns the full auction. Additionally we are currently using it for a readiness probe so it gets queried every 5s.
It makes sense to phase out this endpoint entirely as it's no longer needed (driver forwards auctions fast enough, shadow competition can be updated to read the data from the DB directly).

Changes

As a first migration step this PR introduces a new /ready endpoint which only fetches the most recently used auction id. To stay mostly consistent with the current /auction endpoint while being a lot more lighweight.

How to test

Adjusted the existing e2e test to use this new readiness probe in the setup step.

@MartinquaXD MartinquaXD requested a review from a team as a code owner May 26, 2026 13:05
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new /api/v1/ready readiness endpoint that checks database connectivity by querying the last used auction ID. However, the implementation incorrectly replaces the existing /api/v1/version endpoint in the E2E test setup. This causes the get_api_version helper to query the readiness endpoint instead, which will break tests expecting the version string. The reviewer recommends keeping both endpoint constants and restoring the version endpoint for the version helper.

pub const AUCTION_ENDPOINT: &str = "/api/v1/auction";
pub const TRADES_ENDPOINT: &str = "/api/v1/trades";
pub const VERSION_ENDPOINT: &str = "/api/v1/version";
pub const READY_ENDPOINT: &str = "/api/v1/ready";
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.

high

The /api/v1/version endpoint is still active in the router, so VERSION_ENDPOINT should not be replaced. Keep both VERSION_ENDPOINT and READY_ENDPOINT constants.

Suggested change
pub const READY_ENDPOINT: &str = "/api/v1/ready";
pub const VERSION_ENDPOINT: &str = "/api/v1/version";
pub const READY_ENDPOINT: &str = "/api/v1/ready";

Comment thread crates/e2e/src/setup/services.rs Outdated
let response = self
.http
.get(format!("{API_HOST}{VERSION_ENDPOINT}"))
.get(format!("{API_HOST}{READY_ENDPOINT}"))
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.

high

The get_api_version helper is intended to retrieve the API version string from /api/v1/version. Changing this to READY_ENDPOINT will cause it to query /api/v1/ready (which returns an empty body), breaking the helper's functionality and any tests asserting on the version string.

Suggested change
.get(format!("{API_HOST}{READY_ENDPOINT}"))
.get(format!("{API_HOST}{VERSION_ENDPOINT}"))

@MartinquaXD MartinquaXD marked this pull request as draft May 26, 2026 13:08
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