Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prometheus sizer breaks when hostname is an ipv6 address #96

Open
csnook opened this issue Aug 7, 2018 · 0 comments
Open

prometheus sizer breaks when hostname is an ipv6 address #96

csnook opened this issue Aug 7, 2018 · 0 comments

Comments

@csnook
Copy link

csnook commented Aug 7, 2018

The prometheus sizer renders the prometheus url with this string interpolation:

url = 'http://{}:{}{}'.format(hostname, port, path)

Unfortunately, in the case where hostname is an ipv6 address, this causes the port number to be interpreted as part of the ipv6 address, causing connections to fail. The fix requires adding square brackets around the hostname when it's an ipv6 address.

I'm still working on the most graceful way to implement the fix. Pulling in an ipv6 address validating library would probably be an unnecessary dependency. Adding brackets around the hostname unconditionally isn't expected to work in general, but it might for urlopen. Adding brackets whenever the hostname has a colon in it should suffice, but could break cases where someone uses username:password@hostname as the hostname for HTTP basic auth. Adding brackets whenever the hostname has two colons in it should work fine (all ipv6 addresses have at least two colons), and I can't think of a downside, but I need to test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant