title: Prometheus: how to get label_value() in query
body: <p>So I have 2 metrics, I need to get label values from first metric and then query over 2nd metric, where {param=&quot;label_values_from_1st_metric&quot;}.
  For ex:</p>
  <h2><code>metric_1{instance=&quot;abc&quot;}</code> - returns 3 timeseries:</h2>
  <p><code>metric_1{name=&quot;my-service&quot;, env=&quot;production&quot;, host=&quot;example-0.org&quot;}</code></p>
  <p><code>metric_1{name=&quot;my-service&quot;, env=&quot;production&quot;, host=&quot;example-1.org&quot;}</code></p>
  <p><code>metric_1{name=&quot;my-service&quot;, env=&quot;production&quot;, host=&quot;example-2.org&quot;}</code></p>
  <h3>Next I need to make query over 2nd metric using <em>host</em> values from 1st query.</h3>
  <p><code>metric_2{domain=&quot;exmple-0,1,2.org&quot;}</code></p>
  <p>So the question is, how I can pass label_values to 2nd query? As far as I understand, I can use label_values() only for variables in grafana panel, so I can't write one query that will do that for me.</p>