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.
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.
Full Sentry SDK setup for PHP. Use when asked to "add Sentry to PHP", "install sentry/sentry", "setup Sentry in PHP", or configure error monitoring, tracing, profiling, logging, metrics, crons, or AI monitoring for PHP applications. Supports plain PHP, Laravel, and Symfony.
Set up Prometheus for comprehensive metric collection, storage, and monitoring of infrastructure and applications. Use when implementing metrics collection, setting up monitoring infrastructure, or configuring alerting systems.
Define and implement Service Level Indicators (SLIs) and Service Level Objectives (SLOs) with error budgets and alerting. Use when establishing reliability targets, implementing SRE practices, or measuring service performance.