I've try yo measure DNS latency in my docker-compose/kubernetes cluster.
setInterval(() => {
console.time('dns-test');
dns.lookup('http://my-service', (_, addresses, __) => {
console.log('addresses:', addresses);
console.timeEnd('dns-test');
});
}, 5000);
But get addresses: undefined
, any ideas?
CodePudding user response:
...dns.lookup('http://my-service'...
The lookup function (with example usage) takes the first parameter as the host name that you want to lookup, eg. google.com. You should remove "http://" from the name you passed in.