The Ruby SDK automatically captures queue time for Rack-based applications when the X-Request-Start header is present. This measures how long requests wait in the web server queue (e.g., waiting for a Puma thread) before your application begins processing them.
Queue time is attached to transactions as the http.server.request.time_in_queue attribute and helps identify server capacity issues. Tracing must be enabled for queue time to be captured.
Configure your reverse proxy to add the X-Request-Start header:
Nginx:
location / {
proxy_pass http://your-app;
proxy_set_header X-Request-Start "t=${msec}";
}HAProxy:
frontend http-in
http-request set-header X-Request-Start t=%Ts%msHeroku: The header is automatically set by Heroku's router.
The SDK:
- Reads the
X-Request-Startheader timestamp from your reverse proxy - Calculates the time difference between the header timestamp and when the request reaches your application
- Subtracts
puma.request_body_wait(if present) to exclude time spent waiting for slow client uploads - Attaches the result as
http.server.request.time_in_queueto the transaction
If you don't want queue time captured, disable it in your configuration:
Sentry.init do |config|
config.capture_queue_time = false
end