<p>I've try yo measure DNS latency in my docker-compose/kubernetes cluster.</p>
<pre><code>  setInterval(() =&gt; {
    console.time('dns-test');

    dns.lookup('http://my-service', (_, addresses, __) =&gt; {
      console.log('addresses:', addresses);
      console.timeEnd('dns-test');
    });
  }, 5000);
</code></pre>
<p>But get <code>addresses: undefined</code>, any ideas?</p>

Ballon Ura
<p><code>...dns.lookup('http://my-service'...</code></p>
<p>The <a href="https://nodejs.org/api/dns.html#dnslookuphostname-options-callback" rel="nofollow noreferrer">lookup</a> function (with example usage) takes the first parameter as the host name that you want to lookup, eg. google.com. You should remove &quot;http://&quot; from the name you passed in.</p>
