@@ -49,17 +49,6 @@ export interface ChangeStreamBatch {
4949 * Size in bytes of this event.
5050 */
5151 byteSize : number ;
52-
53- /**
54- * Time in milliseconds that we waited for a response from MongoDB.
55- *
56- * This includes:
57- * 1. Time to send the command.
58- * 2. Time MongoDB waits for new data to be available.
59- * 3. Time MongoDB scans through the oplog.
60- * 4. Time to send the data back over the network, and parse the outer metadata.
61- */
62- commandDuration : number ;
6352}
6453
6554const deserialize = mongo . BSON . deserialize ;
@@ -176,7 +165,6 @@ async function* rawChangeStreamInner(
176165
177166 try {
178167 {
179- const start = performance . now ( ) ;
180168 using aggregateSpan = options . tracer ?. span ( 'changestream' , 'aggregate' ) ;
181169 // Step 1: Send the aggregate command to start the change stream
182170 const aggregateResult = await db
@@ -197,7 +185,6 @@ async function* rawChangeStreamInner(
197185 throw mapChangeStreamError ( e ) ;
198186 } ) ;
199187
200- const aggregateDuration = performance . now ( ) - start ;
201188 aggregateSpan ?. end ( ) ;
202189
203190 const cursor = deserialize ( aggregateResult . cursor , DESERIALIZE_CHANGE_STREAM ) ;
@@ -216,16 +203,14 @@ async function* rawChangeStreamInner(
216203 yield {
217204 events : batch ,
218205 resumeToken : cursor . postBatchResumeToken ,
219- byteSize : aggregateResult . cursor . byteLength ,
220- commandDuration : aggregateDuration
206+ byteSize : aggregateResult . cursor . byteLength
221207 } ;
222208 }
223209
224210 // Step 2: Poll using getMore until the cursor is closed
225211 while ( cursorId && cursorId !== 0n ) {
226212 options . signal ?. throwIfAborted ( ) ;
227213
228- const start = performance . now ( ) ;
229214 using commandSpan = options . tracer ?. span ( 'changestream' , 'getmore' ) ;
230215 const getMoreResult : mongo . Document = await db
231216 . command (
@@ -253,7 +238,6 @@ async function* rawChangeStreamInner(
253238 throw mapChangeStreamError ( e ) ;
254239 } ) ;
255240
256- const getMoreDuration = performance . now ( ) - start ;
257241 commandSpan ?. end ( ) ;
258242
259243 const cursor = deserialize ( getMoreResult . cursor , DESERIALIZE_CHANGE_STREAM ) ;
@@ -268,8 +252,7 @@ async function* rawChangeStreamInner(
268252 yield {
269253 events : nextBatch ,
270254 resumeToken : cursor . postBatchResumeToken ,
271- byteSize : getMoreResult . cursor . byteLength ,
272- commandDuration : getMoreDuration
255+ byteSize : getMoreResult . cursor . byteLength
273256 } ;
274257 }
275258
0 commit comments