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

Use strict unmarshalling of rules #7767

Merged
merged 3 commits into from
Aug 9, 2020

Conversation

roidelapluie
Copy link
Member

Fix #7042

The problem is not only in promtool. Prometheus successfully load broken files now, which happened to me today. It loaded a rule file with annotation and not annotations.

The previous PR #7142 seems to have a larger scope, let's move on with this one and see what's left in #7142.

Signed-off-by: Julien Pivotto [email protected]

@roidelapluie roidelapluie changed the title Fix unmarshalling of rules Use strict unmarshalling of rules Aug 7, 2020
@brian-brazil
Copy link
Contributor

This seems like a better approach, there's a test failure though.

Signed-off-by: Julien Pivotto <[email protected]>
Copy link
Contributor

@brian-brazil brian-brazil left a comment

Choose a reason for hiding this comment

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

👍

decoder := yaml.NewDecoder(bytes.NewReader(content))
decoder.KnownFields(true)
err := decoder.Decode(&groups)
// Ignore io.EOF which happends with empty input.
Copy link
Contributor

Choose a reason for hiding this comment

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

happens

Signed-off-by: Julien Pivotto <[email protected]>
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.

promtool check rules no longer identifies invalid fields as of 2.16.0
2 participants