diff --git a/src/plugins/plugin-redis.js b/src/plugins/plugin-redis.js index b6397d001..0c591fb5e 100644 --- a/src/plugins/plugin-redis.js +++ b/src/plugins/plugin-redis.js @@ -94,12 +94,13 @@ function startSpanFromArguments(api, cmd, args, cb, send_command) { function createInternalSendCommandWrap(api) { return function internalSendCommandWrap(internal_send_command) { - // TODO: Document and simplify this code. return function internal_send_command_trace(cmd, args, cb) { if (arguments.length === 1 && typeof cmd === 'object') { + // New versions of redis (2.4+) use a single options object instead + // of separate named arguments. var span = setupSpan(api, cmd.command, cmd.args, 0); if (!span) { - return internal_send_command.call(this, cmd, args, cb); + return internal_send_command.call(this, cmd); } cmd.callback = wrapCallback(api, span, cmd.callback); return internal_send_command.call(this, cmd); diff --git a/src/plugins/plugin-restify.js b/src/plugins/plugin-restify.js index e4dfae541..47f33768e 100644 --- a/src/plugins/plugin-restify.js +++ b/src/plugins/plugin-restify.js @@ -45,9 +45,6 @@ function patchRestify(restify, api) { skipFrames: 3 }; - // TODO(ofrobots): can this be moved to the inner scope near the req.end - // clobber? - var originalEnd = res.end; api.runInRootSpan(options, function(rootSpan) { if (!rootSpan) { return next(); @@ -67,6 +64,7 @@ function patchRestify(restify, api) { rootSpan.addLabel(api.labels.HTTP_SOURCE_IP, req.connection.remoteAddress); + var originalEnd = res.end; res.end = function(chunk, encoding) { res.end = originalEnd; var returned = res.end(chunk, encoding); diff --git a/src/trace-plugin-interface.js b/src/trace-plugin-interface.js index 8dfc708b5..6e4c417af 100644 --- a/src/trace-plugin-interface.js +++ b/src/trace-plugin-interface.js @@ -109,7 +109,6 @@ var nullSpan = { /** * PluginAPI constructor. Don't call directly - a plugin object will be passed to * plugin themselves - * TODO(kjin): Should be called something else */ function PluginAPI(agent) { this.agent_ = agent; diff --git a/test/test-trace-agent.js b/test/test-trace-agent.js index 32604a261..d8ca8b7c6 100644 --- a/test/test-trace-agent.js +++ b/test/test-trace-agent.js @@ -34,8 +34,6 @@ var assert = require('assert'); var config = require('../config.js'); var file = require('../src/trace-agent.js'); var SpanData = require('../src/span-data.js'); -// TODO: This line will silently fail if a logger is not supplied as -// the second argument. var agent = file.get(config, emptyLogger); var constants = require('../src/constants.js'); var cls = require('../src/cls.js'); @@ -43,8 +41,6 @@ var cls = require('../src/cls.js'); describe('Trace Agent', function() { it('should return the same object on repeated application', function() { - // TODO: This line will silently fail if a logger is not supplied as - // the second argument. var agent1 = file.get(config, emptyLogger); var agent2 = file.get(config, emptyLogger); assert.strictEqual(agent1, agent2); diff --git a/test/test-trace-header-context.js b/test/test-trace-header-context.js index 1ef317330..f763eb7ab 100644 --- a/test/test-trace-header-context.js +++ b/test/test-trace-header-context.js @@ -29,6 +29,8 @@ describe('test-trace-header-context', function() { }); afterEach(function() { + // On node 0.12, mocha may run multiple tests in the same + // cls context, we need to manually clean out the context. common.clearNamespace(agent); });