code: function wrapPulseQueryQueue (orig) {
      return function wrappedFunction () {
        if (this.queryQueue) {
          var query = this.queryQueue[this.queryQueue.length - 1]
          if (query && typeof query.callback === 'function' && query.callback.name !== 'elasticAPMCallbackWrapper') {
            query.callback = agent._instrumentation.bindFunction(query.callback)
          }
        } else {
          agent.logger.debug('ERROR: Internal structure of pg Client object have changed!')
        }
        return orig.apply(this, arguments)
      }
    }
docs: The client maintains an internal callback queue for all the queries. In 7.0.0, the queries are true promises (as opposed to faking the Promise API in ^6.3.0). To properly get the right context when the Promise API is used, we need to patch all callbacks in the callback queue.  _pulseQueryQueue is usually called when something have been added to the client.queryQueue array. This gives us a chance to bind to the newly queued objects callback.