title: Dynamic label values in Promethues alerting rules
body: <p>I am a bit of a novice with the monitoring world. Here is my question.</p>
  
  <p>I want to fire an alert only for a set of assets based on asset-id.</p>
  
  <p>My metrics looks like the below.</p>
  
  <pre><code>test_value{asset_id="123"} 0.215
  </code></pre>
  
  <p>My alert manager rules looks like the below. </p>
  
  <pre><code>name: iot_rules
    rules:
    - alert: threshhold_alert
      expr: test_value &gt;= 4
      #for: 1m
      labels:
        severity: critical      
        probableCause: Communication failure
      annotations:      
        summary: 'Error detected on {{$labels.assset_id}}'
  </code></pre>
  
  <p>I get the templating feature on the annotation. However, my promQL expression does not allow me to template. Basically, i am looking for writing a expression as below.</p>
  
  <p>expr: test_value{asset_id=$1} >= 4.</p>
  
  <p>The value for $1 will come from elsewhere (list of assets). </p>
  
  <p>Is this a possibility? I don't want to hard code the asset-id in the expression and there by creating same rule for each asset. Basically the assets-id are unknown at the development time and I don't want my customer to create the rules.</p>