On prometheus integration, would it be possible to add labels to the metrics

I use the prometheus integration extensively and works great. The only shortcoming I found is the inability to differentiate, label or tag metrics.

I have solved this issue so far by setting up a strict naming convention for devices and entities so then I can filter them properly on prometheus, although I found some edge cases where it’s hard to differentiate or cumbersome to add them to a “filter” with hardcoded names.

With the recent addition of labels for devices and entities I had the idea that it could be used in prometheus integration. Also Areas could be useful as well and zones (I am not suer about use cases for metrics with zones)

My idea is to add extra labels to the metrics optionally, like set a flag in the config “add_labels_data” “add_areas_data” or “add_zones_data”.

This way we can easy filter the entities and devices in prometheus or grafana dashboards.

I know most of the metrics can be seen in the home assistant UI, but grafana visualizations are richer when you want more detailed data. Plus I only care about that data, so don’t want to clutter HA and keep it minimalistic for my non tech family.

I can offer to work on the integration, I have extensive prometheus extensive and python, however I don’t know where to start to find how to filter the devices areas, labels and zones. If anyone can give me a kickstart how to contribute and find what I asked I will happily add the feature to the integration

I did find a place where to set extra_labels here core/homeassistant/components/prometheus/__init__.py at 60bdc13c9448e60ea257e7281ed4e78ac0f96d4b · home-assistant/core · GitHub, However it seems an older workaround when the labels functionality didn’t exist.
I will keep digging, but i would be super nice to add labels form the devices themselves automagically