What exactly are metrics? Watch this brief video and learn that:
Metrics are continuous measurements of a particular aspect of your system over time. This is in contrast to logs with each log being a discrete data point of a specific event, at a specific point in time.
As metrics are continuous values, they typically are sampled every 30 to 60 seconds to maintain a balance between data volume and data granularity.
Metrics can be used in calculations such as grouping, adding them up or averaging them. Metrics are also very high performance, meaning you can store and query them for very long periods of time. This gives you long-term historical reporting as well as current operational and numerical insight into what is happening in your system.
When defining your metrics it’s important to understand cardinality which is the number of unique values for a particular attribute or dimension within a dataset.
For example, a metric such as an “API request count” can have an attribute like “user IDs” with high cardinality due to the potentially vast number of unique user IDs. On the other hand, an attribute like “response status” which typically includes values like 200, 404, 500, etc., has low cardinality because the number of unique status codes is limited.
High cardinality can impact storage requirements, cost and query performance so it’s important to be aware of it when designing monitoring systems and dashboards to ensure they remain performant and useful.