← Back to Pull requests

fix(runtime): avoid native startup failures on Bun #11267

Closed
unknown closed this pull request without merging on Nov 23, 2026 18:14 UTC
View on GitHub
unknown unknown commented on Nov 16, 2026 19:16 UTC
Author

What does this PR do?


Part of experimental Bun support. On Bun only, config/index.js turns off three features that crash or fail on Bun: native runtime metrics (runtimeMetrics.native), heap profiling (DD_PROFILING_HEAP_ENABLED) and IAST. The effective values are reported in configuration telemetry, and a diagnostic is logged when a user had explicitly enabled one of them. runtime_metrics.js and profiling/config.js are unchanged from master.

The deactivations share the existing unsupported-runtime block and retain Deno behavior. An unset heap flag is overridden only when the legacy profiler list selects space; otherwise its default telemetry origin is preserved.

Motivation


  • Runtime metrics: enabling them aborts Bun in a native libuv watcher.

  • IAST: enabling it terminates Bun while loading a V8 binding.

  • Heap profiling: starting the heap profiler prevents the other profilers from uploading.
  • All changes are gated on process.versions.bun, so Node behavior is unchanged.

    Additional Notes


  • npm run test:integration:bun: 20 passing. These cover native-metrics safety, IAST deactivation, and wall/timeline uploads with default settings, explicit heap enablement, DD_PROFILING_PROFILERS=space,wall, both together, and wall-only selection. Upload assertions check wall/events types and attachments, not JavaScript samples. On unchanged master the original scenarios abort, exit, or upload no profiles.

  • Config spec: 615 passing, 3 pending, including Deno and telemetry-origin regressions. Runtime metrics through the suite runner: 46 passing. npm run test:profiler: 222 passing, 5 pending. Changed-file ESLint and npm run lint:editorconfig pass. The heap-origin regression fails on parent commit 9cfc65784 and passes with this fix.

  • Directly invoking the runtime-metrics spec through mocha-run-file.js with file-redirected output produces two active-resource assertions on both the parent commit and this branch; the canonical suite runner passes. The first profiler invocation exited 1 with zero failing assertions; a rerun exited 0, and the initial cause is unconfirmed.

  • Bun currently returns zero event-loop utilization counters, so ELU is not meaningful on Bun. This is left to Bun and not worked around here.

  • Heap/allocation profiling, IAST, and JavaScript stack samples in wall profiles remain unsupported on Bun.
  • Link to Devin session: https://datadog-poc.devinenterprise.com/sessions/6036e8df687647e7bf8c26793a98b08b
    Open in Devin Desktop: https://datadog-poc.devinenterprise.com/desktop/session/6036e8df687647e7bf8c26793a98b08b?variant=devin
    Requested by: @eam1813

    Diff: 330 lines (+247 / -83) across 4 files Reviewer: pabloerhard Review duration: 10018m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 330 lines diff across 4 files
    0.42
    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.347
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #11267"
    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: 42.1% (MEDIUM) · Higher = larger blast radius
    42.1%
    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: 16.6% · Safe to merge
    16.6%