-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Ignore parser errors from unsupported metrics types on Prometheus client and continue parsing until EOF is reached. #37357
Conversation
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
Pinging @elastic/obs-ds-hosted-services (Team:obs-ds-hosted-services) |
❕ Build Aborted
Expand to view the summary
Build stats
Steps errors
Expand to view the steps failures
|
// any `info` metrics are not supported, and then there will be ignored here. | ||
// if acceptHeader in the prometheus client `Accept: application/openmetrics-text; version=0.0.1` | ||
// any `info` metrics are supported, and then there will be parsed here. | ||
continue |
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.
can we add a debug log for such cases as well?
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.
usually I would agree with you but logging in that class would be a non-trivial change. You would need to pass the prometheus logger to this method if you didn't want to create a new logger.
I'm not sure about it
💔 Build Failed
Expand to view the summary
Build stats
Pipeline error
❕ Flaky test reportNo test was executed to be analysed. 🤖 GitHub commentsExpand to view the GitHub comments
To re-run your PR in the CI, just comment with:
|
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.
please add the CHANGELOG record
💔 Tests Failed
Expand to view the summary
Build stats
Test stats 🧪
Test errors
Expand to view the tests failures> Show only the first 10 test failures
|
I'm sorry I created this PR to merge directly from a feature branch in elastic/beats instead of from my fork. Closed in favour of #37383 |
Proposed commit message
Ignore parser errors from unsupported metrics types on Prometheus client and continue parsing until EOF is reached.
For example Prometheus client with default
text/plain
format doesn't supportinfo
metrics and it will generate an error at https://github.com/prometheus/prometheus/blob/965e603fa792bca0900ac76eb45ae84c81af1cdf/model/textparse/promparse.go#L319.Currently that error breaks the parsing and it ignores any remaining metrics in the list. With this change instead we will correctly parse all the supported metrics types and ignore the unsupported ones.
Metrics of type
info
are correctly supported by OpenMetrics format. KSM supports OpenMetrics text format as well but in Beats the helper is hardcoded to use only plain text format atbeats/metricbeat/helper/prometheus/prometheus.go
Line 34 in 8b18c36
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Author's Checklist
How to test this PR locally
See related issue #37198 on how to test these changes
Related issues
Use cases
Screenshots
Logs