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

Add force preferred ip protocol #382

Merged
merged 14 commits into from
Dec 7, 2018
Merged

Add force preferred ip protocol #382

merged 14 commits into from
Dec 7, 2018

Conversation

laghoule
Copy link
Contributor

In some case we may want to force a preferred protocol.
I'v added an option (false by default) for that purpose:
[ force_preferred_ip_protocol: <boolean | default = false> ]

@SuperQ
Copy link
Member

SuperQ commented Nov 17, 2018

What about calling this feature ip_protocol? IMO "forced" should be implied, as this is how most utilities do it. (IE curl -(4|6))

@laghoule
Copy link
Contributor Author

preferred_ip_protocol is already existing in blackbox_exporter. The current default is ip6 and fallback to ip4 if there's no IPv6 available.

My patch make it possible to disable the fallback, and force the prefered ip protocol.

@SuperQ
Copy link
Member

SuperQ commented Nov 20, 2018

@laghoule Yes, I understand. What I'm suggesting is we simplify the naming so that we have two options. preferred_ip_protocol, and ip_protocol. In the new option "Forced" is implied, as this is the standard behavior expected by most tools when setting a protocol.

@laghoule
Copy link
Contributor Author

@SuperQ sorry for the misunderstanding. I agree with you. I will make the modification.
Thanks for the feedback.

CONFIGURATION.md Outdated Show resolved Hide resolved
@SuperQ
Copy link
Member

SuperQ commented Nov 21, 2018

I would like to maintain the original behavior, which is to "preferred" mode by default.

Also, with the switch to a bool, preferred doesn't make sense. what about fallback_ip_protocol with a default of true?

@laghoule
Copy link
Contributor Author

Yeah make sense. I will do that.

laghoule and others added 9 commits November 23, 2018 02:08
Signed-off-by: Pascal Gauthier <pgauthier@nihilisme.ca>
Signed-off-by: Pascal Gauthier <laghoule@gmail.com>
Signed-off-by: Pascal Gauthier <pgauthier@nihilisme.ca>
Signed-off-by: Pascal Gauthier <laghoule@gmail.com>
Signed-off-by: Pascal Gauthier <laghoule@gmail.com>
Signed-off-by: Pascal Gauthier <laghoule@gmail.com>
This reverts commit 964bd87.

Signed-off-by: Pascal Gauthier <laghoule@gmail.com>
This reverts commit df88900.

Signed-off-by: Pascal Gauthier <laghoule@gmail.com>
Signed-off-by: Pascal Gauthier <laghoule@gmail.com>
Signed-off-by: Pascal Gauthier <laghoule@gmail.com>
Signed-off-by: Pascal Gauthier <laghoule@gmail.com>
@SuperQ
Copy link
Member

SuperQ commented Nov 23, 2018

Oh, I think there was a misunderstanding. I want to keep ip_protocol, and drop preferred_ip_protocol entirely. This way the exporter will behave more like standard tools, but have fallback by default.

Signed-off-by: Pascal Gauthier <pgauthier@nihilisme.ca>
@laghoule
Copy link
Contributor Author

@SuperQ sorry, I was doing the change after work, my brain was not fully operational ;)
Should be good now.

Copy link
Member

@SuperQ SuperQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

