Skip to content

Commit 5df98d6

Browse files
fix: resolve replay mode errors in Redis and Firestore no-op request handlers (#138)
1 parent 3beb18a commit 5df98d6

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

src/instrumentation/libraries/firestore/Instrumentation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -699,11 +699,11 @@ export class FirestoreInstrumentation extends TdInstrumentationBase {
699699
if (self.mode === TuskDriftMode.REPLAY) {
700700
return handleReplayMode({
701701
noOpRequestHandler: () => {
702-
if (!this.originalCollectionDocFn) {
702+
if (!self.originalCollectionDocFn) {
703703
logger.error(`[FirestoreInstrumentation] Original doc function not available`);
704704
return Promise.reject(new Error("Original doc function not available"));
705705
}
706-
return this.originalCollectionDocFn.call(this, "");
706+
return self.originalCollectionDocFn.call(this);
707707
},
708708
isServerRequest: false,
709709
replayModeHandler: () => {

src/instrumentation/libraries/redis/Instrumentation.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,11 @@ export class RedisInstrumentation extends TdInstrumentationBase {
215215

216216
return handleReplayMode({
217217
noOpRequestHandler: () => {
218-
return undefined;
218+
const upperCmd = commandName.toUpperCase();
219+
if (upperCmd === "EVAL" || upperCmd === "EVALSHA") {
220+
return [];
221+
}
222+
return null;
219223
},
220224
isServerRequest: false,
221225
replayModeHandler: () => {
@@ -418,7 +422,13 @@ export class RedisInstrumentation extends TdInstrumentationBase {
418422
const stackTrace = captureStackTrace(["RedisInstrumentation"]);
419423

420424
return handleReplayMode({
421-
noOpRequestHandler: () => undefined,
425+
noOpRequestHandler: () => {
426+
const upperCmd = commandName.toUpperCase();
427+
if (upperCmd === "EVAL" || upperCmd === "EVALSHA") {
428+
return [];
429+
}
430+
return null;
431+
},
422432
isServerRequest: false,
423433
replayModeHandler: () => {
424434
return SpanUtils.createAndExecuteSpan(

0 commit comments

Comments
 (0)