Skip to content

Add --max-latency to gate on response time budget#284

Open
jongio wants to merge 1 commit into
mainfrom
idea/max-latency
Open

Add --max-latency to gate on response time budget#284
jongio wants to merge 1 commit into
mainfrom
idea/max-latency

Conversation

@jongio

@jongio jongio commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Closes #280

What

Adds --max-latency <duration>, a latency budget gate. After a response finishes, if the total time is over the budget the command exits with code 28 (curl's operation timeout code). The body is still printed, so only the exit code changes.

Unlike --timeout and --max-time, which abort a request mid-flight, this lets the request complete and then reports whether it was too slow. That is what CI performance gates need, and it pairs well with --fail.

Behavior

  • A response slower than the budget exits 28 with the body still printed
  • A response within the budget exits 0
  • An empty value disables the check
  • An invalid duration exits with code 2 before any network call is made

Tests

  • parseMaxLatency table test: empty, valid units, unparseable, zero, negative
  • Execute-level tests: slow response exits 28 (body still written), fast response exits 0, invalid value exits 2 with no request made

Docs

CLI reference gains the --max-latency flag row and exit code 28.

Add a --max-latency <duration> flag that lets a request finish and then
fails with exit code 28 when the total response time is over the budget.
This covers CI performance gates that --timeout and --max-time cannot,
since those abort a request mid-flight instead of measuring it.

The budget is parsed up front, so an invalid value exits with code 2
before any network call is made. The response body is still printed when
the budget is exceeded, so only the exit code changes. An empty value
disables the check.

Co-authored-by: Copilot App <[email protected]>
@jongio jongio added the idea Feature idea from the idea pipeline label Jul 13, 2026
@jongio jongio self-assigned this Jul 13, 2026
github-actions Bot added a commit that referenced this pull request Jul 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Website Preview

Your PR preview is ready!

📎 Preview URL: https://jongio.github.io/azd-rest/pr/284/

This preview will be automatically cleaned up when the PR is closed.

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Test This PR

A preview build (0.5.0-pr284) is ready for testing!

One-Line Install (Recommended)

PowerShell (Windows):

iex "& { $(irm https://raw.githubusercontent.com/jongio/azd-rest/main/scripts/install-pr.ps1) } -PrNumber 284 -Version 0.5.0-pr284"

Bash (macOS/Linux):

curl -fsSL https://raw.githubusercontent.com/jongio/azd-rest/main/scripts/install-pr.sh | bash -s 284 0.5.0-pr284

Uninstall

PowerShell (Windows):

iex "& { $(irm https://raw.githubusercontent.com/jongio/azd-rest/main/scripts/uninstall-pr.ps1) } -PrNumber 284"

Bash (macOS/Linux):

curl -fsSL https://raw.githubusercontent.com/jongio/azd-rest/main/scripts/uninstall-pr.sh | bash -s 284

Build Info:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

idea Feature idea from the idea pipeline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add --max-latency to fail when a request exceeds a time budget

1 participant