Skip to content

test(integration): cover cold-start module tracing - #843

Draft
joeyzhao2018 wants to merge 1 commit into
mainfrom
joey/cold-start-integration-tests
Draft

joeyzhao2018 wants to merge 1 commit into
mainfrom
joey/cold-start-integration-tests

Conversation

@joeyzhao2018

Copy link
Copy Markdown
Collaborator

What does this PR do?

Add seven local RIE integration cases for the existing cold-start tracing feature, covering npm redirect and layer handler entrypoints:

  • Enabled tracing: one initialization/load span and the known module-load spans.
  • Skip-library filtering, including the skipped module's subtree.
  • Minimum-duration filtering.
  • Disabled tracing.
  • Suppression for provisioned concurrency and managed instances.

A shared handler loads real CommonJS modules under /var/task, /opt, and /var/runtime during initialization, then lazily loads another module on invocation two. Each case invokes the same environment nine times.

The raw-log checker verifies span cardinality across all exports, trace/parent relationships, path classification, initialization timing, warm-load parenting, and absence of stale replay. Module-load markers prove that suppression cases really execute the fixture modules. The managed fixture explicitly uses one worker so warm-cache assertions are meaningful.

Motivation

Existing cases disable cold-start tracing, so they do not protect this behavior during the Node.js migration. The new positive cases already exposed an existing dd-trace module-load bookkeeping bug.

These cases use structural assertions rather than new log goldens: real load durations change which non-fixture modules exceed the tracing threshold. Known fixture modules use a 50ms blocking wait against a 10ms threshold, avoiding machine-speed-dependent expectations about the entire tree.

Existing return-value snapshots and runtime-tag checks still apply. Existing log goldens, normalization, production code, and dependency pins are unchanged.

Testing Guidelines

  • node --test integration_tests_local/check-*.test.js: 41 passing, including 32 new checker tests. Negative tests cover missing capture, duplicates, incorrect parenting/classification, orphaned/cyclic trees, filtering violations, and stale replay.
  • bash -n integration_tests_local/run.sh: pass.
  • Prettier checks for new JS files: pass.
  • npm run lint and git diff --check: pass.
  • Node18/20 arm64, unmodified dd-trace 5.126.0: all seven cold-start cases pass, nine invocations each.
  • Node22/24/26 arm64, dd-trace 6.15.0 with only the fixed ritm.js mounted read-only: all seven cases pass, nine invocations each. This is isolated-fix validation, not a passing result for the unmodified release or the full migration candidate.
  • Existing npm/layer ESM cases match unchanged goldens on Node22/24/26 with that overlay; the existing CJS case also matches on Node22.

The workflow runs the checker tests and new cases in the existing Node18/20/22/24/26 × amd64/arm64 matrix. Local validation above is arm64 only; this is emulator coverage, not deployed AWS certification.

Additional Notes

Draft / release dependency: DataDog/dd-trace-js#10535

The positive cases fail with the current v6 tracer pin: a caught module-loading error leaves the cold-start capture stack unfinished, so application module spans are missing. CI intentionally uses the normal released dependencies—no overlay, skipped assertions, or expected-failure exemption has been added. The current v6 integration jobs are therefore expected to remain red until the upstream fix is released and pinned here.

Before marking this ready:

  • Merge and release the dd-trace fix.
  • Update the affected tracer dependency pin/lockfile to that release.
  • Run the full runtime/architecture matrix without an overlay; keep all assertions strict.

No golden capture or recapture is needed. Structural failures save raw logs under /tmp/l2-raw-*.log.

Types of Changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (integration tests and documentation)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog
  • This PR passes the integration tests (blocked on the released tracer fix as described above)

@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Pipelines

✨ Unblock PR with BitsAI

❌ Errors

Your PR has failed checks. Please review the issues below and take necessary action before merging.

🚦 6 Pipeline jobs failed

local integration tests | nodejs22.x (amd64) — 🔧 Needs a code fix, caused by this PR

View more details · View in GitHub Actions

local integration tests | nodejs22.x (arm64) — 🔧 Needs a code fix, caused by this PR

View more details · View in GitHub Actions

local integration tests | nodejs24.x (amd64) — 🔧 Needs a code fix, caused by this PR

View more details · View in GitHub Actions

View all 6 failed jobs.

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 0f389cb | Docs | View more details | Give us feedback!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant