Skip to content

Commit 71fc75f

Browse files
authored
[DI] Ensure probes without a 'sampling' property is parsed correctly (#5090)
1 parent 7e4b054 commit 71fc75f

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

packages/dd-trace/src/debugger/devtools_client/breakpoints.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ async function addBreakpoint (probe) {
2323
delete probe.where
2424

2525
// Optimize for fast calculations when probe is hit
26-
const snapshotsPerSecond = probe.sampling.snapshotsPerSecond ?? (probe.captureSnapshot
26+
const snapshotsPerSecond = probe.sampling?.snapshotsPerSecond ?? (probe.captureSnapshot
2727
? MAX_SNAPSHOTS_PER_SECOND_PER_PROBE
2828
: MAX_NON_SNAPSHOTS_PER_SECOND_PER_PROBE)
29-
probe.sampling.nsBetweenSampling = BigInt(1 / snapshotsPerSecond * 1e9)
29+
probe.nsBetweenSampling = BigInt(1 / snapshotsPerSecond * 1e9)
3030
probe.lastCaptureNs = 0n
3131

3232
// TODO: Inbetween `await session.post('Debugger.enable')` and here, the scripts are parsed and cached.

packages/dd-trace/src/debugger/devtools_client/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ session.on('Debugger.paused', async ({ params }) => {
4242
const id = params.hitBreakpoints[i]
4343
const probe = breakpoints.get(id)
4444

45-
if (start - probe.lastCaptureNs < probe.sampling.nsBetweenSampling) {
45+
if (start - probe.lastCaptureNs < probe.nsBetweenSampling) {
4646
continue
4747
}
4848

0 commit comments

Comments
 (0)