We are using Docker Swarm Service Discovery to find Prometheus targets. With help of an old post we managed to overwrite the port of the discovered targets when we add a prometheus-port label to the service (
).
Our problem is Traefik, the image exposes two ports (80, 443), but not the Prometheus port 8082. I can overwrite the port with a label now, but service discovery created two targets for Prometheus already.
Is it possible to use relabelling to remove a target that is discovered twice, make the targets unique/distinct? First dockerswarm_sd_configs delivers the two targets with same host and different port, after the port relabel step both targets have the same __address__.
The log is filling up fast with messages stating "skipping duplicate scrape target with identical labels", I would like to avoid that by just removing the duplicate scrape targets.