You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/product/metrics/index.mdx
+27-19Lines changed: 27 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,52 +6,60 @@ description: "Sentry's Developer Metrics help you track and visualize the data p
6
6
7
7
<Includename="feature-stage-beta-metrics.mdx" />
8
8
9
-
Sentry metrics are numerical values that allow you to pinpoint and solve issues impacting user experience and app performance by measuring the data points that are important to you and your application. You can track things like latency, processing time, event size, user signups, and conversion rates, and see how they correlate back to tracing data. This gives you better observability, allowing you to gain a comprehensive understanding of the health of your systems and solve issues faster.
9
+
Sentry metrics are numerical values that allow you to pinpoint and solve issues impacting user experience and app performance by measuring the data points that are important to you and your application. You can track things like latency, processing time, event size, user signups, and conversion rates, and see how they correlate back to tracing data. This gives you a comprehensive understanding of the health of your systems and helps solve issues faster.
10
10
11
11

12
12
13
13
## Metric Types
14
14
15
15
Metrics at Sentry come in different flavors, in order to help you track your data in the most efficient and cost-effective way. The metric types we currently support are:
16
16
17
-
-**Counters** track a value that can only be incremented (for example, button clicks).
18
-
-**Distributions** track a list of values that can be aggregated over time, like `max`, `min`, and `avg` (for example, page load times).
19
-
-**Sets** track a set of values on which you can run aggregations over time, such as `count_unique` (for example, the number of unique users).
20
-
-**Gauges** track a value that can go up or down (for example, available disk space and memory used).
21
-
-**Timers** track the execution time for a specific block of code (for example, the time to load a user profile).
17
+
-**Counters:** Tracks a value that can only be incremented (for example, button clicks)
18
+
-**Distributions:** Tracks a list of values which can be aggregated over time like `max`, `min`, `avg` (for example, page load times)
19
+
-**Gauges:** Tracks a value that can go up or down (for example, available disk space, memory used)
20
+
-**Sets:** Tracks a set of values on which can be aggregations over time such as `count_unique` (for example, number of unique users)
22
21
23
22
Each metric also needs to have a unit associated with it, so that you know what you're dealing with. Examples of units are seconds, milliseconds, bytes, or even potatoes if you like.
24
23
25
24
## Augmenting Metrics with Tags
26
25
27
-
Metrics are powerful on their own, but you can enrich them further by adding dimensions in the form of Tags. Tags are key/value string pairs (for example, `cuisine:Italian`) that add contextual information to your metrics. They can also be used to filter and group metrics during analysis.
26
+
Metrics are powerful on their own, but you can enrich them further by adding dimensions in the form of Tags. These are key/value string pairs (for example, `platform:ios`) that are associated with metrics to provide contextual information, and are often used to filter and group them during analysis.
28
27
29
-
By default, Sentry adds some standard tags, such as `transaction`, `environment`, and `release`. You can also create custom tags to track attributes that help organize your data for your specific use case. For example, some useful custom tags are browser name, region, language, and platform.
28
+
Sentry adds certain common tags by default such as,`transaction`, `environment`, and `release`, but you can also create your own custom tags to track attributes that help organize your data for your specific use case. Some common examples of useful tags are browser name, region, language, or customer.
30
29
31
30
## Limits and Restrictions
32
31
33
32
### Cardinality
34
33
35
-
Cardinality, in the context of metrics, refers to how many unique time series your metrics create. The number of time series depends on the combinations of tags that are added to a metric.
34
+
In metrics, "cardinality" refers to the number of unique time series generated by tags associated with a metric. The more tags combinations you create, the higher the cardinality.
36
35
37
-
When dealing with tags, it's important to be wary of cardinality explosion. Here's an example to help you understand what this means.
36
+
For instance, imagine you are tracking daily logins. You create a metric named `login` and add tags like `platform` (with values `ios`, `android`, `web`) to indicate where logins occur. Then you decide to add a new tag called `user_id`, which will have a different value for each user. In metrics, adding a `user_id` tag, which identifies the user logging in, can greatly increase cardinality as user IDs accumulate. Considering that each user might log in from various platforms, this multiplies the number of unique time series needed to analyze the data. For example, with 100,000 user IDs and 3 platform values, you would potentially require 300,000 time series.
38
37
39
-
Suppose you're trying to make dinner plans and want your friends to vote on their preference. Each vote has two properties:
38
+
To manage cardinality, use tags with fixed sets of values. Instead of `user_id`, consider using tags like `country` (with specific country names) to categorize login locations or `user_segment` (e.g. `business`, `internal users`) to segment your login data based on user categories that are meaningful for your analysis. This approach helps limit cardinality and optimizes metric analysis.
40
39
41
-
- Cuisine type: Type of restaurant (for example, Asian, Italian, German).
42
-
- Price: Price range of the restaurant (for example, $, $$, $$).
40
+
<Note>
43
41
44
-
How would you count all the votes by type and price? The simple solution is to create multiple boxes that contain all the votes for each combination of type and price (Italian-$, German-$$). If you have 3 types and 3 prices, the resulting number of boxes you'd need would be 9, which is quite a lot.
42
+
Sentry incorporates protection mechanisms that will drop metrics if their cardinality exceeds an internally defined limit.
45
43
46
-
Now imagine if a friend comes and says, let's also vote on the day of the month, which has 31 values. Now all the combinations go from 3 × 3 = 9 to 3 × 3 × 31 = 279. As you can see, adding multiple properties can quickly become overwhelming. This is what's known as a cardinality explosion.
44
+
</Note>
47
45
48
-
To prevent such an explosion, you should use tags with a low number of distinct values. The end goal is to have a small product of possible tag values.
46
+
### Supported Characters
49
47
50
-
### Tags
48
+
Sentry allows the use of specific characters for the components of a metric:
51
49
52
-
Tag keys have a maximum length of 32 characters and can contain only letters (a-z, A-Z), numbers (0-9), underscores (\_), periods (.), colons (:), and dashes (-).
50
+
-**Metric Name**: Supports all word characters including `_`, `-`, `.`. Any unsupported characters will be replaced by `_`.
53
51
54
-
Tag values have a maximum length of 200 characters and cannot contain the newline (`\n`) character.
52
+
-**Metric Tag Keys**: Supports all word characters including `_`, `-`, `.`, `/`. Any unsupported characters will be removed from the tag key.
53
+
54
+
-**Metric Tag Values**: Supports all Unicode characters.
55
+
56
+
More information about the normalization of unsupported characters can be found [here](https://develop.sentry.dev/sdk/metrics/#normalization).
0 commit comments