fix(mysql): bind get connection callback to active context#562
Merged
vmarchaud merged 4 commits intoopen-telemetry:mainfrom Aug 14, 2021
Merged
fix(mysql): bind get connection callback to active context#562vmarchaud merged 4 commits intoopen-telemetry:mainfrom
vmarchaud merged 4 commits intoopen-telemetry:mainfrom
Conversation
|
|
bed4685 to
bc37bf7
Compare
vmarchaud
reviewed
Jul 5, 2021
plugins/node/opentelemetry-instrumentation-mysql/src/instrumentation.ts
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## main #562 +/- ##
==========================================
- Coverage 96.68% 95.04% -1.65%
==========================================
Files 13 204 +191
Lines 634 12003 +11369
Branches 124 1137 +1013
==========================================
+ Hits 613 11408 +10795
- Misses 21 595 +574
|
844781f to
3454156
Compare
vmarchaud
approved these changes
Jul 5, 2021
obecny
reviewed
Jul 5, 2021
plugins/node/opentelemetry-instrumentation-mysql/src/instrumentation.ts
Outdated
Show resolved
Hide resolved
Flarna
reviewed
Jul 12, 2021
plugins/node/opentelemetry-instrumentation-mysql/src/instrumentation.ts
Outdated
Show resolved
Hide resolved
MSNev
approved these changes
Jul 12, 2021
vmarchaud
previously requested changes
Jul 12, 2021
Member
vmarchaud
left a comment
There was a problem hiding this comment.
requesting changes so we don't merge it before addresing flarna feedback
blumamir
reviewed
Jul 13, 2021
Comment on lines
+434
to
+445
| assert.ifError(err); | ||
| assert.ok(connection); | ||
| const sql = 'SELECT ? as solution'; | ||
| connection.query(sql, 1, (err, res) => { | ||
| assert.ifError(err); | ||
| assert.ok(res); | ||
| assert.strictEqual(res[0].solution, 1); | ||
| const spans = memoryExporter.getFinishedSpans(); | ||
| assert.strictEqual(spans.length, 1); | ||
| const querySpan = spans[0]; | ||
| assert.strictEqual( | ||
| querySpan.parentSpanId, | ||
| parentSpan.spanContext().spanId | ||
| ); | ||
| done(); | ||
| }); | ||
| }); |
Member
There was a problem hiding this comment.
This is a very verbose way to check that the context is correctly set in the callback.
Alternative and more direct option is to extract trace.getSpan(context.active()) in the callback and compare it to parentSpan
Contributor
Author
There was a problem hiding this comment.
@blumamir thanks, I've changed the test.
Signed-off-by: Simon Stone <simonstone1@gmail.com>
Signed-off-by: Simon Stone <Simon.Stone@docusign.com>
Signed-off-by: Simon Stone <Simon.Stone@docusign.com>
Flarna
approved these changes
Aug 13, 2021
vmarchaud
approved these changes
Aug 14, 2021
Merged
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Signed-off-by: Simon Stone simonstone1@gmail.com
Which problem is this PR solving?
Short description of the changes
getConnectionis now bound to the active context before it is passed into the instrumentedmysqlcode