-
Notifications
You must be signed in to change notification settings - Fork 321
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 openmetric parser[1]: add type,unit,help parser #710
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Yi <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work here! I can see that this is basically a copy of the current text parser alongside its tests, but I think we can improve things a bit.
Comments are mostly around test readability
scenarios := []struct { | ||
in string | ||
err string | ||
}{ | ||
// 0: | ||
{ | ||
in: `# TYPE metric counter | ||
# TYPE metric untyped | ||
`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do the same here! Adding name
to the scenarios and then using t.Run should provide more context about what each scenario is about :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
has a little confusing about this, because now there's benchmark for the test, so the arg in test function is testing.TB, and arg required by t.Run is *testing.T(t.Run(name string, f func(t *testing.T))
), the testing.TB has not implement the interface
Signed-off-by: Yi <[email protected]>
Ref: prometheus/prometheus#8932
Part of #669
Add openmetrics protocol decoder, for promtool to support check openmetric protocol.
This pr just parse the HELP, TYPE, UNIT as the comment suggest