Prometheus and Grafana to monitor one of my Springboot API on Docker

I was able to setup Prometheus and Grafana to monitor one of my Springboot API. That is working fine as expected when we have a single instance/replica in given target endpoint.

However in our enterprise environment we are running Springboot app as a Docker Swarm service. A docker service has a single endpoint, but there are multiple instances/replicas of applications under a single service. How do we configure prometheus to monitor all replicas since they have only one endpoint.

If I generalize, how does Prometheus monitor all instances of a load balanced endpoint.