Skip to content

Commit 411ca22

Browse files
dingsdaxgetsantry[bot]coolguyzoneclaude
authored
feat: queue time metric (#16030)
<!-- Use this checklist to make sure your PR is ready for merge. You may delete any sections you don't need. --> ## DESCRIBE YOUR PR docs for Ruby queue-time capture getsentry/sentry-ruby#2838 ## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs to go live. - [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE --> - [ ] Other deadline: <!-- ENTER DATE HERE --> - [x] None: Not urgent, can wait up to 1 week+ ## SLA - Teamwork makes the dream work, so please add a reviewer to your PRs. - Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it. Thanks in advance for your help! ## PRE-MERGE CHECKLIST *Make sure you've checked the following before merging your changes:* - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs) ## LEGAL BOILERPLATE <!-- Sentry employees and contractors can delete or ignore this section. --> Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms. ## EXTRA RESOURCES - [Sentry Docs contributor guide](https://docs.sentry.io/contributing/) --------- Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com> Co-authored-by: Alex Krawiec <alex.krawiec@sentry.io> Co-authored-by: Claude <noreply@anthropic.com>
1 parent 9db85ef commit 411ca22

5 files changed

Lines changed: 67 additions & 2 deletions

File tree

docs/platforms/ruby/common/configuration/options.mdx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,20 @@ config.trace_ignore_status_codes = [404, (502..511)]
327327

328328
</SdkOption>
329329

330+
<SdkOption name="capture_queue_time" type="Boolean" defaultValue="true">
331+
332+
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`.
333+
334+
This helps identify when requests are delayed due to insufficient worker threads or server capacity, which is especially useful under load. Learn more about <PlatformLink to="/tracing/instrumentation/performance-metrics/#automatic-queue-time-capture">automatic queue time capture</PlatformLink>.
335+
336+
To disable queue time capture:
337+
338+
```ruby
339+
config.capture_queue_time = false
340+
```
341+
342+
</SdkOption>
343+
330344
<SdkOption name="instrumenter" type="Symbol" defaultValue=":sentry">
331345

332346
The instrumenter to use, `:sentry` or `:otel` for [use with OpenTelemetry](../../tracing/instrumentation/opentelemetry).
@@ -467,7 +481,7 @@ end
467481

468482
<SdkOption name="spotlight" type="Boolean | String" defaultValue="false">
469483

470-
Whether to also capture events and traces into [Spotlight](https://spotlightjs.com/setup/other/).
484+
Whether to also capture events and traces into [Spotlight](https://spotlightjs.com/).
471485

472486
If you set this to true, Sentry will send events and traces to the local Sidecar proxy at `http://localhost:8969/stream`.
473487

docs/platforms/ruby/common/tracing/instrumentation/automatic-instrumentation.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@ Spans are instrumented for the following operations within a transaction:
2121
- Outgoing HTTP requests made with `Net::HTTP`
2222
- Redis operations
2323

24+
The SDK also captures **queue time** as transaction data (not a child span) when a `X-Request-Start` header is present from your reverse proxy (Nginx, HAProxy, or Heroku). See <PlatformLink to="/tracing/instrumentation/performance-metrics/#automatic-queue-time-capture">Automatic Queue Time Capture</PlatformLink> for setup instructions.
25+
2426
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>.

docs/platforms/ruby/common/tracing/instrumentation/performance-metrics.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ Sentry supports adding arbitrary custom units, but we recommend using one of the
2222

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

25+
<PlatformContent includePath="performance/queue-time-capture" />
26+
2527
## Supported Measurement Units
2628

2729
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`.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
## Automatic Queue Time Capture
2+
3+
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.
4+
5+
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.
6+
7+
### Setup
8+
9+
Configure your reverse proxy to add the `X-Request-Start` header:
10+
11+
**Nginx:**
12+
13+
```nginx
14+
location / {
15+
proxy_pass http://your-app;
16+
proxy_set_header X-Request-Start "t=${msec}";
17+
}
18+
```
19+
20+
**HAProxy:**
21+
22+
```haproxy
23+
frontend http-in
24+
http-request set-header X-Request-Start t=%Ts%ms
25+
```
26+
27+
**Heroku:** The header is automatically set by Heroku's router.
28+
29+
### How It Works
30+
31+
The SDK:
32+
33+
1. Reads the `X-Request-Start` header timestamp from your reverse proxy
34+
2. Calculates the time difference between the header timestamp and when the request reaches your application
35+
3. Subtracts `puma.request_body_wait` (if present) to exclude time spent waiting for slow client uploads
36+
4. Attaches the result as `http.server.request.time_in_queue` to the transaction
37+
38+
### Disable Queue Time Capture
39+
40+
If you don't want queue time captured, disable it in your configuration:
41+
42+
```ruby
43+
Sentry.init do |config|
44+
config.capture_queue_time = false
45+
end
46+
```

src/types/frontmatter.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ export interface FrontMatter {
3939
* A list of keywords for indexing with search.
4040
*/
4141
keywords?: string[];
42+
4243
/**
4344
* Set this to true to show a "new" badge next to the title in the sidebar
4445
*/
4546
new?: boolean;
46-
4747
/**
4848
* The next page in the bottom pagination navigation.
4949
*/
@@ -53,6 +53,7 @@ export interface FrontMatter {
5353
* takes precedence over children when present
5454
*/
5555
next_steps?: string[];
56+
5657
/**
5758
* Set this to true to disable indexing (robots, algolia) of this content.
5859
*/

0 commit comments

Comments
 (0)