title: Dealing with missing metrices in calculations
body: <p>I use a formula to calculate <em>approx.</em> maximum memory consumption of <em>MySQL</em> instances that (simplified and written in <em>PromQL</em>) reads:</p>
  
  <pre><code>(
      mysql_global_variables_key_buffer_size +
      mysql_global_variables_query_cache_size +
      mysql_global_variables_tmp_table_size +
      mysql_global_variables_innodb_buffer_pool_size +
      mysql_global_variables_innodb_additional_mem_pool_size +
      mysql_global_variables_innodb_log_buffer_size +
      (
          mysql_global_variables_max_connections *
          (
              mysql_global_variables_sort_buffer_size +
              mysql_global_variables_read_buffer_size +
              mysql_global_variables_read_rnd_buffer_size +
              mysql_global_variables_join_buffer_size +
              mysql_global_variables_thread_stack +
              mysql_global_variables_binlog_cache_size
          )
      )
  )
  </code></pre>
  
  <p>Unfortunately the <code>mysql_global_variables_innodb_additional_mem_pool_size</code> metric is not always present for every instance resulting in "no data" if this it is included in the calculation.</p>
  
  <p>There's the <a href="https://prometheus.io/docs/querying/functions/#absent" rel="noreferrer"><code>absent(v instant-vector)</code></a> function that <em>may</em> be used to solve this but I am not sure how.</p>
  
  <p>I would like <em>nonexistent</em> metrices be replaced with a constant (<code>0</code> in this case). Is it possible?</p>
  
  <p>Could you please provide me with some hints on how to deal with missing metrices in calculations in <em>PromQL</em>?</p>