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

Parse text openmetrics format to MetricFamilies #312

Closed
wants to merge 2 commits into from

Conversation

ide-rea
Copy link

@ide-rea ide-rea commented Jun 18, 2021

This PR is for prometheus/prometheus#8932. My solution about this issue is divided into two steps.

  1. Use the openMetricsParser located in https://github.com/prometheus/prometheus/tree/main/pkg/textparse to parse the text exchange format into the MetricFamily map . this step is implemented in this PR.
  2. Use https://github.com/prometheus/client_golang/blob/master/prometheus/testutil/promlint/promlint.go promlint to check the metric foramt. If the first step is correct, i'll fastly plan to implement this.

My concern is that, firstly as the openMetricsParser is located in github.com/prometheus/prometheus/ , there may be some hidden circular import problem, although i have tested it works. Secondly, I may be totally wrong about the right direction for solving this issue. i'm very happy to hear from any advices:)!

Signed-off-by: Xiaoyu Zhang [email protected]

@roidelapluie
Copy link
Member

The two parsers should not be identical. The one in prometheus is a very optimized parser, made for scrape. It does not collect all the edge cases.

The parser in this repo is for validation and should be less permissive and catch all the issues.

@ide-rea
Copy link
Author

ide-rea commented Jun 18, 2021

Firstly, thanks @roidelapluie , but I have one more questions to ask. Does the parser may only supported limited openmetrics feature like https://github.com/prometheus/common/blob/main/expfmt/openmetrics_create.go right now, how do you think that?

@roidelapluie
Copy link
Member

@ide-rea ide-rea closed this Aug 8, 2021
@ide-rea ide-rea deleted the parse-openmetrics-format branch August 8, 2021 11:03
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.

2 participants