Skip to content

Commit 6f67548

Browse files
committed
Address review comments
1 parent 2f90bac commit 6f67548

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

packages/dd-trace/src/debugger/devtools_client/snapshot/processor.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ function toArray (type, elements, maxLength, timeBudgetReached) {
189189
function toMap (type, pairs, maxLength, timeBudgetReached) {
190190
if (timeBudgetReached === true) return notCapturedTimeBudget(type)
191191
if (pairs === undefined) return notCapturedDepth(type)
192+
if (pairs.every(({ value }) => Object.hasOwn(value, timeBudgetSym))) return notCapturedTimeBudget(type)
192193

193194
const result = {
194195
type,
@@ -201,9 +202,6 @@ function toMap (type, pairs, maxLength, timeBudgetReached) {
201202
// This can be skipped and we can go directly to its children, of which
202203
// there will always be exactly two, the first containing the key, and the
203204
// second containing the value of this entry of the Map.
204-
if (Object.hasOwn(value, timeBudgetSym)) {
205-
return [{ notCapturedReason: 'timeout' }, { notCapturedReason: 'timeout' }]
206-
}
207205
const shouldRedact = shouldRedactMapValue(value.properties[0])
208206
const key = getPropertyValue(value.properties[0], maxLength)
209207
const val = shouldRedact
@@ -221,6 +219,7 @@ function toMap (type, pairs, maxLength, timeBudgetReached) {
221219
function toSet (type, values, maxLength, timeBudgetReached) {
222220
if (timeBudgetReached === true) return notCapturedTimeBudget(type)
223221
if (values === undefined) return notCapturedDepth(type)
222+
if (values.every(({ value }) => Object.hasOwn(value, timeBudgetSym))) return notCapturedTimeBudget(type)
224223

225224
const result = {
226225
type,
@@ -233,9 +232,6 @@ function toSet (type, values, maxLength, timeBudgetReached) {
233232
// `internal#entry`. This can be skipped and we can go directly to its
234233
// children, of which there will always be exactly one, which contain the
235234
// actual value in this entry of the Set.
236-
if (Object.hasOwn(value, timeBudgetSym)) {
237-
return { notCapturedReason: 'timeout' }
238-
}
239235
return getPropertyValue(value.properties[0], maxLength)
240236
})
241237
}

packages/dd-trace/test/debugger/devtools_client/snapshot/time-budget.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ describe('Debugger snapshot time budget', () => {
103103
const out = processRawState(raw, MAX_LENGTH)
104104
assert.deepEqual(out.map, {
105105
type: 'Map',
106-
entries: [[{ notCapturedReason: 'timeout' }, { notCapturedReason: 'timeout' }]]
106+
notCapturedReason: 'timeout'
107107
})
108108
})
109109

@@ -131,7 +131,7 @@ describe('Debugger snapshot time budget', () => {
131131
const out = processRawState(raw, MAX_LENGTH)
132132
assert.deepEqual(out.set, {
133133
type: 'Set',
134-
elements: [{ notCapturedReason: 'timeout' }]
134+
notCapturedReason: 'timeout'
135135
})
136136
})
137137
})

0 commit comments

Comments
 (0)