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 rule files support #10

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Add rule files support #10

wants to merge 6 commits into from

Conversation

loafoe
Copy link
Contributor

@loafoe loafoe commented Sep 1, 2021

No description provided.

Copy link
Contributor

@artemgavrilov artemgavrilov left a comment

Choose a reason for hiding this comment

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

go.mod Show resolved Hide resolved
rules/groups.go Outdated Show resolved Hide resolved
rules/groups_test.go Outdated Show resolved Hide resolved
rules/groups.go Outdated Show resolved Hide resolved
rules/groups_test.go Outdated Show resolved Hide resolved
rules/groups.go Outdated Show resolved Hide resolved
rules/groups_test.go Outdated Show resolved Hide resolved
- Rename test package
- Use `yaml.v3`
- Rename file
- USe `Rule` instead of `RuleNode`
Copy link
Contributor

@artemgavrilov artemgavrilov left a comment

Choose a reason for hiding this comment

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

LGTM except the comment. 👍

It will be nice to have more tests, probably we can copy them from https://github.com/prometheus/prometheus/blob/main/pkg/rulefmt/rulefmt_test.go
But I can do it myself later.

rules/rules.go Outdated Show resolved Hide resolved
Co-authored-by: Artem Gavrilov <charlieblackwood7@gmail.com>
Comment on lines -120 to +123
func (d *Duration) UnmarshalYAML(unmarshal func(interface{}) error) error {
var s string
if err := unmarshal(&s); err != nil {
return err
}
dur, err := ParseDuration(s)
func (d *Duration) UnmarshalYAML(node *yaml.Node) error {
dur, err := ParseDuration(node.Value)
Copy link
Contributor

Choose a reason for hiding this comment

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

Damn, I was wrong! Sorry, but can you please revert this change and use yaml.v2 everywhere?

Copy link
Contributor

@artemgavrilov artemgavrilov left a comment

Choose a reason for hiding this comment

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

Please rollback to yaml.v2, I was wrong regarding it. Also we updated CI in main branch, so it makes sense to rebase this branch.

@loafoe ^

@BupycHuk BupycHuk removed their request for review August 2, 2022 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants