Skip to content

Commit 9bd09a0

Browse files
committed
move modes upwards and add explanation for extremes vs percentiles
1 parent 98c18a8 commit 9bd09a0

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

develop-docs/application-architecture/dynamic-sampling/extrapolation.mdx

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@ What happens during extrapolation, how does one handle this type of data, and wh
1111
- **Accuracy** refers to data being correct. For example, the measured number of spans corresponds to the actual number of spans that were executed. As sample rates decrease, accuracy also goes down, because minor random decisions can influence the result in major ways.
1212
- **Expressiveness** refers to data being able to express something about the state of the observed system. Expressiveness refers to the usefulness of the data for the user in a specific use case.
1313

14-
Data can be any combination of accurate and expressive. To illustrate these properties, let's look at some examples. A single sample with specific tags and a full trace can be very expressive, and a large amount of spans can have very misleading characteristics that are not very expressive. When traffic is low and 100% of data is sampled, the system is fully accurate despite aggregates being affected by inherent statistical uncertainty that reduce expressiveness.
14+
### Modes
15+
Given these properties, there are two modes that can be used to view data in Sentry: default mode and sample mode.
16+
17+
- **Default mode** extrapolates the ingested data as outlined below.
18+
- **Sample mode** does not extrapolate and presents exactly the data that was ingested.
19+
20+
Depending on the context and the use case, one mode may be more useful than the other. Generally, default mode is useful for all queries that aggregate on a dataset of sufficient volume. As absolute sample size decreases below a certain limit, default mode becomes less and less expressive. There are scenarios where the user needs to temporarily switch between modes, for example to examine the aggregate numbers first, and dive into the number of samples for investigation. In both modes, the user may investigate single samples to dig deeper into the details.
1521

1622
### Benefits of Extrapolation
1723
At first glance, extrapolation may seem unnecessarily complicated. However, for high-volume organizations, sampling is a way to control costs and egress volume, as well as reduce the amount of redundant data sent to Sentry. Why don’t we just show the user the data they send? We don’t just extrapolate for fun, it actually has some major benefits to the user:
@@ -28,15 +34,15 @@ Sentry allows the user to aggregate data in different ways - the following aggre
2834

2935
| **Aggregate** | **Can be extrapolated?** |
3036
| --- | --- |
31-
| avg | yes |
32-
| min | no |
3337
| count | yes |
38+
| avg | yes |
3439
| sum | yes |
35-
| max | no |
3640
| percentiles | yes |
41+
| min | no |
42+
| max | no |
3743
| count_unique | no |
3844

39-
Each of these aggregates has their own way of dealing with extrapolation, due to the fact that e.g. counts have to be extrapolated in a slightly different way from percentiles.
45+
Each of these aggregates has their own way of dealing with extrapolation, due to the fact that e.g. counts have to be extrapolated in a slightly different way from percentiles. While `min` and `max` are technically percentiles, we currently do not offer extrapolation due to the decreased stability of extreme aggregates when sampling. For example, the `p50` will also be more stable than the `p99`, the `min` and `max` are just extreme cases.
4046

4147
### Extrapolation for different aggregates
4248
To extrapolate, sampling weights are calculated as `1/sample rate`. The sampling weights of each row are then used in the following ways:
@@ -53,20 +59,9 @@ Example: the query `quantile(0.95)(foo)` becomes `weightedPercentile(0.95)(foo,
5359
As long as there are sufficient samples, the sample rate itself does not matter as much, but due to the extrapolation mechanism, what would be a fluctuation of a few samples, may turn into a much larger absolute impact e.g. in terms of the view count. Of course, when a site gets billions of visits, a fluctation of 100.000 via the noise introduced by a sample rate of 0.00001 is not as critical.
5460

5561
## How to deal with extrapolation in the product?
56-
### **Modes**
57-
58-
There are two modes that can be used to view data in Sentry: default mode and sample mode.
59-
60-
- Default mode extrapolates the ingested data as outlined below.
61-
- Sample mode does not extrapolate and presents exactly the data that was ingested.
62-
63-
Depending on the context and the use case, one mode may be more useful than the other.
64-
65-
Generally, default mode is useful for all queries that aggregate on a dataset of sufficient volume. As absolute sample size decreases below a certain limit, default mode becomes less and less expressive. There are scenarios where the user needs to temporarily switch between modes, for example to examine the aggregate numbers first, and dive into single samples for investigation. Therefore, the extrapolation mode setting should be a transient view option that resets to default mode when the user opens the page the next time.
6662

6763
### General Approach
68-
69-
In new product surfaces, the question of whether or not to use extrapolated vs non-extrapolated data is a delicate one, and it needs to be deliberated with care. In the end, it’s a judgement call on the person implementing the feature, but these questions may be a guide on the way to a decision:
64+
In new product surfaces, the question of whether or not to use extrapolated vs non-extrapolated data is a delicate one, and it needs to be deliberated with care. The extrapolation mode setting should generally be a transient view option that resets to default mode when the user opens the page the next time. In the end, it’s a judgement call on the person implementing the feature, but these questions may be a guide on the way to a decision:
7065

7166
- What should be the default, and how should the switch between modes work?
7267
- In most scenarios, extrapolation should be on by default when looking at aggregates, and off when looking at samples. Switching, in most cases, should be a very conscious operations that users should be aware they are taking, and not an implicit switch that just happens to trigger when users navigate the UI.

0 commit comments

Comments
 (0)