Repository navigation
Dashboard: let functions declare an expected duration - #65
Merged
Merged
Conversation
Long-running actions (a chat turn, a work-queue job, a workflow step) were flagged as slow on the dashboard overview even when working as intended. Function builders now take an optional `expectedMs`; admin metrics carry it and the overview only flags calls slower than that. Work-queue actions and workflow action steps default to one hour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…expectedMs
The dashboard compared a histogram p95 with expectedMs. The histogram stopped
at about 74 s, so a larger expectedMs could never be passed, and a bucket's top
edge could read up to 41% high and flag a function that was within budget.
The call log now counts the runs above each function's threshold and reports
it as slow when more than 5% are. The histogram reaches about 3.5 days.
- expectedMs: Infinity turns the warning off; the work-queue and workflow
runners use it instead of a one-hour value.
- httpAction(handler, { expectedMs }) and tool({ expectedMs }) are supported.
- The server warns at startup when expectedMs is above the time limit.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
A function can now say how long a call normally takes, with
expectedMs. The dashboard then lists it as slow only when its p95 is above that, instead of above the fixed default (1 s for a query or mutation, 10 s for an action, 5 s for an HTTP route).expectedMssits next toargson queries, mutations and actions.httpAction(handler, { expectedMs }), a new optional second argument (also on component HTTP actions).tool({ expectedMs, ... }).expectedMs: Infinityturns the warning off. The work-queue and workflow runners use it, because they last as long as the function they run, which has its own metrics.expectedMsis above its time limit, since such a call is stopped before it could count as slow.How slowness is decided
The call log now counts, per function, the runs that took longer than its threshold, and reports
slowwhen more than 5% did. That is the same as "the p95 is above the threshold", but exact.The first commit compared the histogram's p95 with
expectedMs. That had two problems, both fixed by the second commit:expectedMs(the documented 3-minute example) could never be passed.The histogram now reaches about 3.5 days, so the displayed p95 is no longer capped. The default thresholds moved from the dashboard to
src/engine/calllog.ts.For the reviewer
expectedMs, the warning takes up to an hour to fully reflect the new value.>=comparison with the default thresholds became>.src/dashboard/bundle.generated.tsis rebuilt.Testing
bun run typecheckpasses.bun test: 587 pass, 0 fail. New tests intests/admin.test.tscover a 10-minute call against a 3-minuteexpectedMs, the one-in-twenty boundary,Infinity, and validation.🤖 Generated with Claude Code