title: Prometheus query to average over time by a specific label
body: <p>I need to query a metric and find out the average value of the metric over a period of 24hrs. But using using <code>avg_over_time</code> directly on the metric won't work. There is a specific <code>ipaddr</code> label. The average has to be grouped by each <code>ipaddr</code>. Now, grouping is not allowed in <code>avg_over_time</code>. In such case, how can I find out the average of the metric over 24 hrs for each <code>ipaddr</code>?</p>
  <p>The metric and its values are like this</p>
  <pre><code>K_utilization{ifName=&quot;Ds12:1/0/30&quot;,ipaddr=&quot;10.1.109.54&quot;,node=&quot;worker&quot;}  3.5
  K_utilization{ifName=&quot;Ds65:1/0/4&quot;,ipaddr=&quot;10.1.5.50&quot;,node=&quot;worker&quot;} 13.2
  K_utilization{ifName=&quot;Ds26:1/0/8&quot;,ipaddr=&quot;10.1.123.58&quot;,node=&quot;worker&quot;}   3.2
  K_utilization{ifName=&quot;Ds69:0/0/10&quot;,ipaddr=&quot;10.1.115.55&quot;,node=&quot;worker&quot;}  6.2
  K_utilization{ifName=&quot;Ds71:0/0/21&quot;,ipaddr=&quot;10.1.25.51&quot;,node=&quot;worker&quot;}   13.5
  </code></pre>