google/sqlcommenter

Go: Incorrect specification implementation causes traceparent not to work properly

kostyay opened this issue · 0 comments

So I've been investigating the bug I'm having in this isssue: #211

I was checking the way the query is sent to the database and realized that the current go implementation doesnt follow the specification.
The way the current implementation adds the comments is as such:
/*action=ListUsers,route=router,traceparent=00-ef43f0b3e8c3bf30186961dXXXX-YYYY-01*/

However, the specification states that all values must be single quoted
image

So I added single quotes to all the values that are being sent to the server and suddenly everything started working, so now I'm sending this instead (notice the single quotes on each parameter):
/*action='ListUsers',route='router',traceparent='00-ef43f0b3e8c3bf30186961dXXXX-YYYY-01'*/

This worked and solved the issue.

Based on the nodejs implementation it appears that all values need to be single quoted https://github.com/google/sqlcommenter/blob/master/nodejs/sqlcommenter-nodejs/packages/sqlcommenter-knex/index.js#L95

Attaching the PR to fix it below