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

expfmt: only ignore io.EOF errors in TextParse.startOfLine #444

Merged
merged 1 commit into from
Feb 20, 2023

Conversation

abursavich
Copy link
Contributor

@abursavich abursavich commented Feb 9, 2023

We shouldn't ignore all errors here, only io.EOF. If an unexpected connection break just happens to align with the start of a new line, that error shouldn't be suppressed.

Copy link
Member

@beorn7 beorn7 left a comment

Choose a reason for hiding this comment

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

Thank you very much, makes total sense. But could you change the code comment to reflect your reasoning?

Signed-off-by: Andy Bursavich <abursavich@gmail.com>
@abursavich
Copy link
Contributor Author

Updated comment. Please take another look.

Copy link
Member

@beorn7 beorn7 left a comment

Choose a reason for hiding this comment

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

Thanks again.

Over to @roidelapluie for final approval and merging.

@roidelapluie roidelapluie merged commit 2c9877d into prometheus:main Feb 20, 2023
roidelapluie added a commit to roidelapluie/common that referenced this pull request Feb 20, 2023
The test cases cover the various scenarios that can occur when the
TextParser `startOfLine` method encounters an error. The first subtest
ensures that the method handles the `io.EOF` error correctly when the
input `io.Reader` is empty.

The second subtest uses a custom implementation of `io.Reader` to test
that `startOfLine` handles errors other than `io.EOF` correctly.

See prometheus#444

Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
radek-ryckowski pushed a commit to goldmansachs/common that referenced this pull request May 18, 2023
The test cases cover the various scenarios that can occur when the
TextParser `startOfLine` method encounters an error. The first subtest
ensures that the method handles the `io.EOF` error correctly when the
input `io.Reader` is empty.

The second subtest uses a custom implementation of `io.Reader` to test
that `startOfLine` handles errors other than `io.EOF` correctly.

See prometheus#444

Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
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.

3 participants