Cls.prototype[operation] = function()

in src/plugins/IORedisPlugin.ts [42:64]


    Cls.prototype[operation] = function (...args: any[]) {
      const command = args[0];
      const host = `${this.options.host}:${this.options.port}`;
      const span = ContextManager.current.newExitSpan(`redis/${command?.name}`, Component.REDIS);

      span.start();
      span.component = Component.REDIS;
      span.layer = SpanLayer.CACHE;
      span.peer = host;
      span.tag(Tag.dbType('Redis'));
      span.tag(Tag.dbInstance(`${this.condition?.select ?? host}`));

      try {
        const ret = wrapPromise(span, _original.apply(this, args));
        span.async();
        return ret;
      } catch (err) {
        span.error(err);
        span.stop();

        throw err;
      }
    };