DELAPARRA
Index
Color
NL
Category: Observability

counter

Explained by Updated

What is counter?

counter: A metric that only ever increases (or resets to zero on restart). You take its rate() to get a per-second value. A counter is a metric that only goes up, such as the total number of requests, errors or emails sent. It resets to zero only when the process restarts.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about counter

How is counter used in practice?

The raw number is rarely interesting. What you want is how fast it grows. In Prometheus, rate(http_requests_total[5m]) turns a counter into requests per second, averaged over five minutes, and handles restarts correctly.

What should you keep in mind with counter?

Use counters for things that happen, and gauges for values that go up and down, such as memory use or queue length. Name counters with a _total suffix, as is the convention. Errors are best tracked as a counter with a status label. Dividing the error rate by the request rate then gives an error percentage that is easy to alert on.

What does an example of counter look like?

rate(http_requests_total[5m])

At a glance

CategoryObservability
Explained by
Updated

More Observability terms

All terms starting with C

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.