File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
packages/opentelemetry/src Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -105,8 +105,9 @@ export class SentrySpanExporter {
105105 * We do this to avoid leaking memory.
106106 */
107107 private _cleanupOldSpans ( spans = this . _finishedSpans ) : void {
108+ const currentTimeSeconds = Date . now ( ) / 1000 ;
108109 this . _finishedSpans = spans . filter ( span => {
109- const shouldDrop = shouldCleanupSpan ( span , this . _timeout ) ;
110+ const shouldDrop = shouldCleanupSpan ( span , currentTimeSeconds , this . _timeout ) ;
110111 DEBUG_BUILD &&
111112 shouldDrop &&
112113 logger . log (
@@ -174,8 +175,8 @@ function getCompletedRootNodes(nodes: SpanNode[]): SpanNodeCompleted[] {
174175 return nodes . filter ( nodeIsCompletedRootNode ) ;
175176}
176177
177- function shouldCleanupSpan ( span : ReadableSpan , maxStartTimeOffsetSeconds : number ) : boolean {
178- const cutoff = Date . now ( ) / 1000 - maxStartTimeOffsetSeconds ;
178+ function shouldCleanupSpan ( span : ReadableSpan , currentTimeSeconds : number , maxStartTimeOffsetSeconds : number ) : boolean {
179+ const cutoff = currentTimeSeconds - maxStartTimeOffsetSeconds ;
179180 return spanTimeInputToSeconds ( span . startTime ) < cutoff ;
180181}
181182
You can’t perform that action at this time.
0 commit comments