Add openmetric parser[1]: add type,unit,help parser#710
Closed
jyz0309 wants to merge 3 commits intoprometheus:mainfrom
Closed
Add openmetric parser[1]: add type,unit,help parser#710jyz0309 wants to merge 3 commits intoprometheus:mainfrom
jyz0309 wants to merge 3 commits intoprometheus:mainfrom
Conversation
Signed-off-by: Yi <45495947@qq.com>
ArthurSens
reviewed
Oct 29, 2024
Member
ArthurSens
left a comment
There was a problem hiding this comment.
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
Comment on lines
+217
to
+225
| scenarios := []struct { | ||
| in string | ||
| err string | ||
| }{ | ||
| // 0: | ||
| { | ||
| in: `# TYPE metric counter | ||
| # TYPE metric untyped | ||
| `, |
Member
There was a problem hiding this comment.
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 :)
Author
There was a problem hiding this comment.
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 <45495947@qq.com>
martincostello
added a commit
to martincostello/common
that referenced
this pull request
May 3, 2026
Picking up from prometheus#710 to add an OpenMetrics parser to work towards support for OpenMetrics in promtool. Contributes to prometheus/prometheus#8932. Co-Authored-By: Yi <38248129+jyz0309@users.noreply.github.com> Signed-off-by: martincostello <martin@martincostello.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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