Just want to follow up with some more information..
For selecting dynamically {__name__=~".+"} will get all of your metrics.
sum by(__name__) ({__name__=~".+"})
will get just their names without extra label/redundancy cruft.
Additionally, to enable the filtering the original poster seems to desire I think he will need multiple Grafana Template Variables. Each template variable with grab the individual values for the respective keys.
The chart would then be like metric_name{templated_var_a_key="$templated_var_a"}
If you want to use the Multiple select and Select All functionality then change the query to
metric_name{templated_var_a_key=~"$templated_var_a"}
The only change needed is to switch the operator to use RegExp. Grafana will automatically pass your multiple selected values as regexp compatible, e.g. "selectA|selectB". If you have too many records for All to cram them in you can specify it to use .* instead which will do about the same for most cases.
Lastly Grafana also has a metric function, described on this page:
docs.grafana.org/features/datasources/prometheus/#templated-queries