-
Notifications
You must be signed in to change notification settings - Fork 253
Add SQL commenter as context propagation for databases #2495
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
base: main
Are you sure you want to change the base?
Add SQL commenter as context propagation for databases #2495
Conversation
Co-authored-by: Robert Pająk <[email protected]>
Co-authored-by: Robert Pająk <[email protected]>
Co-authored-by: Robert Pająk <[email protected]>
Co-authored-by: Robert Pająk <[email protected]>
Co-authored-by: Zach Montoya <[email protected]>
Co-authored-by: Zach Montoya <[email protected]>
@open-telemetry/semconv-db-approvers PTAL |
@trask, I find all comments are resolved. Is that okay for you to approve this PR? |
docs/database/database-spans.md
Outdated
|
||
The instrumentation SHOULD allow users to pass a propagator to overwrite the global propagator. | ||
|
||
If the propagator does not provide any value, the instrumentation SHOULD NOT inject any comment into the query. |
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.
If the propagator does not provide any value, the instrumentation SHOULD NOT inject any comment into the query. | |
If the propagator is not provided, the instrumentation SHOULD NOT inject any comment into the query. |
?
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.
This prevents injecting empty comments like /**/
when the propagator sets nothing.
So, we won’t see a query like this SELECT * FROM Users /**/
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.
Perhaps you meant something like this then
If the propagator does not provide any value, the instrumentation SHOULD NOT inject any comment into the query. | |
If the context is empty or invalid, the propagator SHOULD NOT inject any comment into the query. |
?
But this sentence immediately follows "The instrumentation SHOULD allow users to pass a propagator to overwrite the global propagator.", it seems it intends to talk about propagator not being provided by the user.
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.
We can use this code as the example. In this example, even the propagator provides nothing, the comments will be injected.
https://github.com/XSAM/otelsql/blob/370716b2f8c317607879035937ba65cfc751dc5a/commenter.go#L66
return fmt.Sprintf("%s /*%s*/", query, cc.Marshal())
Since it is instrumentation's job to actually inject the comment, the instrumentation should be the one to be regulated for this, not the propagator.
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 updated this part on c0a6f4b. I think it is clear now.
Co-authored-by: Liudmila Molkova <[email protected]>
- Simplify wording about append/prepend to avoid confusion - Clarify distinction between missing propagator vs empty context
Part of #2162, Replace #2236. All previous commits are copied to this PR.
This PR focused solely on the SQL commenter, as #2363 has been merged.
XSAM/otelsql#512 is the prototype that demonstrates the SQL commenter with the
text attributes
propagator.Changes
Add SQL commenter as context propagation for databases