<p>Is there a way to convert the output of the <code>rate</code> function in Prometheus to a whole number?</p>
<p>I'm trying to get the total number of pod restarts over a specified timeframe and although this query produces output, I get the result in decimals which isn't what I need.</p>
<pre><code>rate(kube_pod_container_status_restarts_total{namespace=~&quot;jenkins&quot;}[10h]) * 60 * 5 &gt; 0
</code></pre>
<p>What I get back is <code>0.21761280931586605</code> but I'd rather get a whole number.</p>
<p>I'm just not sure what function to use.</p>

Hammed
<p>You can use the following functions to round a decimal number:</p>
<ul>
<li>round = Rounds to the nearest integer.</li>
<li>ceil = Rounds UP to the nearest integer.</li>
<li>floor = Rounds DOWN to the nearest integer.</li>
</ul>
<p>See more details about the &quot;round&quot; function in the Prometheus documentation <a href="https://prometheus.io/docs/prometheus/latest/querying/functions/#round" rel="nofollow noreferrer">here</a>.</p>
<p>In your case, you're using &quot;rate&quot; so you get the number of restarts per second * 60 * 5. Which is the same as the number of restarts every 5 minutes.</p>
<p>But, if you want to count the number of restarts (and not calculate the rate of restarts), maybe you should use the &quot;increase&quot; function instead.</p>
<p>See more details about the &quot;increase&quot; function in the Prometheus documentation <a href="https://prometheus.io/docs/prometheus/latest/querying/functions/#increase" rel="nofollow noreferrer">here</a>.</p>
