Skip to content

Report /check timings in Server-Timing - #155

Merged
alies-dev merged 1 commit into
masterfrom
feat/check-server-timing
Nov 9, 2026
Merged

alies-dev merged 1 commit into
masterfrom
feat/check-server-timing

Conversation

@alies-dev

Copy link
Copy Markdown
Contributor

Context

Since the playground redesign (#143), /check feels slower. From outside, <?php echo 1; takes 2 to 8 s to answer, while the same request takes about 0.45 s locally, with either the Psalm commit before the deploy or the one now in production. Without server access there is no way to tell whether that time goes to Psalm, to PHP startup, or to waiting before PHP runs at all.

Refs #0

Solution

/check now sends Server-Timing: boot;dur=…, analysis;dur=…, total;dur=… (milliseconds) on successful responses, shown in the DevTools Network tab under Timing:

  • boot: from REQUEST_TIME_FLOAT to the start of the analysis (autoload, input checks)
  • analysis: OnlineChecker::getResults(), or the cached homepage example
  • total: from REQUEST_TIME_FLOAT to just before the body is sent

If the browser's waiting time is much longer than total, the delay happens before PHP starts handling the request (Apache workers, CPU contention, network), not in Psalm.

The header carries only durations: no versions, paths or hostnames. No Timing-Allow-Origin is sent, so other origins cannot read the values. Error responses (400, 418, 422 and exceptions) do not get the header.

Shows in DevTools how much of a slow /check response is PHP startup,
Psalm, or neither (network, server queue).
@alies-dev alies-dev self-assigned this Nov 9, 2026
@alies-dev
alies-dev merged commit 438992f into master Nov 9, 2026
2 checks passed
@alies-dev
alies-dev deleted the feat/check-server-timing branch November 9, 2026 18:40
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