How to use the ioredis.__iopipeShimmer function in ioredis

To help you get started, we’ve selected a few ioredis examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github iopipe / iopipe-js-trace / src / plugins / ioredis.js View on Github external
debug(
      'Timeline passed to plugins/ioredis.wrap not an instance of performance-node. Skipping.'
    );
    return false;
  }

  if (!Redis.__iopipeShimmer) {
    if (process.env.IOPIPE_TRACE_IOREDIS_INITPROMISE) {
      shimmer.wrap(
        Redis.Command && Redis.Command.prototype,
        'initPromise',
        wrapPromise
      );
    }
    shimmer.wrap(Redis && Redis.prototype, 'sendCommand', wrapSendCommand);
    Redis.__iopipeShimmer = true;
  }

  return true;

  function wrapPromise(original) {
    return function wrappedPromise() {
      const command = this;
      const cb = this.callback;
      const id = createId();
      const { name } = command;
      data[id] = {
        name,
        dbType: 'Redis',
        request: filterRequest(command)
      };
github iopipe / iopipe-js-trace / src / plugins / ioredis.js View on Github external
function wrap({ timeline, data = {} } = {}) {
  if (!(timeline instanceof Perf)) {
    debug(
      'Timeline passed to plugins/ioredis.wrap not an instance of performance-node. Skipping.'
    );
    return false;
  }

  if (!Redis.__iopipeShimmer) {
    if (process.env.IOPIPE_TRACE_IOREDIS_INITPROMISE) {
      shimmer.wrap(
        Redis.Command && Redis.Command.prototype,
        'initPromise',
        wrapPromise
      );
    }
    shimmer.wrap(Redis && Redis.prototype, 'sendCommand', wrapSendCommand);
    Redis.__iopipeShimmer = true;
  }

  return true;

  function wrapPromise(original) {
    return function wrappedPromise() {
      const command = this;

ioredis

A robust, performance-focused and full-featured Redis client for Node.js.

MIT
Latest version published 9 days ago

Package Health Score

90 / 100
Full package analysis