Skip to content

Commit 35acdc3

Browse files
author
Shannon Anahata
committed
adding more extrapolation details to /docs with concept page and updating trace explorere page
1 parent 40a11fc commit 35acdc3

File tree

4 files changed

+103
-1
lines changed

4 files changed

+103
-1
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
title: Extrapolation
3+
sidebar_order: 80
4+
description: "Learn how extrapolation provides accurate metrics from sampled data so you can trust your dashboards and alerts even when you're not capturing every event."
5+
---
6+
7+
When you use [sampling](/concepts/key-terms/sample-rates/) to control the volume of data sent to Sentry, you're only capturing a portion of your app's actual traffic. For example, if you sample 10% of 1000 requests, Sentry receives 100 spans. But how do you easily see the actual traffic and performance metrics for your app?
8+
9+
That's where extrapolation comes in. Sentry automatically uses extrapolation to calculate accurate metrics from your sampled data, giving you a realistic view of your application's behavior without requiring you to capture every single event, or do the math yourself.
10+
11+
## Why Extrapolation Matters
12+
13+
When you sample data, you need a way to understand what the full picture looks like. Extrapolation solves three key problems:
14+
15+
- **See real-world numbers**: View metrics that reflect your actual traffic volume, not just the sampled portion. If you sample 10% of 1000 requests, Sentry shows you metrics for all 1000 requests — no mental math required.
16+
17+
- **Consistent data when sample rates change**: If you adjust your sample rate from 10% to 1%, your graphs and alerts stay stable. Without extrapolation, you'd see a sudden drop in all your metrics that has nothing to do with actual performance changes.
18+
19+
- **Accurate aggregates across different sample rates**: Different parts of your application might have different sample rates. Extrapolation correctly combines data from an endpoint sampled at 1% with another at 100%, giving you accurate percentiles and averages across your entire app.
20+
21+
## How Extrapolation Works
22+
![extrapolation =1000x](./img/extrapolated_data_chart.png)
23+
24+
Every span sent to Sentry includes its sampling rate. Sentry uses this to calculate a **sampling weight** — the number of original spans that each sample represents.
25+
26+
For example:
27+
- At a sampling rate of 10%, the weight is 10
28+
- At a sampling rate of 50%, the weight is 2
29+
- At a sampling rate of 100%, the weight is 1
30+
31+
When you run queries, Sentry uses these weights to give you accurate counts, averages, and percentiles.
32+
33+
### Example
34+
35+
Let's say you query for database spans (`span.op:db`) and Sentry returns 2 sampled spans:
36+
37+
| span_id | span.op | span.duration | sampling_factor | sampling_weight |
38+
| --- | --- | --- | --- | --- |
39+
| a1b2c3 | db | 100ms | 0.1 | 10 |
40+
| d4e5f6 | db | 200ms | 0.5 | 2 |
41+
42+
Even though you only see 2 spans, extrapolation helps Sentry calculate metrics for all the spans they represent:
43+
44+
**Count**: `10 + 2 = 12` estimated spans
45+
46+
**Sum**: `(10 × 100ms) + (2 × 200ms) = 1,400ms`
47+
48+
**Average**: `(100ms × 10 + 200ms × 2) / (10 + 2) = 117ms`
49+
50+
Sentry weights the metrics by the sampling rates so you get accurate results that reflect your application's true performance.
51+
52+
## What Can Be Extrapolated
53+
54+
Most common aggregates can be extrapolated:
55+
56+
| Aggregate | Can be extrapolated? |
57+
| --- | --- |
58+
| count | Yes |
59+
| avg | Yes |
60+
| sum | Yes |
61+
| percentiles (p50, p75, p90, p95, p99) | Yes |
62+
| min | No |
63+
| max | No |
64+
| count_unique | No |
65+
66+
Extreme values like `min` and `max` aren't extrapolated because they're less stable when sampling — a single outlier can have an outsized impact.
67+
68+
## When to Turn Off Extrapolation
69+
70+
While extrapolation is usually helpful, there are times when you'll want to look at the raw sampled data instead:
71+
72+
**Low sample rate and low event volume**: When both are low, extrapolation becomes less reliable. Sentry will show a warning when confidence is low. You can increase your sample rate, widen your time range, or turn off extrapolation to examine actual captured events.
73+
74+
**Debugging specific events**: If you need to investigate a particular user's experience or trace through actual spans, turn off extrapolation to see exactly what was captured.
75+
76+
You can disable extrapolation using the settings icon above charts in tools like Trace Explorer. Note that with extrapolation off, your metrics will only reflect the sampled data, not your full traffic.
77+
78+
<Alert>
79+
If Sentry displays a **low confidence warning**, it means there isn't enough sampled data for reliable extrapolation. Consider increasing your sample rate or widening your query filters.
80+
</Alert>
81+
82+
![Trace Explorer low samples warning =500x](./img/Trace_explorer_low_samples.png)
83+
85.5 KB
Loading
44.3 KB
Loading

docs/product/explore/trace-explorer/index.mdx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,26 @@ If your sampling rate is **too low** for an accurate extrapolation (for example,
205205

206206
Even if you sample your spans, **Trace Explorer's extrapolation gives you reasonably accurate answers** for counts, averages, and percentiles -- without you needing to do anything extra.
207207

208-
Note: In case you want to see unextrapolated aggregates for a query you can disable extrapolation using the settings icon above the chart.
208+
### When to Turn Off Extrapolation
209+
While extrapolation is usually helpful, there are times when you'll want to look at the raw sampled data instead:
210+
211+
**Low sample rate and low event volume**: When both are low, extrapolation becomes less reliable. Sentry will show a warning when confidence is low. You can increase your sample rate, widen your time range, or turn off extrapolation to examine actual captured events.
212+
213+
**Debugging specific events**: If you need to investigate a particular user's experience or trace through actual spans, turn off extrapolation to see exactly what was captured.
214+
215+
You can disable extrapolation using the settings icon above charts in tools like Trace Explorer.
216+
217+
### Controlling Sampling with tracesSampler
218+
219+
While you can set a uniform sampling rate with `tracesSampleRate`, the `tracesSampler` function gives you fine-grained control over sampling decisions. With `tracesSampler`, you can:
220+
221+
- **Apply different sample rates to different transactions**: Sample critical endpoints at 100% while sampling less important ones at a lower rate.
222+
- **Use contextual information**: Make sampling decisions based on transaction name, attributes, or other context like user information or request properties.
223+
- **Filter out unwanted transactions**: Return `0` for transactions you don't want to capture at all.
224+
225+
For example, you might sample your checkout flow at 100% to catch any issues, while sampling your health check endpoint at only 1% to reduce noise. This targeted approach helps you capture the data that matters most while staying within your volume budget.
226+
227+
To configure `tracesSampler` for your SDK, see the tracing options in your SDK's [configuration documentation](/platform-redirect/?next=/configuration/options/).
209228

210229
With these tools, the new Trace Explorer gives you powerful ways to understand your application’s performance, identify bottlenecks, and make informed optimizations.
211230

0 commit comments

Comments
 (0)