I'm getting metrics from Prometheus. One of the metrics that indicates stability is transactions. By default it only has total count of transactions (50,55,70, and so on). So I have a chart that shows me a difference between counts (increase(total_transaction[1m])). That's how I can be sure that transactions keep going, and if difference is zero, then it means that it stuck and something is wrong.

So I want to calculate this stability in percents, same as usually uptime is calculated. In my case if program is running but transaction won't go it's equal to downtime. So any idea how from the total count I can calculate percentage of aliveness.
Example: Total transactions is constantly increasing for 5 minutes, but then for 10 seconds it stuck and not increasing and showing same value. Meaning 10/300 = 3% downtime and 97% uptime the result I want to get.
Any suggestions?