-
Notifications
You must be signed in to change notification settings - Fork 543
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
Distributor: do not propagate errors with non-utf8 characters #10236
Conversation
Signed-off-by: Yuri Nikolic <[email protected]>
Signed-off-by: Yuri Nikolic <[email protected]>
Signed-off-by: Yuri Nikolic <[email protected]>
{Key: "Content-Type", Values: []string{"application/json"}}, | ||
}, | ||
Url: "/otlp", | ||
Body: []byte("\n\xf6\x16\n\xd3\x02\n\x1d\n\x11container.runtime\x12\x08\n\x06docker\n'\n\x12container.h"), |
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.
I'm pretty sure that the test is correct, but it would be easier to read and understand it if it had a comment explaining which character is not valid UTF-8 and with which other character we expect it to be replaced.
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.
I have added a comment explaining which characters are non-UTF8, and what should they be replaced with. Thank you.
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.
thx
Signed-off-by: Yuri Nikolic <[email protected]>
What this PR does
This PR prevents
distributor.OTLPHandler
anddistributor.Handler
from propagating errors containing non-utf8 characters.The presence of non-utf8 characters in Mimir errors might break some crucial parts of distributor's logic. For example, if
httpgrpc.HTTPServer.Handle()
returns ahttpgprc.Error
containing a non-utf8 character, this error will not be propagated tohttpgrpc.HTTPClient
as ahtttpgrpc.Error
, but as a generic error, which might break some of Mimir internal logic.This is because golang's
proto.Marshal()
, which is used by gRPC internally, fails when it marshals thehttpgrpc.Error
containing non-utf8 character produced byhttpgrpc.HTTPServer.Handle()
, making the resulting error lose some important properties.Which issue(s) this PR fixes or relates to
Fixes #
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]
.about-versioning.md
updated with experimental features.