Skip to content

Latest commit

 

History

History
46 lines (31 loc) · 1.39 KB

File metadata and controls

46 lines (31 loc) · 1.39 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 the http.server.request.time_in_queue attribute and helps identify server capacity issues. Tracing must be enabled for queue time to be captured.

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