Repository navigation
fix: Parse x-request-start in seconds, ms, µs, and ns - #124
Merged
Merged
Conversation
Stripping non-digits and assuming milliseconds made Render nanoseconds and extra-precision NGINX timestamps report 0 queue time.
adamlogic
marked this pull request as ready for review
September 17, 2026 11:34
Merged
adamlogic
pushed a commit
that referenced
this pull request
Sep 17, 2026
🤖 I have created a release *beep* *boop* --- <details><summary>judoscale-bull: 2.1.5</summary> ## [2.1.5](judoscale-bull-v2.1.4...judoscale-bull-v2.1.5) (2026-09-17) ### Bug Fixes * Attach Redis error listeners on Bull and BullMQ collectors ([#121](#121)) ([0d682ae](0d682ae)) ### Dependencies * The following workspace dependencies were updated * dependencies * judoscale-node-core bumped from 2.5.4 to 2.5.5 </details> <details><summary>judoscale-bullmq: 2.2.5</summary> ## [2.2.5](judoscale-bullmq-v2.2.4...judoscale-bullmq-v2.2.5) (2026-09-17) ### Bug Fixes * Attach Redis error listeners on Bull and BullMQ collectors ([#121](#121)) ([0d682ae](0d682ae)) ### Dependencies * The following workspace dependencies were updated * dependencies * judoscale-node-core bumped from 2.5.4 to 2.5.5 </details> <details><summary>judoscale-express: 2.3.5</summary> ## [2.3.5](judoscale-express-v2.3.4...judoscale-express-v2.3.5) (2026-09-17) ### Dependencies * The following workspace dependencies were updated * dependencies * judoscale-node-core bumped from 2.5.4 to 2.5.5 </details> <details><summary>judoscale-fastify: 2.4.5</summary> ## [2.4.5](judoscale-fastify-v2.4.4...judoscale-fastify-v2.4.5) (2026-09-17) ### Dependencies * The following workspace dependencies were updated * dependencies * judoscale-node-core bumped from 2.5.4 to 2.5.5 </details> <details><summary>judoscale-nextjs: 2.0.2</summary> ## [2.0.2](judoscale-nextjs-v2.0.1...judoscale-nextjs-v2.0.2) (2026-09-17) ### Dependencies * The following workspace dependencies were updated * dependencies * judoscale-node-core bumped from 2.5.4 to 2.5.5 </details> <details><summary>judoscale-node-core: 2.5.5</summary> ## [2.5.5](judoscale-node-core-v2.5.4...judoscale-node-core-v2.5.5) (2026-09-17) ### Bug Fixes * Parse x-request-start in seconds, ms, µs, and ns ([#124](#124)) ([e53715c](e53715c)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.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.
Summary
queueTimeFromHeaderstreated everyx-request-startvalue as whole milliseconds after stripping non-digits. Platforms that send fractional seconds with extra precision (NGINX) or whole nanoseconds (Render) reported0orNaNqueue time, so queue-time autoscaling silently no-op'd.This brings the Node parser in line with
judoscale-rubyso those header variants produce a real queue time. Fixes #123.Design decisions
Unit detection uses the same year-2000 magnitude cutoffs as the Ruby adapter, rather than inferring units from digit count or decimal places. That keeps both adapters agreeing on the same header, including
t=prefixes and 2–6 decimal fractional seconds.Note
Medium Risk
Changes queue-time calculation used by Express/Fastify/Next autoscaling metrics; behavior shifts for non-millisecond headers but is intended to fix silent misreporting rather than alter Heroku-ms paths.
Overview
Fixes
x-request-startparsing so request queue time is computed correctly across Heroku, NGINX, and Render-style headers instead of often returning0orNaN.queueTimeFromHeadersno longer strips non-digits and assumes milliseconds. It addsstartedAtMs, which parses numeric values (includingt=prefixes and fractional seconds), infers seconds vs ms/µs/ns using year-2000 magnitude cutoffs aligned with the Ruby adapter, and returns roundedMath.max(0, now - startedAt).Tests cover NGINX fractional precision (2–6 decimals), microsecond, and nanosecond header values.
Reviewed by Cursor Bugbot for commit d882544. Bugbot is set up for automated code reviews on this repo. Configure here.