Skip to content

fix(monitoring): warn once on unusable stall sampler reading - #15978

Merged
diegosouzapw merged 4 commits into
cheaper-inference:release/v3.8.52from
maxmad64bis:fix/event-loop-stall-sampler-nan-warn
Oct 18, 2026
Merged

diegosouzapw merged 4 commits into
cheaper-inference:release/v3.8.52from
maxmad64bis:fix/event-loop-stall-sampler-nan-warn

Conversation

@maxmad64bis

@maxmad64bis maxmad64bis commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #15888. Only the last commit is this PR's; I'll rebase once it lands.

⚠️ base-red inherited: #15306

Summary

Stall log lines showed inflight=0 with no warning when the sampler returned an unusable reading, hiding it among real zeros. When the sampler returns NaN or a negative value, the fallback keeps zero but stays silent, while a throwing sampler warns once. Now an unusable reading falls back to zero with the same one-time warning, so a zero from a broken sampler is marked as such.

Related Issues

  • No linked issue — found while reading the event loop stall recorder

Target Branch

  • Base is the active release/v3.8.x branch (the highest open release/v*), not main
  • New feature? From 3.8.55 on it is held with the v4-feature label for the v4 channel

Validation

  • Change type: other
  • Focused tests and category gates from the golden path
  • npm run lint
  • Reconciled with the current active release base; focused checks rerun afterward
  • Production-code changes include a new or updated automated test in this PR

Tests Added Or Updated

  • tests/unit/event-loop-stall.test.ts — new cases for NaN, negative and unbounded sampler readings (each falls back to zero with a single warning) and a healthy reading (count kept, no warning).

Coverage Notes

  • src/lib/healthzLag.ts — covered by tests/unit/event-loop-stall.test.ts.

Reviewer Notes

@maxmad64bis
maxmad64bis force-pushed the fix/event-loop-stall-sampler-nan-warn branch 2 times, most recently from d5c6f0d to 7d997e9 Compare October 8, 2026 21:36
@maxmad64bis
maxmad64bis marked this pull request as ready for review October 8, 2026 22:02
@maxmad64bis
maxmad64bis marked this pull request as draft October 9, 2026 08:58
@maxmad64bis
maxmad64bis marked this pull request as ready for review October 9, 2026 09:28
@maxmad64bis
maxmad64bis marked this pull request as draft October 9, 2026 09:51
@maxmad64bis
maxmad64bis marked this pull request as ready for review October 9, 2026 10:11
@maxmad64bis
maxmad64bis marked this pull request as draft October 9, 2026 17:03
@maxmad64bis
maxmad64bis force-pushed the fix/event-loop-stall-sampler-nan-warn branch from 7d997e9 to 754915d Compare October 9, 2026 18:11
@maxmad64bis
maxmad64bis marked this pull request as ready for review October 9, 2026 18:12
@diegosouzapw

Copy link
Copy Markdown
Collaborator

Hi @maxmad64bis — closing this pull request to clear the open queue. The branch fix/event-loop-stall-sampler-nan-warn is kept, so the commits stay. Comment here if it should be reopened.

@diegosouzapw

Copy link
Copy Markdown
Collaborator

Hi @maxmad64bis — reopening this pull request. The close was a mistake, and it is back in the merge queue. The branch fix/event-loop-stall-sampler-nan-warn was kept.

Long freezes left no trace; a one-second timer now records each stall with its duration on recovery.
@maxmad64bis
maxmad64bis marked this pull request as draft October 16, 2026 16:37
@maxmad64bis
maxmad64bis force-pushed the fix/event-loop-stall-sampler-nan-warn branch from 754915d to 52fcacb Compare October 16, 2026 16:37
NaN or negative readings fell back to 0 silently; each new case fails without the change.
@maxmad64bis
maxmad64bis force-pushed the fix/event-loop-stall-sampler-nan-warn branch from 52fcacb to 468449c Compare October 16, 2026 16:48
@maxmad64bis
maxmad64bis marked this pull request as ready for review October 16, 2026 17:11
# Conflicts:
#	tests/unit/event-loop-stall.test.ts
…er-inference#15888 landed

cheaper-inference#15888 was squash-merged while this branch still carried its commits, so the
merge of the release branch appended a second copy of the stall recorder
functions. Restore the release version of the file and re-apply only this
PR's own change (the one-time warning on an unusable sampler reading).
@diegosouzapw
diegosouzapw merged commit 279bbec into cheaper-inference:release/v3.8.52 Oct 18, 2026
8 checks passed
@maxmad64bis
maxmad64bis deleted the fix/event-loop-stall-sampler-nan-warn branch October 18, 2026 22:37
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.

2 participants