<p>I'm running Prometheus in a kubernetes cluster. All is running find and my UI pods are counting visitors. </p>

<p><a href="https://i.stack.imgur.com/Eb8l4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Eb8l4.png" alt="enter image description here"></a></p>

<p>Please ignore the title, what you see here is the query at the bottom of the image. It's a counter. The gaps in the graph are due to pods restarting. I have two pods running simultaneously!</p>

<p>Now suppose I would like to count the total of visitors, so I need to sum over all the pods</p>

<p><a href="https://i.stack.imgur.com/FA5qY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FA5qY.png" alt="enter image description here"></a></p>

<p>This is what I expect considering the first image, right?</p>

<p>However, I don't want the graph to drop when a pod restarts. I would like to have something cumulative over a specified amount of time (somehow ignoring pods restarting). Hope this makes any sense. Any suggestions?</p>

<p><strong>UPDATE</strong></p>

<p>Below is suggested to do the following</p>

<p><a href="https://i.stack.imgur.com/H1u52.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/H1u52.png" alt="enter image description here"></a></p>

<p>Its a bit hard to see because I've plotted everything there, but the suggested answer <code>sum(rate(NumberOfVisitors[1h])) * 3600</code> is the continues green line there. What I don't understand now is the value of 3 it has? Also why does the value increase after 21:55, because I can see some values before that. </p>

<p>As the approach seems to be ok, I noticed that the actual increase is actually 3, going from 1 to 4. In the graph below I've used just one time series to reduce noise</p>

<p><a href="https://i.stack.imgur.com/DZrmm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DZrmm.png" alt="enter image description here"></a></p>

Jeanluca Scaljeri
<p>Rate, then sum, then multiply by the time range in seconds. That will handle rollovers on counters too.</p>
