Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Right function for a metric that grows steadily

I have a counter cart_transactions_messages_processed_total. Trying to set an alert, if the counter increases continually during/for an hour.

From the documentation, I learnt that, if the counter value drops the counter resets altogether, if so, how to take this into consideration while creating a rule ?

Will this be a right approach – increase(cart_transactions_messages_processed_total[1h]) ?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

increase(cart_transactions_messages_processed_total[1h]) returns increase of your counter over an hour.

Based on your question, I assume you want to fire alert, if counter was increased every minute of some hour. If this is correct, you’ll need something like this:

  - alert: ConstantIncrease
    expr: increase(cart_transactions_messages_processed_total[1m]) > 0
    for: 1h
    labels:
      severity: page
    annotations:
      summary: Counter is constantly increasing

Here, expression increase(cart_transactions_messages_processed_total[1m]) > 0 executed every evaluation_interval, and if it returns result for one hour, alert will be fired.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading