newrelic/node-newrelic — pull request #190 by apparentlymart (2014-12-30 04:34:29+00:00)
Title: Don't break memcached.getMulti with instrumentation

Internally to ``memcached.getMulti`` the ``memcached.command`` method is called with a second argument to force a particular server. The ``memcached`` instrumentation is currently failing to pass on that parameter, which causes the library to send the ``getMulti`` request to only one server, which surfaces as apparent cache misses for any key not on that server.

This is pretty insidious since adding the agent to an existing application that was already using ``memcached.getMulti`` actually worsens performance (by introducing extra cache misses) but doesn't raise any obvious error to indicate that something is up.

This patch fixes the issue by passing on any additional ``memcached.command`` arguments verbatim to the wrapped implementation.

In order to test this I had to introduce a second memcached server to the integration test. What I have written here works for me having manually started up a second server, but I don't have docker installed and thus I didn't update the Makefile to start up that second memcached server.