prober/utils.go Outdated
level.Warn(logger).Log("msg", "Resolution with preferred IP protocol failed, attempting fallback protocol", "fallback_protocol", fallbackProtocol, "err", err)
ip, err = net.ResolveIPAddr(fallbackProtocol, target)
if fallbackIPProtocol == false {
level.Error(logger).Log("msg", "Resolution with IP protocol failed (fallback IP protocol is FALSE): err", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fallback_ip_protocol would be easier for users to find, and the FALSE could be false.

CONFIGURATION.md Outdated Show resolved Hide resolved
@brian-brazil
Copy link
Contributor

brian-brazil commented Nov 23, 2018 via email

@SuperQ
Copy link
Member

SuperQ commented Nov 24, 2018

@brian-brazil Yea, works for me. I think adding preferred_ip_protocol as a config alias with a deprecation warning is a good option.

@SuperQ
Copy link
Member

SuperQ commented Nov 28, 2018

@laghoule, do you want to implement the preferred_ip_protocol as an alias for ip_protocol, with a warning that it's deprecated? I think that's the only thing we need for merging.

@laghoule
Copy link
Contributor Author

@SuperQ, yes I will do it. I hope to have some free time this week to work on this.

Signed-off-by: Pascal Gauthier <pgauthier@nihilisme.ca>
Signed-off-by: Pascal Gauthier <pgauthier@nihilisme.ca>
CONFIGURATION.md Outdated
# The preferred IP protocol of the HTTP probe (ip4, ip6).
[ preferred_ip_protocol: <string> | default = "ip6" ]
# The IP protocol of the HTTP probe (ip4, ip6).
[ preferred_ip_protocol: <string> | default = "ip6" *DEPRECATED* ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see why we're deprecating this just to change its name, this would cause unnecessary work for all our existing users.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I never liked the name or behavior of this code. With the new code, it's nolonger exactly "preferred", it's just specifying a specific protocol, and having a fallback or not.

I do not want to go in circles on this review.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's still preferred, and we've already broken this config option before. If we're going to break it again I want to to be due a complete change in how it works, not a minor name change.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not, the new behavior does not represent preferred anymore. With preferred, fallback was always an option. Now fallback is optional, and this necessitates a name change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that adding a new option necessitates breaking existing users.

CONFIGURATION.md Outdated
# The IP protocol of the HTTP probe (ip4, ip6).
[ preferred_ip_protocol: <string> | default = "ip6" *DEPRECATED* ]
[ ip_protocol: <string> | default = "ip6" ]
[ fallback_ip_protocol: <boolean | default = true> ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ip_protocol_fallback would make it clearer that this is a bool, rather than a string.

Copy link
Member

@SuperQ SuperQ Dec 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, posted comment to the wrong spot.

For this one, I agree, ip_protocol_fallback does parse a little better in my head.

What do you think @laghoule?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, it's better visually and conceptually.

Signed-off-by: Pascal Gauthier <pgauthier@nihilisme.ca>
@laghoule
Copy link
Contributor Author

laghoule commented Dec 7, 2018

@brian-brazil @SuperQ Let me know what you want to do about the breaking changes / deprecation issues.

@brian-brazil
Copy link
Contributor

As I said I don't see the point of causing disruption for our existing users for no benefit to them.

@laghoule
Copy link
Contributor Author

laghoule commented Dec 7, 2018

Ok, I will adjust the behavior.

@laghoule
Copy link
Contributor Author

laghoule commented Dec 7, 2018

Is it OK to keep IPProtocol var, but use the preferred_ip_protocol yaml config?

IPProtocol             string                  `yaml:"preferred_ip_protocol,omitempty"`

@brian-brazil
Copy link
Contributor

That's fine.

Signed-off-by: Pascal Gauthier <pgauthier@nihilisme.ca>
@brian-brazil brian-brazil merged commit a75399e into prometheus:master Dec 7, 2018
@brian-brazil
Copy link
Contributor

Thanks!

@brian-brazil
Copy link
Contributor

I was just testing this for release, and the default isn't true as the docs say.

@laghoule
Copy link
Contributor Author

I will take a look at it as soon as possible.

@Daniel15
Copy link

Is there somewhere I can download an alpha build containing this change, or would I need to build blackbox_exporter myself?

@laghoule
Copy link
Contributor Author

laghoule commented Mar 12, 2019 via email

@brian-brazil
Copy link
Contributor

Great!

@laghoule
Copy link
Contributor Author

This MR should fix the issue: #436
Give it a try / review / comments.

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

Successfully merging this pull request may close these issues.

4 participants