forked from open-telemetry/opentelemetry-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: redis instrumentation loses context when using callbacks (open-t…
…elemetry#580) * fix: redis instrumentation loses context when using callbacks * fix: rename test * fix: merge new test into existing describe * fix: refactor context.with as requested * fix: remove redundant callbackThis const * fix: move originalContext to inside if
- Loading branch information
Showing
2 changed files
with
17 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -212,6 +212,16 @@ describe('[email protected]', () => { | |
}); | ||
}); | ||
}); | ||
|
||
it('should invoke callback with original command context', () => { | ||
const rootSpan = tracer.startSpan('test span'); | ||
context.with(trace.setSpan(context.active(), rootSpan), () => { | ||
client.set('callbacksTestKey', 'value', () => { | ||
const activeSpan = trace.getSpan(context.active()); | ||
assert.strictEqual(activeSpan, rootSpan); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('Removing instrumentation', () => { | ||
|