# Rename metrics to contain label names

**URL:** <https://discuss.prometheus.io/t/rename-metrics-to-contain-label-names/465>\
**Category:** General Help/Support\
**Created:** [August 18, 2021, 3:05pm UTC](https://discuss.prometheus.io/t/rename-metrics-to-contain-label-names/465 "2021-08-18T15:05:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hpc](https://avatars.discourse-cdn.com/v4/letter/h/71c47a/32.png) [@hpc](https://discuss.prometheus.io/u/hpc)\
**Post date:** [August 18, 2021, 3:05pm UTC](https://discuss.prometheus.io/t/rename-metrics-to-contain-label-names/465/1 "2021-08-18T15:05:09Z")

</div>

Hi, is there any way to change a metric like

metric\_name{instance"=“hostname:port”,“type”=“thismetrictype”} value

into eg.

metric\_name\_thismetrictype{“instance”=“hostname:port”} value

(well, the “type=thismetrictype” can of course also remain in the label section, it does not have to be removed there).

We do use relabel\_configs for some of our metrics, but this obviously is only able to change the labels, not the metric names. Any other was to do this?

Cheers, Olaf

---

<div class="post-metadata">

**Author:** ![SuperQ](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.prometheus.io/superq/32/4_2.png) [@SuperQ](https://discuss.prometheus.io/u/SuperQ)\
**Post date:** [August 22, 2021, 12:01pm UTC](https://discuss.prometheus.io/t/rename-metrics-to-contain-label-names/465/2 "2021-08-22T12:01:12Z")

</div>

You can use `target_label: __name__ ` when doing `metric_relabel_configs` to change the metric name.
