I'm very new to using Prometheus metrics and I've been asked to write an alert based on whether a value has increased by a 10% over the last five minutes.
To be more concise, I've to report when my Kafka topic deadletters count increases by 10% within 5 minutes.
I can count the current deadletters on the topic/sub using this query:
count by(topic) (kafka_burrow_topic_partition_offset{topic=~".+__deadletter__.+my-subscription-name.+"})
What I now need to do is get the same number from 5 mins ago and then calculate the percentage increase from then and now:
Percentage Increase = [ (Final Value - Starting Value) / |Starting Value| ] × 100
Can anyone give me a steer on how to calculate the percentage difference?
I've seen examples like this but cant get it to work for me:
(sum by(topic) (increase(kafka_burrow_topic_partition_offset{topic=~".+__deadletter__.+"}[5m])) > 0)