Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions docs/platforms/ruby/common/configuration/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,20 @@ config.trace_ignore_status_codes = [404, (502..511)]

</SdkOption>

<SdkOption name="capture_queue_time" type="Boolean" defaultValue="true">

Automatically capture how long requests wait in the web server queue before processing begins. The SDK reads the `X-Request-Start` header set by reverse proxies (Nginx, HAProxy, Heroku) and attaches queue time to transactions as `http.server.request.time_in_queue`.

This helps identify when requests are delayed due to insufficient worker threads or server capacity, which is especially useful under load. Learn more about [automatic queue time capture](/tracing/instrumentation/performance-metrics/#automatic-queue-time-capture).

To disable queue time capture:

```ruby
config.capture_queue_time = false
```

</SdkOption>

<SdkOption name="instrumenter" type="Symbol" defaultValue=":sentry">

The instrumenter to use, `:sentry` or `:otel` for [use with OpenTelemetry](../../tracing/instrumentation/opentelemetry).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@ Spans are instrumented for the following operations within a transaction:
- includes common database systems such as Postgres and MySQL
- Outgoing HTTP requests made with `Net::HTTP`
- Redis operations
- Queue time for requests behind reverse proxies (Nginx, HAProxy, Heroku)
- Requires `X-Request-Start` header from reverse proxy

Spans are only created within an existing transaction. If you're not using any of the supported frameworks, you'll need to <PlatformLink to="/tracing/instrumentation/custom-instrumentation/">create transactions manually</PlatformLink>.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Sentry supports adding arbitrary custom units, but we recommend using one of the

<Include name="custom-measurements-units-disclaimer.mdx" />

<PlatformContent includePath="performance/queue-time-capture" />

## Supported Measurement Units

Units augment measurement values by giving meaning to what otherwise might be abstract numbers. Adding units also allows Sentry to offer controls - unit conversions, filters, and so on - based on those units. For values that are unitless, you can supply an empty string or `none`.
Expand Down
50 changes: 50 additions & 0 deletions platform-includes/performance/queue-time-capture/ruby.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
## 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:**

```nginx
location / {
proxy_pass http://your-app;
proxy_set_header X-Request-Start "t=${msec}";
}
```

**HAProxy:**

```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:

```ruby
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).
1 change: 1 addition & 0 deletions src/mdx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ export async function getDevDocsFrontMatterUncached(): Promise<FrontMatter[]> {

const source = await readFile(file, 'utf8');
const {data: frontmatter} = matter(source);

return {
...(frontmatter as FrontMatter),
slug: fileName.replace(/\/index.mdx?$/, '').replace(/\.mdx?$/, ''),
Expand Down
3 changes: 2 additions & 1 deletion src/types/frontmatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ export interface FrontMatter {
* A list of keywords for indexing with search.
*/
keywords?: string[];

/**
* Set this to true to show a "new" badge next to the title in the sidebar
*/
new?: boolean;

/**
* The next page in the bottom pagination navigation.
*/
Expand All @@ -53,6 +53,7 @@ export interface FrontMatter {
* takes precedence over children when present
*/
next_steps?: string[];

/**
* Set this to true to disable indexing (robots, algolia) of this content.
*/
Expand Down
Loading