← Back to Pull requests

fix(telemetry): report non-instrumented ESM packages in dependency telemetry #10927

Closed
unknown closed this pull request without merging on Nov 02, 2026 22:14 UTC
View on GitHub
unknown unknown commented on Oct 26, 2026 10:48 UTC
Author

What does this PR do?

Reports ESM packages that dd-trace does not instrument in the app-dependencies-loaded telemetry, without wrapping them.

  • loader-hook.mjs reports the first loaded file of each node_modules package from its load/loadSync hooks. The async loader sends reports to the application thread over a MessagePort passed by register.js; the sync loader publishes directly.

  • Reports go to dd-trace:moduleLoadStart, the channel dependency telemetry already listens to, as iitm.js did for every ESM module before #6455. Each one is closed right away on dd-trace:moduleLoadEnd, so consumers that pair both stay balanced. Reports are also kept, so telemetry/dependencies.js replays the ones published before the tracer started.
  • Motivation

    Since #6455 (v5.75.0, v6.0.0), import-in-the-middle only wraps instrumented modules, so ESM-only packages without a dd-trace plugin (e.g. axios >= 1, nanoid) never reach the Runtime SCA dependency inventory.

    Jira: APPSEC-62647

    Additional Notes

  • Non-instrumented CommonJS packages imported from ESM are now reported too.

  • Overhead, measured locally (ESM app importing 23 non-instrumented ESM-only packages, 40 alternating runs per side, medians):
  • | | Node.js 22.20 (async loader) | Node.js 26.11 (sync loader) |
    |---|---|---|
    | Graph loaded | 115.0 → 114.8 ms | 84.6 → 85.2 ms |
    | Process wall time | 168.2 → 168.6 ms | 131.9 → 133.0 ms |
    | Max RSS | 94.2 → 94.5 MB | 92.8 → 93.0 MB |

  • Supersedes #10841
  • Diff: 191 lines (+143 / -48) across 2 files Reviewer: bengl Review duration: 10765m
    All Vouch review confidence checks passed
    Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.36 · 191 lines diff across 2 files
    0.36
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.315
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #10927"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 35.9% (MEDIUM) · Higher = larger blast radius
    35.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 14.2% · Safe to merge
    14.2%