diff --git a/prometheus_client/exposition.py b/prometheus_client/exposition.py index 30194dd8..3a47917c 100644 --- a/prometheus_client/exposition.py +++ b/prometheus_client/exposition.py @@ -154,7 +154,7 @@ def _get_best_family(address, port): # binding an ipv6 address is requested. # This function is based on what upstream python did for http.server # in https://github.com/python/cpython/pull/11767 - infos = socket.getaddrinfo(address, port) + infos = socket.getaddrinfo(address, port, type=socket.SOCK_STREAM, flags=socket.AI_PASSIVE) family, _, _, _, sockaddr = next(iter(infos)) return family, sockaddr[0]