Metrics
What is it?
Metrics are numeric measurements collected over time, like request rate, error count, or latency, used to track a system's health.
Explain like I'm 5
Why was it created?
You can't watch every log line. Metrics were adopted to summarize system behavior as numbers you can chart and alert on.
Where is it used?
- Dashboards
- Alerting
- Capacity planning
- Performance monitoring
Why should developers care?
Metrics power dashboards and alerts, so they're how teams know — at a glance — whether systems are healthy.
How does it work?
Code or infrastructure reports numbers (counters, gauges, timings) at intervals. A metrics system stores them as time series, which you visualize on dashboards and use to trigger alerts when thresholds are crossed.
Real-world example
A dashboard shows requests per second and error rate; when errors exceed 1%, an alert pages the on-call engineer.
Common use cases
- Tracking health and performance
- Triggering alerts
- Spotting trends over time
- Planning capacity
Advantages
- Cheap to store and query
- Great for trends and alerts
- Easy to visualize
- Low overhead
Disadvantages
- Lack detailed context (use logs/traces for that)
- Can't explain root cause alone
- Cardinality (too many labels) gets costly
- Need thoughtful selection
When should you use it?
For continuous health and performance signals you want to chart and alert on.
When should you avoid it?
When you need detailed per-event context — that's what logs and traces are for.
Alternatives
Related terms
Interview questions
Beginner
- What is a metric?
- Give an example of a useful metric.
Intermediate
- What's the difference between a counter and a gauge?
- Why are metrics good for alerting?
Senior
- What is metric cardinality and why does it matter?
- How do metrics, logs, and traces complement each other?
Common misconceptions
- "Metrics tell you why something broke" — they show what and when; logs and traces explain why.
- "Track everything as a metric" — high-cardinality metrics get expensive fast.
Fun facts
- Common metric types are counters, gauges, and histograms.
- Metrics are cheap to store, which is why they're ideal for always-on alerting.
Timeline
- 2010s — Time-series metrics and dashboards become ubiquitous
Learning resources
Quick summary
Metrics are numeric time-series measurements of system health used for dashboards and alerts, showing what's happening and when.
Cheat sheet
- Numeric measurements over time
- Power dashboards + alerts
- Cheap, good for trends
- Lack per-event detail