@@ -4,7 +4,6 @@ import { createMockInputValue } from "../../../../core/utils";
44import { SpanInfo } from "../../../../core/tracing/SpanUtils" ;
55import { logger } from "../../../../core/utils/logger" ;
66import { QueryCallback } from "../types" ;
7- import { captureStackTrace } from "src/instrumentation/core/utils" ;
87
98/**
109 * Mock MySQL2 connection/pool connection for replay mode
@@ -39,8 +38,9 @@ export class TdMysql2ConnectionMock extends EventEmitter {
3938 query ( ...args : any [ ] ) {
4039 logger . debug ( `[TdMysql2ConnectionMock] Mock connection query intercepted in REPLAY mode` ) ;
4140
42- // Match recording-path stack trace normalization used by mysql2 instrumentation.
43- const stackTrace = captureStackTrace ( [ "Mysql2Instrumentation" ] ) ;
41+ // Avoid using stack trace as a hard matching key for connection-derived replay queries.
42+ // Stack frames differ across environments (e.g. CI container/runtime), causing false misses.
43+ const stackTrace : string | undefined = undefined ;
4444
4545 // Parse query arguments similar to the main query patch
4646 const queryConfig = this . mysql2Instrumentation . parseQueryArgs ( args ) ;
@@ -83,8 +83,9 @@ export class TdMysql2ConnectionMock extends EventEmitter {
8383 execute ( ...args : any [ ] ) {
8484 logger . debug ( `[TdMysql2ConnectionMock] Mock connection execute intercepted in REPLAY mode` ) ;
8585
86- // Match recording-path stack trace normalization used by mysql2 instrumentation.
87- const stackTrace = captureStackTrace ( [ "Mysql2Instrumentation" ] ) ;
86+ // Avoid using stack trace as a hard matching key for connection-derived replay queries.
87+ // Stack frames differ across environments (e.g. CI container/runtime), causing false misses.
88+ const stackTrace : string | undefined = undefined ;
8889
8990 // Parse execute arguments similar to the main execute patch
9091 const queryConfig = this . mysql2Instrumentation . parseQueryArgs ( args ) ;
0 commit comments