Sentry Developer Metrics
In this tutorial, you will learn how to start using the new Metrics project, also known as DDM. You will understand how to collect metrics in our sentry
codebase or via the SDK and how to see them in the new DDM UI. You will also learn some basic information about metrics, and tricks to avoid misusing them.
What Are Metrics
Metrics are numerical values that can track anything about your environment over time, from latency to error rates to user signups. At Sentry, we collect a lot of metrics, as they provide a comprehensive understanding of the health of our systems.
Metric Types
Metrics at Sentry come in different flavors, in order to help you track your data in the most efficient and cost-effective way. The types of metrics we currently support are:
- Counters → they track a value that can only be incremented.
- Distributions → they track a list of values over time in on which you can perform aggregations like
max
,min
,avg
. - Gauges → they track a value that can go up and down.
- Sets → they track a set of values on which you can perform aggregations such as
count_unique
.
Tags and Cardinality
You might have heard the words cardinality explosion when talking about metrics. In this guide, we will try to explain what this seemingly complex term means.
Suppose you are trying to count the votes on your dinner, and each vote has two properties:
- Cuisine Type → type of the restaurant (e.g., Asian, Italian, German).
- Price → price range of the restaurant (e.g. $, $$, $$).
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 the combinations of type and price (e.g., Italian-$, German-$$). If you have 3 types and 3 prices, the resulting number of boxes you need is 9, which is already quite a lot.
Now, a friend comes and says, let's add another property which is the day of the month, which has 31 values. Now all the combinations go from 3 × 3 = 9
to 3 × 3 × 31 = 279
, pretty insane. This is what is known as a cardinality explosion.
To prevent such an explosion, the simple solution is to try and use tags, whose number of distinct values is low. The end goal is to have a small product of the tag values.