For instance I have my standard connection opened by rails, but I also have some models in a different database that are opened by an establish_connection call. They are both sending metrics correctly to the prometheus_exporter, but the second pool metric immediately deletes the first since the key can't distinguish them. The delete is making comparison on :pid, and :hostname. In my case adding a comparison on :metric_labels["pool_name"] is enough to fix this, but not sure if this is adequate for others. Perhaps If :metric_labels["pool_name"] exists and has data it could be added to the comparison on the fly.
For instance I have my standard connection opened by rails, but I also have some models in a different database that are opened by an establish_connection call. They are both sending metrics correctly to the prometheus_exporter, but the second pool metric immediately deletes the first since the key can't distinguish them. The delete is making comparison on :pid, and :hostname. In my case adding a comparison on :metric_labels["pool_name"] is enough to fix this, but not sure if this is adequate for others. Perhaps If :metric_labels["pool_name"] exists and has data it could be added to the comparison on the fly.