Skip to content

fix(debugger): apply source maps to probe stack traces#7336

Merged
watson merged 2 commits intomasterfrom
watson/DEBUG-3799/use-source-maps-for-probe-results
Jan 30, 2026
Merged

fix(debugger): apply source maps to probe stack traces#7336
watson merged 2 commits intomasterfrom
watson/DEBUG-3799/use-source-maps-for-probe-results

Conversation

@watson
Copy link
Copy Markdown
Collaborator

@watson watson commented Jan 26, 2026

What does this PR do?

Fixes probe stack traces to correctly show original source file locations when source maps are available. Previously, stack traces in probe snapshots displayed transpiled/generated code locations instead of the original source locations (e.g., TypeScript files), while breakpoint locations were correctly mapped.

Motivation

When a Dynamic Instrumentation probe is hit in transpiled code, developers need to see stack traces that reference their original source files, not the generated JavaScript. This was already working correctly for breakpoint locations but not for the stack traces in the snapshots, making it difficult to debug transpiled applications.

@watson watson requested review from a team as code owners January 26, 2026 14:26
@watson watson self-assigned this Jan 26, 2026
Copy link
Copy Markdown
Collaborator Author

watson commented Jan 26, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 26, 2026

Overall package size

Self size: 4.49 MB
Deduped: 5.32 MB
No deduping: 5.32 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 2.0.3 | 76.87 kB | 808.03 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@datadog-datadog-prod-us1
Copy link
Copy Markdown

datadog-datadog-prod-us1 bot commented Jan 26, 2026

⚠️ Tests

Fix all issues with Cursor

⚠️ Warnings

❄️ 1 New flaky test detected

ssrf analyzer ssrf https get with url should have SSRF vulnerability from with url (Datadog) (Fix with Cursor)
Timeout of 5000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (D:\a\dd-trace-js\dd-trace-js\packages\dd-trace\test\appsec\iast\analyzers\ssrf-analyzer.spec.js)

Error: Timeout of 5000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (D:\a\dd-trace-js\dd-trace-js\packages\dd-trace\test\appsec\iast\analyzers\ssrf-analyzer.spec.js)
    at listOnTimeout (node:internal/timers:605:17)
    at process.processTimers (node:internal/timers:541:7)

ℹ️ Info

🧪 All tests passed

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: d6699b7 | Docs | Datadog PR Page | Was this helpful? Give us feedback!

@pr-commenter
Copy link
Copy Markdown

pr-commenter bot commented Jan 26, 2026

Benchmarks

Benchmark execution time: 2026-01-30 13:34:02

Comparing candidate commit d6699b7 in PR branch watson/DEBUG-3799/use-source-maps-for-probe-results with baseline commit 38b60f7 in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 228 metrics, 32 unstable metrics.

@watson watson force-pushed the watson/DEBUG-3799/use-source-maps-for-probe-results branch from 88c9de7 to e7b2698 Compare January 26, 2026 14:55
@watson watson added the debugger Dynamic Instrumentation & Live Debugger label Jan 26, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.86%. Comparing base (38b60f7) to head (d6699b7).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7336   +/-   ##
=======================================
  Coverage   85.86%   85.86%           
=======================================
  Files         518      518           
  Lines       22374    22374           
=======================================
  Hits        19211    19211           
  Misses       3163     3163           
Flag Coverage Δ
aiguard-macos 99.09% <ø> (ø)
aiguard-ubuntu 99.09% <ø> (ø)
aiguard-windows 99.09% <ø> (ø)
apm-capabilities-tracing-macos 57.66% <ø> (ø)
apm-capabilities-tracing-ubuntu 57.65% <ø> (ø)
apm-capabilities-tracing-windows 57.28% <ø> (ø)
apm-integrations-child-process 99.19% <ø> (ø)
apm-integrations-couchbase-18 100.00% <ø> (ø)
apm-integrations-couchbase-eol 100.00% <ø> (ø)
appsec-express 62.54% <ø> (ø)
appsec-fastify 58.55% <ø> (ø)
appsec-graphql 53.40% <ø> (ø)
appsec-kafka 43.98% <ø> (ø)
appsec-ldapjs 46.04% <ø> (ø)
appsec-lodash 47.29% <ø> (ø)
appsec-macos 93.76% <ø> (ø)
appsec-mongodb-core 51.82% <ø> (ø)
appsec-mongoose 50.73% <ø> (ø)
appsec-mysql 54.16% <ø> (ø)
appsec-node-serialize 43.92% <ø> (ø)
appsec-passport 48.07% <ø> (ø)
appsec-postgres 54.51% <ø> (ø)
appsec-sourcing 33.80% <ø> (+0.03%) ⬆️
appsec-template 43.92% <ø> (ø)
appsec-ubuntu 93.76% <ø> (ø)
appsec-windows 93.76% <ø> (ø)
llmobs-ai 52.09% <ø> (ø)
llmobs-anthropic 42.73% <ø> (ø)
llmobs-bedrock 40.06% <ø> (ø)
llmobs-google-genai 45.89% <ø> (ø)
llmobs-langchain 50.15% <ø> (ø)
llmobs-openai 55.62% <ø> (ø)
llmobs-vertex-ai 44.48% <ø> (ø)
platform-core 87.23% <ø> (ø)
platform-instrumentations-misc 89.16% <ø> (ø)
platform-shimmer 98.80% <ø> (ø)
platform-unit-guardrails 89.47% <ø> (ø)
profiling-macos 70.74% <ø> (ø)
profiling-ubuntu 70.74% <ø> (ø)
profiling-windows 74.20% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@watson watson force-pushed the watson/DEBUG-3799/use-source-maps-for-probe-results branch from e7b2698 to 66efe77 Compare January 26, 2026 15:02
@watson watson requested a review from a team as a code owner January 26, 2026 15:02
tylfin
tylfin previously approved these changes Jan 26, 2026
When a probe is hit, stack traces now correctly show original source
file locations (e.g., TypeScript files) instead of transpiled code,
matching the behavior of breakpoint locations.

Added async source map transformation to getStackFromCallFrames using
the existing SourceMapConsumer.originalPositionFor method. Stack
frames gracefully fall back to generated positions if transformation
fails.
Address PR review feedback:

- Remove unused _scriptSourceMaps test exposure (not used in tests)
- Move getOriginalPosition to module-level import alongside
  loadSourceMapSync, eliminating all runtime overhead from lazy
  loading since the module was already imported

Tests: All 82 tests in state.spec.js pass
@watson watson force-pushed the watson/DEBUG-3799/use-source-maps-for-probe-results branch from 66efe77 to d6699b7 Compare January 30, 2026 13:17
@watson watson requested a review from BridgeAR January 30, 2026 13:19
Copy link
Copy Markdown
Member

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code itself is LGTM. I did not closely look at the tests.

@watson watson enabled auto-merge (squash) January 30, 2026 13:27
@watson watson merged commit f8c4334 into master Jan 30, 2026
823 of 824 checks passed
@watson watson deleted the watson/DEBUG-3799/use-source-maps-for-probe-results branch January 30, 2026 13:39
dd-octo-sts bot pushed a commit that referenced this pull request Jan 31, 2026
When a probe is hit, stack traces now correctly show original source
file locations (e.g., TypeScript files) instead of transpiled code,
matching the behavior of breakpoint locations.

Added async source map transformation to getStackFromCallFrames using
the existing SourceMapConsumer.originalPositionFor method. Stack
frames gracefully fall back to generated positions if transformation
fails.
@dd-octo-sts dd-octo-sts bot mentioned this pull request Jan 31, 2026
BridgeAR pushed a commit that referenced this pull request Feb 5, 2026
When a probe is hit, stack traces now correctly show original source
file locations (e.g., TypeScript files) instead of transpiled code,
matching the behavior of breakpoint locations.

Added async source map transformation to getStackFromCallFrames using
the existing SourceMapConsumer.originalPositionFor method. Stack
frames gracefully fall back to generated positions if transformation
fails.
BridgeAR pushed a commit that referenced this pull request Feb 22, 2026
When a probe is hit, stack traces now correctly show original source
file locations (e.g., TypeScript files) instead of transpiled code,
matching the behavior of breakpoint locations.

Added async source map transformation to getStackFromCallFrames using
the existing SourceMapConsumer.originalPositionFor method. Stack
frames gracefully fall back to generated positions if transformation
fails.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

debugger Dynamic Instrumentation & Live Debugger semver-patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants