metrics-rs / metrics

A metrics ecosystem for Rust.
MIT License
1.08k stars 148 forks source link

Try other resolved addresses if the first one fails #429

Closed vvv closed 8 months ago

vvv commented 8 months ago

Problem: metrics-observer cannot connect to raspberrypi.local:8000 -- "error while connecting".

Analysis:

"raspberrypi.local:8000" gets resolved on my machine to

The IPv6 SocketAddr -- the first item returned by the iterator -- cannot be connected to. The IPv4 address would work, but metrics-observer never tries it.

Solution: if the first item, returned by to_socket_addrs, cannot be connected to, try the next one. Try them all, if necessary.

tobz commented 8 months ago

Nice, this is a good improvement. 👍🏻

tobz commented 8 months ago

Released as metrics-observer@v0.3.0.

Thanks again for your contribution. ❤️