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

enable hostname (not only IP Address) on Metrics statsd host key #2429

Conversation

kangaechu
Copy link
Contributor

Closes #2398.

@kangaechu kangaechu requested a review from a team as a code owner August 4, 2022 01:31
@kangaechu kangaechu changed the title enable hostname statsd host key enable hostname (not only IP Address) on Metrics statsd host key Aug 4, 2022
@kangaechu kangaechu marked this pull request as draft August 4, 2022 01:36
@kangaechu kangaechu force-pushed the allow-use-hostname-in-stats-configuration branch from 34c2960 to 96547f8 Compare August 4, 2022 01:54
Comment on lines -125 to -133
{
description: "invalid host",
subject: raw.Metrics{
Statsd: &raw.Statsd{
Host: "127.0.1",
Port: "8125",
},
},
},
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 deleted this test case, because:

"127.0.1" is an invalid IP address, it is also invalid hostname.

In RFC 1034 3.5 Preferred name syntax, a host name is defined as follows:

The labels must follow the rules for ARPANET host names. They must start with a letter, end with a letter or digit, and have as interior characters only letters, digits, and hyphen. There are also some restrictions on the length. Labels must be 63 characters or less.
https://datatracker.ietf.org/doc/html/rfc1034

But the validation library govalidator defines as follows:
https://github.com/asaskevich/govalidator/blob/f21760c49a8d602d863493de796926d2a5c1138d/patterns.go#L33

It allows hostname to start with a digit.

The "127.0.1" test should result in an error, but this requires modifying the govalidator library.
Since it is the govalidator's responsibility to validate the DNSName correctly, atlantis does not perform this test.

@kangaechu
Copy link
Contributor Author

@kangaechu kangaechu marked this pull request as ready for review August 4, 2022 02:21
@kangaechu
Copy link
Contributor Author

#2430 will fix website_link_check error.

@@ -28,7 +28,7 @@ func (s *Statsd) Validate() error {
return validation.ValidateStruct(s,
validation.Field(&s.Host, validation.Required),
validation.Field(&s.Port, validation.Required),
validation.Field(&s.Host, is.IP),
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are you removing the ip? and not just adding the Host

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jamengual Would you review this PR?

@jamengual jamengual added bug Something isn't working waiting-on-review Waiting for a review from a maintainer labels Aug 8, 2022
@kangaechu kangaechu force-pushed the allow-use-hostname-in-stats-configuration branch from 96547f8 to 740405c Compare August 8, 2022 23:15
@jamengual jamengual merged commit 94c81ea into runatlantis:master Aug 26, 2022
@kangaechu
Copy link
Contributor Author

Thank you!

@kangaechu kangaechu deleted the allow-use-hostname-in-stats-configuration branch August 29, 2022 23:59
krrrr38 pushed a commit to krrrr38/atlantis that referenced this pull request Dec 16, 2022
@nitrocode nitrocode added this to the v0.19.9 milestone Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working waiting-on-review Waiting for a review from a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Metrics statsd only takes ip address
3 participants