I have a dashboard in Grafana which shows Prometheus metrics for instances, where "instance" is operation system on physical or virtual server.
Number of instances is changing over time, so there is no "closed list of instances".
Dashboard detects list of instances on the fly with dashboard variable, "type" is "query", definition is label_values(node_uname_info{job="$job"}, instance). It works fine while set of labels for each "instance" in metric "node_uname_info" is unchanged. But if I add new label to metric, this results in "disappearance" of the old instance and "emergence" of a new instance.
- Step 1: add instance "myhostname" as new prometheus target
- Step 2: it appears in dashboard as new instance
{instance="myhostname", job="myjob"} - Step 3: add label "newlabel" to existing prometheus target
- Step 4: it appears in dashboard as new instance
{instance="myhostname", job="myjob", newlabel="value"}(instead of old one) - Step 5: visualizations on dashboard shows metrics for "old" instance from step 2 and "new" instance from step 4 separately (with separate legends, different colors, etc.), because for Grafana these two instances are not the same

How could I change Grafana dashboard settings (I guess - settings related to dashboard variable) to completely ignore all labels, except job and instance, while detecting list of instances on the fly? So changing (or adding or removing) labels, except job and instance, will not cause in changing list of instances?