-
Notifications
You must be signed in to change notification settings - Fork 381
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
Fix sql comment propagation full
mode when tracing is disabled
#2866
Merged
TonyCTHsu
merged 2 commits into
master
from
tonycthsu/fix-type-error-for-sql-comment-propagation
May 26, 2023
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
Propagation could happen even if tracing is disabled?
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.
Yes, when tracing is disabled. Our API returns dummy objects, see
https://github.com/DataDog/dd-trace-rb/blob/master/lib/datadog/tracing/tracer.rb#L136
https://github.com/DataDog/dd-trace-rb/blob/master/lib/datadog/tracing/tracer.rb#L518-L527
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.
Interesting.
But if tracing is disabled, do we call the tracing library for instrumenting MySQL and PG?
It feels weird to see the places
prepend_comment
is called and have tracing disabled.dd-trace-rb/lib/datadog/tracing/contrib/pg/instrumentation.rb
Line 99 in 99997b7
dd-trace-rb/lib/datadog/tracing/contrib/mysql2/instrumentation.rb
Line 52 in 99997b7
I would assume that if tracing is disabled, we wouldn't even instrument MySQL and PG. Is that not correct?
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.
@GustavoCaso , when tracing is disabled, we are still instrumenting application, but the trace operation and span operation are dummy data to comply with our public API for user using manual instrumentation.
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 we return a dummy trace and span operation when tracing is disabled, we should make them behave like a dummy object that responds to the same methods as a regular trace or span operation. Those methods must probably be no-op. Basically, create an object duck type like a span or trace, rather than check if tracing is enabled through the codebase.
That change would be a more involved one, that should probably be tackled on a separate PR.
I will approve the PR, but I want to make sure that we try to tackle this in the future in a more sustainable way.