change how tracing query comments are handled #6463
Merged
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.
When sending the trace information over the mysql protocol, we need to be able to encode a string-string map into a string that can be put into a query as a comment. The current way of doing it is broken, since it is not protecting the map serialisation from clashing with SQL.
This PR changes the approach to use first JSON as a way of encoding the map, and then base64 encoding to make sure that the json doesn't clash with any SQL syntax rules.
On the client side, one would need to pick up the current tracing information from openTracing, encode it as JSON, base64 encode the json-string, and stick this into the comment. Example:
Result:
This PR replaces #6387