title: Prometheus - Compare two labels and keep only one
body: <p>I can obtain a label value os_name from two different metrics called here metric1 and metric2. One metric (metric2) have always a result. The other metric (metric1) is sometime empty but when it is not, it's always the good value.</p>
  
  <pre><code>Example 1 : 
  metric1{os_name=""}
  metric2{os_name="windows2008"}
  
  Example 2 : 
  metric1{os_name="windows2012"}
  metric2{os_name="windows2008"}
  
  Example 3 : 
  metric1{os_name="windows2012"}
  metric2{os_name="windows2012"}
  
  Exemple 4 : 
  metric1{os_name="windows2012"}
  metric2{os_name="centos7"}
  </code></pre>
  
  <p>I would like compare both result and keep the first one if it is not empty.</p>
  
  <p>In example1, result should be os_name="windows2008".</p>
  
  <p>In example2, result should be os_name="windows2012".</p>
  
  <p>In example3, result should be os_name="windows2012".</p>
  
  <p>In example4, result should be os_name="windows2012".</p>
  
  <p>In Python i can do it with an operator or :</p>
  
  <pre><code>&gt;&gt;&gt; metric1 = ""
  
  &gt;&gt;&gt; metric2 = "windows2012"
  
  &gt;&gt;&gt; metric3 = "windows2008"
  
  &gt;&gt;&gt; metric4 = "centos7"
  
  &gt;&gt;&gt; metric1 or metric2
  'windows2012'
  
  &gt;&gt;&gt; metric2 or metric3
  'windows2012'
  
  &gt;&gt;&gt; metric3 or metric4
  'windows2008'
  
  &gt;&gt;&gt; metric4 or metric3
  'centos7'
  </code></pre>
  
  <p>I tried to do an or with prometheus, but it keeps os_name only when metric1 and metric2 have the same value.
  Do you know if it's feasible ?</p>
  
  <p>Thanks for your help</p>
  
  <p>Regards</p>
  
  <p>Alban</p>