<p>I have a kubernetes cluster running many apps. 1 pod per 1 namespace is considered an app. only 1 pod (the app pod) runs per namespace. an example looks like this:</p>
<pre><code>(Note that id&lt;x&gt; is a complete random string, so id1 it's not what an id looks like)
namespace: app-id1, only-pod-running-in-this-namespace: app-id1   
namespace: app-id2, only-pod-running-in-this-namespace: app-id2   
namespace: app-id3, only-pod-running-in-this-namespace: app-id3  
namespace: app-id4, only-pod-running-in-this-namespace: app-id4   
</code></pre>
<p>The list goes on and on.
I am trying to get the uptime for each app, by checking the pod status. In prometheus, I am doing it like this:</p>
<pre><code>kube_pod_status_ready{condition=&quot;true&quot;, namespace=~&quot;app-.*&quot;, pod=~&quot;app-.*&quot;}
</code></pre>
<p>this returns a table with all existing apps (each record is 1 app status), and their uptime value (1 if the pod is up, 0 is the pod is down).</p>
<p>Now I want to create another metric, that returns the average for <em><strong>all</strong></em> apps combined. This is, I want only 1 record returned with the average for all apps. So, let's say I have 100 apps, then if 1 went down for 5 min, I want that 5 min window to show 99 (or 0.99 actually) as a result, instead of 99 apps showing 1, and 1 app showing 0.
I hope that make sense.
This is how I am trying, but it's not working, as it's returning a table with 1 record per app.</p>
<pre><code>avg_over_time(kube_pod_status_ready{condition=&quot;true&quot;, namespace=~&quot;app-.*&quot;, pod=~&quot;app-.*&quot;}[5m])
</code></pre>

Simon Ernesto Cardenas Zarate
<p>My understanding is you want all your app instances' up percent? is <code>kube_pod_status_ready{condition=&quot;true&quot;, namespace=~&quot;app-.*&quot;, pod=~&quot;app-.*&quot;}</code> return <code>1</code> when up and <code>0</code> when down?If so,may be a <code>sum(kube_pod_status_ready{condition=&quot;true&quot;, namespace=~&quot;app-.*&quot;, pod=~&quot;app-.*&quot;}) / count(kube_pod_status_ready{condition=&quot;true&quot;, namespace=~&quot;app-.*&quot;, pod=~&quot;app-.*&quot;})</code> can do?</p>
