Counter
A counter is a metric representing a cumulative quantity that generally increases as occurrences are counted, apart from resets or other explicit reinitialization.
Machine Learning Platform Engineering
A counter is a monotonically nondecreasing metric intended to count occurrences such as requests.
- How it is used
- Counts cumulative application events for Prometheus scraping, Grafana visualization, and operational monitoring.
- How deep it goes
- Defines monotonicity, demonstrates declaration and incrementing, and distinguishes counters from gauges and histograms.
- Examples
- Counts HTTP requests and ranked-movie responses, then visualizes cumulative activity as Grafana time series.
- What you can do after
- Apply it via prometheus-client by defining a Counter, incrementing events, exposing /metrics, and charting activity.
Read how Machine Learning Platform Engineering explains counter →
Learn Docker in a Month of Lunches, Second Edition
A counter is a metric that increases over time and represents a cumulative count of events.
- How it is used
- Records cumulative application events for Prometheus collection and operational dashboards.
- How deep it goes
- Explains the definition, declaration, increment operation, endpoint inspection, and dashboard query, but not advanced metric types.
- Examples
- Demonstrates access requests, HTTP 200 responses, Node.js instrumentation, repeated requests, and Grafana dashboard queries.
- What you can do after
- Apply it via a Prometheus client library, expose metrics, generate traffic, and visualize cumulative events in Grafana.
Read how Learn Docker in a Month of Lunches, Second Edition explains counter →
Cloud Observability in Action
A counter is a metric type whose value represents a quantity that generally increases over time, apart from resets.
- How it is used
- Tracks cumulative event occurrences and supports calculating event counts over selected time ranges.
- How deep it goes
- Explains monotonic values, point-in-time totals, range differences, labels, and cardinality risks.
- Examples
- Uses HTTP invocation totals, status-code series, 400 responses, and Prometheus API request labels.
- What you can do after
- Evaluate cumulative totals and calculate event counts across time ranges using labeled time series.
Quarkus in Action
A counter is a metric that records a value intended to increase monotonically as occurrences are counted.
- How it is used
- Counts business events in Quarkus applications alongside automatically collected framework metrics.
- How deep it goes
- Defines counter semantics and demonstrates annotation, registry, metadata, exposure, and visualization, without detailing storage internals.
- Examples
- Uses orders and car registrations, @Counted methods, MeterRegistry calls, /q/metrics output, and Grafana dashboards.
- What you can do after
- Build it from scratch with @Counted or MeterRegistry, then expose and inspect it through Prometheus-compatible metrics.
Related concepts
- performancekind of · Performance is the measurable effectiveness or operational behavior of a system under specified conditions, assessed through relevant qualities such as task results, speed, responsiveness, throughput, or resource use.
- metrickind of · A metric is a quantitative measure used to characterize or assess a property, condition, behavior, performance, or outcome.
- @Countedproduced by · @Counted is a Micrometer annotation that declares counting of invocations of an annotated method.
- MeterRegistryuses · MeterRegistry is Micrometer’s central component for registering, retrieving, and managing meters such as counters, timers, and gauges.
- least frequently useduses · Least frequently used is a cache-eviction policy that removes the entry with the lowest access frequency when capacity is exhausted.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.



