-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Tracing query comments #6387
Tracing query comments #6387
Conversation
…. doing this in vtgate is not compatible with the opentracing-jaeger library Signed-off-by: Arka Ganguli <arkaganguli1@gmail.com>
Signed-off-by: Arka Ganguli <arkaganguli1@gmail.com>
The code looks good, but I think we need to solve this in a way that does not introduce new conflicts. I coded up an alternative solution here: #6398 |
I think the current way of doing this is broken, and changing the splitting character is not going to be enough. Since this part of the API, and changing it is a breaking change, we should make sure that we come up with a way that is future proof. Instead of coming up with out own format, WDYT about simply using an established format, such as protobufs TextFormat, or maybe even just using JSON?
and this works fine - until someone sticks a |
Parsing it as JSON sounds good to me. Doesn't the
|
Once we parse tracer information, can we throw away the comment? If so, we can use "custom" comment delimiters, such as
which are valid comments SQL-wise; if vitess is the first to intercept these, then it's:
I could be out of context here, or maybe there's SQL parsers that need to intercept the query before vitess does? |
What kind of metadata do we send through here? If we are the ones generating it, can we make sure that the metadata has no delimiters, allowing only ids and numbers. If so, we can safely use |
The key/value pairs are generated by the open tracing backend, and not us. Don't think we can change what they use. |
Ok, how about json that is base64 encoded? instead of
it would be
base64/json might not be the most efficient way of doing it, but it's simple and has good support on all platforms. WDYT? |
Base64 encoding is a brilliant idea :). But, I still have one last question before we commit to it. Eventhough that info is generated by the tool, it mostly comes from our span tags right? So, as long as the tool doesn't intentionally add crazy stuff the content should be normalized. |
In our case, we are generating the span ids in our application which are passed along to the jaeger-client adapter in vitess. The ids we generate should be valid for both zipkin and jaeger clients, but the reason why we need to pass the information encoded in this way is because those libraries expect the values in a certain format. |
Setup
While trying to enable the
opentracing-jaeger
tracer for vitess, I ran into an issue with how the span information is parsed in vitess. We connect to vtgates using the mysql protocol, and the trace information is passed to vitess using leading query comments.Problem
In
extractMapFromString
(code), the string is split on the:
delimeter and then each of those as key/value pairs are passed to the opentracing library.In the opentracing library, there is similar validation done where it expects key value pairs (code) and then depending on the key, the value is further split on
:
. The code for that is here.So, we are splitting on a delimeter that is expected to be passed along as values in the key/value pairs containing trace information. The docs for the jaeger client also say this is the expected format of values (ref)