title: Adding multiple instant vectors together
body: <p>I am trying to add a group of gauges to a vector() while still keeping their time series data in Prometheus. </p>
  
  <p><strong>For example:</strong> 1 day worth of data</p>
  
  <p><code>Vector(10) = 10.0</code> all day</p>
  
  <p><code>Gauge1 = 0.1 (0100 - 1800, else = no data)</code></p>
  
  <p><code>Gauge2 = 0.2 (0200 - 1900, else = no data)</code></p>
  
  <p><code>Gauge3 = 0.3 (0300 - 2000, else = no data)</code></p>
  
  <p><code>Gauge4 = 0.4 (0400 - 2100, else = no data)</code></p>
  
  <p><strong>My goal is to get the values:</strong></p>
  
  <pre><code>10.0 (0000 - 0100)
  
  10.1 (0100 - 0200)
  
  10.3 (0200 - 0300)
  
  10.6 (0300 - 0400)
  
  11.0 (0400 - 1800)
  
  10.9 (1800 - 1900)
  
  10.7 (1900 - 2000)
  
  10.4 (2000 - 2100)
  
  10.0 (2100 - 0000)
  </code></pre>
  
  <p>I have tried working with <code>or</code>, <code>and</code>, and <code>unless</code>, however, it gets very complicated the more gauges you have. I am also using <code>ignoring</code> so that the gauges are able to be summed together.</p>
  
  <p>Is there an easy way I can accomplish this? All I want to do is add the gauge to the static vector if there is data. </p>
  
  <p>Edit:</p>
  
  <p>For more detail on my specific case. I have gauges that show values in <code>seconds</code> (since a job finished). I filter for where the values are less than <code>300</code> (since the jobs are updated every <code>5 minutes</code>). I then take the <code>hour() + min() - secondsSinceEnd()</code> to get the <code>hour</code> and <code>minute</code> the job ended. I take the <code>minimum_over_time()</code> for the whole day since it runs once per day. This results in a new value starting at the time the job finished. I compare this result to the expected end time to get the difference. </p>
  
  <p>I want to add all these differences up and combine them with the expected end time of all the jobs. </p>
  
  <p>Example:</p>
  
  <p><code>vector(12) + min_over_time((hour(timestamp(0 &lt; JobSecondsSinceEnd{} &lt; 300)) + round((minute(timestamp(0 &lt; JobSecondsSinceEnd{} &lt; 300)) - (0 &lt; JobSecondsSinceEnd{} &lt; 300)/60))/60)[24h:15s])</code></p>