Skip to content

Latest commit

 

History

History
50 lines (33 loc) · 1.49 KB

File metadata and controls

50 lines (33 loc) · 1.49 KB

Automatic Queue Time Capture

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 http.server.request.time_in_queue and helps identify server capacity issues.

Setup

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%ms

Heroku: The header is automatically set by Heroku's router.

How It Works

The SDK:

  1. Reads the X-Request-Start header timestamp from your reverse proxy
  2. Calculates the time difference between the header timestamp and when the request reaches your application
  3. Subtracts puma.request_body_wait (if present) to exclude time spent waiting for slow client uploads
  4. Attaches the result as http.server.request.time_in_queue to the transaction

Disable Queue Time Capture

If you don't want queue time captured, disable it in your configuration:

Sentry.init do |config|
  config.capture_queue_time = false
end

Viewing Queue Time

Queue time appears in the Sentry transaction details under the "Data" section as http.server.request.time_in_queue (measured in milliseconds).