feat: queue time capture for Rack by dingsdax · Pull Request #2838 · getsentry/sentry-ruby
added 3 commits
January 15, 2026 09:41
dingsdax
marked this pull request as ready for review
Non-numeric t= values like "t=invalid" or "t=" were silently converted to 0.0 by Ruby's String#to_f, resulting in a Unix epoch timestamp and a queue time of ~56 years instead of nil. Apply the same numeric regex guard already used for raw timestamps to the t= branch before calling to_f. Co-Authored-By: Claude <noreply@anthropic.com>
parse_request_start_header returned nil for headers that arrived with leading/trailing whitespace or as comma-separated values (multiple header occurrences collapsed by a proxy). Strip whitespace from the token and split on commas, taking the first (earliest) timestamp. Co-Authored-By: Claude <noreply@anthropic.com>
When env["puma.request_body_wait"] is a String (e.g. serialized by
middleware), the `> 0` comparison raised ArgumentError, which was
silently swallowed by the broad rescue, causing queue time to be
dropped even with a valid X-Request-Start header.
Call to_f on String values before the comparison. Numeric strings
("40") convert correctly; non-numeric strings ("N/A") become 0.0
and are treated as absent, so total_time_ms is returned unchanged.
Co-Authored-By: Claude <noreply@anthropic.com>
dingsdax added a commit to getsentry/sentry-conventions that referenced this pull request
Feb 24, 2026Adds the `http.server.request.time_in_queue` semantic convention attribute to capture the time (in milliseconds) a request spent waiting in the server queue before processing began. This attribute is populated from the `X-Request-Start` header set by reverse proxies (Nginx, HAProxy, Heroku router, etc.) and first introduced in sentry-ruby: getsentry/sentry-ruby#2838 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
dingsdax added a commit to getsentry/sentry-conventions that referenced this pull request
Feb 25, 2026* feat(http): add http.server.request.time_in_queue attribute Adds the `http.server.request.time_in_queue` semantic convention attribute to capture the time (in milliseconds) a request spent waiting in the server queue before processing began. This attribute is populated from the `X-Request-Start` header set by reverse proxies (Nginx, HAProxy, Heroku router, etc.) and first introduced in sentry-ruby: getsentry/sentry-ruby#2838 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(http): add generated attribute definitions for http.server.request.time_in_queue Generate TypeScript and Python attribute definitions including type exports, metadata entries, and TypedDict annotations. Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
dingsdax added a commit that referenced this pull request
Mar 2, 2026The Rails CaptureExceptions middleware subclass overrode start_transaction without calling super, so the http.server.request.time_in_queue attachment added in #2838 was silently skipped for all Rails apps. Extract queue time attachment into a private attach_queue_time method on the Rack base class so the Rails subclass can invoke it explicitly while keeping its own options hash (preserving the correct SPAN_ORIGIN constant "auto.http.rails" via lexical scoping). Fixes #2873 Co-Authored-By: Claude <noreply@anthropic.com>
dingsdax added a commit that referenced this pull request
Mar 2, 2026The Rails CaptureExceptions middleware subclass overrode start_transaction without calling super, so the http.server.request.time_in_queue attachment added in #2838 was silently skipped for all Rails apps. Extract queue time attachment into a private attach_queue_time method on the Rack base class so the Rails subclass can invoke it explicitly while keeping its own options hash (preserving the correct SPAN_ORIGIN constant "auto.http.rails" via lexical scoping). Fixes #2873 Co-Authored-By: Claude <noreply@anthropic.com>
dingsdax added a commit that referenced this pull request
Mar 2, 2026The Rails CaptureExceptions middleware subclass overrode start_transaction without calling super, so the http.server.request.time_in_queue attachment added in #2838 was silently skipped for all Rails apps. Extract queue time attachment into a private attach_queue_time method on the Rack base class so the Rails subclass can invoke it explicitly while keeping its own options hash (preserving the correct SPAN_ORIGIN constant "auto.http.rails" via lexical scoping). Fixes #2873 Co-authored-by: Claude <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