# Using metric variable in query

**URL:** <https://community.grafana.com/t/using-metric-variable-in-query/46960>\
**Category:** Prometheus\
**Created:** [May 3, 2021, 11:37am UTC](https://community.grafana.com/t/using-metric-variable-in-query/46960 "2021-05-03T11:37:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rokresman](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/rokresman/32/16264_2.png) [@rokresman](https://community.grafana.com/u/rokresman)\
**Post date:** [May 3, 2021, 11:37am UTC](https://community.grafana.com/t/using-metric-variable-in-query/46960/1 "2021-05-03T11:37:03Z")

</div>

Hello,

we have an application exporting different restFull endpoint metrics to prometheus. They are all named with same prefix. For example “restmetrics\_”. Because we do not want to change grafana dashboard for each new endpoint/methods added we would like to automate this.

I have create dashboard that generates variables by using metrics(restmetrics\_) and than created rows for each variable name by using repeat functionality.

Now i want to add new query panel by executing query with variable that for that instance. If i use text panel i can use $some\_variable and variable for that instance is displayed.

How can i now use this in a query for example:

restmetrics\_users\_list{instance=“localhost”}?

Greetings, Rok
