From 0c6c4ba9f34f6a8b37b48c6038d46b585b87fa16 Mon Sep 17 00:00:00 2001 From: rochdev Date: Thu, 18 Oct 2018 18:16:05 -0400 Subject: [PATCH] add support for ioredis >=2 <=3 --- src/plugins/ioredis.js | 2 +- test/plugins/agent.js | 1 + test/plugins/ioredis.spec.js | 9 +++++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/plugins/ioredis.js b/src/plugins/ioredis.js index 1738cab90e6..c093bcf0704 100644 --- a/src/plugins/ioredis.js +++ b/src/plugins/ioredis.js @@ -18,7 +18,7 @@ function createWrapSendCommand (tracer, config) { module.exports = { name: 'ioredis', - versions: ['4.x'], + versions: ['>=2 <=4'], patch (Redis, tracer, config) { this.wrap(Redis.prototype, 'sendCommand', createWrapSendCommand(tracer, config)) }, diff --git a/test/plugins/agent.js b/test/plugins/agent.js index 82283d78521..1bc479c3ed8 100644 --- a/test/plugins/agent.js +++ b/test/plugins/agent.js @@ -49,6 +49,7 @@ module.exports = { plugins: false }) + tracer.use('bluebird') tracer.use(pluginName, config) }) }) diff --git a/test/plugins/ioredis.spec.js b/test/plugins/ioredis.spec.js index 9a17d15c6f6..c13204fa6ea 100644 --- a/test/plugins/ioredis.spec.js +++ b/test/plugins/ioredis.spec.js @@ -50,11 +50,16 @@ describe('Plugin', () => { it('should run the callback in the parent context', () => { if (process.env.DD_CONTEXT_PROPAGATION === 'false') return - const scope = tracer.scopeManager().activate({}) + const span = {} + + tracer.scopeManager().activate(span) return redis.get('foo') .then(() => { - expect(tracer.scopeManager().active()).to.equal(scope) + const scope = tracer.scopeManager().active() + + expect(scope).to.not.be.null + expect(scope.span()).to.equal(span) }) })