Skip to content

Commit e9b0824

Browse files
committed
make more robust
1 parent 2db2188 commit e9b0824

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/core/src/tracing/idleSpan.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ export function startIdleSpan(startSpanOptions: StartSpanOptions, options: Parti
121121
beforeSpanEnd(span);
122122
}
123123

124-
const timestamp = args[0] || timestampInSeconds();
124+
// Just ensuring that this keeps working, even if we ever have more arguments here
125+
const [definedEndTimestamp, ...rest] = args;
126+
const timestamp = definedEndTimestamp || timestampInSeconds();
125127
const spanEndTimestamp = spanTimeInputToSeconds(timestamp);
126128

127129
// Ensure we end with the last span timestamp, if possible
@@ -130,7 +132,7 @@ export function startIdleSpan(startSpanOptions: StartSpanOptions, options: Parti
130132
// If we have no spans, we just end, nothing else to do here
131133
if (!spans.length) {
132134
onIdleSpanEnded(spanEndTimestamp);
133-
return Reflect.apply(target, thisArg, [spanEndTimestamp]);
135+
return Reflect.apply(target, thisArg, [spanEndTimestamp, ...rest]);
134136
}
135137

136138
const childEndTimestamps = spans
@@ -152,7 +154,7 @@ export function startIdleSpan(startSpanOptions: StartSpanOptions, options: Parti
152154
);
153155

154156
onIdleSpanEnded(endTimestamp);
155-
return Reflect.apply(target, thisArg, [endTimestamp]);
157+
return Reflect.apply(target, thisArg, [endTimestamp, ...rest]);
156158
},
157159
});
158160

0 commit comments

Comments
 (0)