Ruby on Rails and queue time

Fly exposes the header X-Request-Start (μs since epoch, e.g. t=<μsec>), which is the time the request was accepted by the edge server. So the delta might be small (~20ms) or not (~200ms) depending on the user and app regions.

This might be a problem for Rails applications, as X-Request-Start is a well-known header in the Rails world. It is used to measure queue time–a key metric for auto-scaling and measuring service pressure. Many libraries (New Relic, Datadog, Lograge, Prometheus Exporter, etc.) expect it to be the time the request was dispatched from the router to the application (last hop), so it measures the time spent waiting for an available backend thread to accept the request. The delta is in the order of few milliseconds (~1ms~5ms), so it’s not possible to derive it from Fly’s X-Request-Start.

Please consider exposing the queue time as X-Queue-Start. I understand it’s not possible to change X-Request-Start as it would be a breaking change, but this is the most important metric after response times.

1 Like