You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/features/session_trace/aggregate/trace/storage.js
+37-15Lines changed: 37 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -41,15 +41,18 @@ export class TraceStorage {
41
41
this.parent=parent
42
42
}
43
43
44
-
/** Central function called by all the other store__ & addToTrace API to append a trace node. */
45
-
storeSTN(stn){
46
-
if(this.parent.blocked)return
44
+
#canStoreNewNode (){
45
+
if(this.parent.blocked)returnfalse
47
46
if(this.nodeCount>=MAX_NODES_PER_HARVEST){// limit the amount of pending data awaiting next harvest
48
-
if(this.parent.mode!==MODE.ERROR)return
47
+
if(this.parent.mode!==MODE.ERROR)returnfalse
49
48
constopenedSpace=this.trimSTNs(ERROR_MODE_SECONDS_WINDOW)// but maybe we could make some space by discarding irrelevant nodes if we're in sessioned Error mode
50
-
if(openedSpace===0)return
49
+
if(openedSpace===0)returnfalse
51
50
}
51
+
returntrue
52
+
}
52
53
54
+
/** Central internal function called by all the other store__ & addToTrace API to append a trace node. They MUST all have checked #canStoreNewNode before calling this func!! */
if(!this.#canStoreNewNode())return// need to check if adding node will succeed BEFORE storing event ref below (*cli Jun'25 - addressing memory leak in aborted ST issue #NR-420780)
180
+
170
181
if(this.prevStoredEvents.has(currentEvent))return// prevent multiple listeners of an event from creating duplicate trace nodes per occurrence. Cleared every harvest. near-zero chance for re-duplication after clearing per harvest since the timestamps of the event are considered for uniqueness.
171
182
this.prevStoredEvents.add(currentEvent)
172
183
@@ -178,7 +189,7 @@ export class TraceStorage {
178
189
}catch(e){
179
190
evt.o=eventOrigin(null,target,this.parent.ee)
180
191
}
181
-
this.storeSTN(evt)
192
+
this.#storeSTN(evt)
182
193
}
183
194
184
195
shouldIgnoreEvent(event,target){
@@ -216,36 +227,42 @@ export class TraceStorage {
216
227
217
228
// Tracks when the window history API specified by wrap-history is used.
/* Below are the interface expected & required of whatever storage is used across all features on an individual basis. This allows a common `.events` property on Trace shared with AggregateBase.
0 commit comments