MCPcopy
hub / github.com/redis/ioredis / traceCommand

Function traceCommand

lib/tracing.ts:125–138  ·  view source on GitHub ↗
(
  fn: () => Promise<T>,
  contextFactory: () => CommandContext
)

Source from the content-addressed store, hash-verified

123const noop = () => {};
124
125export function traceCommand<T>(
126 fn: () => Promise<T>,
127 contextFactory: () => CommandContext
128): Promise<T> {
129 if (!shouldTrace(commandChannel)) return fn();
130
131 // tracePromise returns a wrapper promise that re-rejects on error.
132 // Silence the wrapper to prevent unhandled rejections when callers
133 // (e.g. Pipeline) discard the return value. Callers that await this
134 // promise still see the rejection through their own .then() chain.
135 const traced = commandChannel.tracePromise(fn, contextFactory());
136 traced.catch(noop);
137 return traced;
138}
139
140export function traceBatch<T>(
141 fn: () => Promise<T>,

Callers 1

sendCommandMethod · 0.90

Calls 2

shouldTraceFunction · 0.85
tracePromiseMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…