Learn
WebsiteLoginFree Trial
  • Incident Management
    • What is Incident Management? Beginner's Guide
    • Severity Levels
    • How to calculate MTTR and Other Common Incident Recovery Metrics
    • On-Call
    • SLA vs SLO vs SLI: What's The Difference?
    • Data Aggregation and Aggregators
  • DevOps
    • Best DevOps Tools for Each Phase of the DevOps Lifecycle
      • Best DevOps Planning Tools
      • Best DevOps Coding Tools
      • Best DevOps Build Tools
      • Best DevOps Testing Tools
      • Best DevOps Release Tools
      • Best DevOps Deployment Tools
      • Best DevOps Operations Tools
      • Best DevOps Monitroing Tools
    • What is DevOps?
      • Best CI/CD Tools
      • DevOps Infrastructure and Automation
      • What is a DevOps Pipeline?
      • DevOps Vs. Agile
      • Top 25 DevOps Interview Questions
      • What Are the Benefits of DevOps?
      • What is CI/CD?
      • What is a DevOps Engineer?
      • What is DevSecOps?
    • What is Observability?
      • USE and RED Method
    • What is Site Reliability Engineering (SRE)?
      • Four Golden Signals: SRE Monitoring
      • What is A Canary Deployment?
      • What is Blue-Green Deployment?
  • Docker
    • Overview
    • Dockerfile
    • Images
    • Containers
    • Storage
    • Network
    • Compose
    • Swarm
    • Resources
  • prometheus
    • Overview
    • Data Model
    • Metric Types
    • PromQL
      • Series Selection
      • Counter Rates & Increases
    • Pushgateway
    • Alertmanager
    • Remote Storage
Powered by GitBook
On this page
  • Counter Resets
  • Counter Functions
  • Rate
  • iRate
  • Increase

Was this helpful?

  1. prometheus
  2. PromQL

Counter Rates & Increases

Learn how Prometheus handles counter resets with rate, irate, and increase functions.

PreviousSeries SelectionNextPushgateway

Last updated 1 year ago

Was this helpful?

Counter Resets

Counter metrics can reset to zero when a scraped process restarts (e.g., the server is restarted). Counter functions automatically handle counter resets by assuming that any decrease in a counter value was a reset. Internally, these functions compensate for the reset by adding the last sample value before the reset to all sample values after the reset.

Counter Functions

Rate

rate() - "rate of increase" - calculates a per-second increase of a counter as averaged over a specified window.

iRate

irate() - "instantaneous rate of increase" - calculates a per-second increase over the time window, only considering the last 2 points.

irate() is much more responsive than rate(). It is good for high-resolution metrics. It should not be used for alerting conditions.

Increase

increase() - "absolute increase" - calculates the absolute increase over a given time value, including extrapolation.

Logically, only the increase() function includes extrapolation because it measures an absolute increase. rate() and irate() functions calculate a slope (derivative), which will not change even if extrapolation is included.

Prometheus Counter Resets Explained Visually
PromQL: rate() function
PromQL: irate() function
PromQL: increase() function
Prometheus Counter Resets Explained Visually
PromQL: rate() function
PromQL: irate() function
PromQL: increase() function