Skip to content

Commit

Permalink
[DI] Ensure probes without a 'sampling' property is parsed correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
watson committed Jan 9, 2025
1 parent b36ce05 commit 4fdee9c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/dd-trace/src/debugger/devtools_client/breakpoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ async function addBreakpoint (probe) {
delete probe.where

// Optimize for fast calculations when probe is hit
const snapshotsPerSecond = probe.sampling.snapshotsPerSecond ?? (probe.captureSnapshot
const snapshotsPerSecond = probe.sampling?.snapshotsPerSecond ?? (probe.captureSnapshot
? MAX_SNAPSHOTS_PER_SECOND_PER_PROBE
: MAX_NON_SNAPSHOTS_PER_SECOND_PER_PROBE)
probe.sampling.nsBetweenSampling = BigInt(1 / snapshotsPerSecond * 1e9)
probe.nsBetweenSampling = BigInt(1 / snapshotsPerSecond * 1e9)
probe.lastCaptureNs = 0n

// TODO: Inbetween `await session.post('Debugger.enable')` and here, the scripts are parsed and cached.
Expand Down
2 changes: 1 addition & 1 deletion packages/dd-trace/src/debugger/devtools_client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ session.on('Debugger.paused', async ({ params }) => {
const id = params.hitBreakpoints[i]
const probe = breakpoints.get(id)

if (start - probe.lastCaptureNs < probe.sampling.nsBetweenSampling) {
if (start - probe.lastCaptureNs < probe.nsBetweenSampling) {
continue
}

Expand Down

0 comments on commit 4fdee9c

Please sign in to comment.