discourse / prometheus_exporter

A framework for collecting and aggregating prometheus metrics
MIT License
532 stars 154 forks source link

Delete routine is not specific enough for multiple pools in the same pid #138

Open vicomte opened 3 years ago

vicomte commented 3 years ago

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.