test(integration): add timeout golden coverage - #842
joeyzhao2018 wants to merge 7 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 85fdb2ee23
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| assert.ok(index > startIndex && index < reports.get(requestId), "span exported before runtime timeout REPORT"); | ||
| // The configured guard fires ~1.5s in, allowing 1s of scheduling overhead. | ||
| // Merely checking <5s would also accept a broken/default 100ms flush deadline. | ||
| assert.ok(span.duration > 0 && span.duration < 2.5e9, "span must honor the 3500ms flush deadline"); |
There was a problem hiding this comment.
Enforce a lower bound on the timeout span duration
The assertion accepts any positive duration below 2.5 seconds, so a regression that schedules the timeout callback immediately—such as an incorrect delay calculation or clamping to zero—would still pass while violating the intended roughly 1.5-second trigger. Since duration is removed from the golden during normalization, no other assertion catches this; add a reasonable lower bound as well as the existing upper bound.
Useful? React with 👍 / 👎.
What does this PR do?
Adds pre-migration timeout golden coverage to the local RIE integration suite:
manual-timeout: explicit tracer initialization followed by manualdatadog(handler)wrapping.cjs-timeout: the same handler through theDD_LAMBDA_HANDLERredirect.timeout.unfinishedchild span open beyond the real five-second RIE deadline.RIE_HTTP_TRANSPORT=containerfor local environments whose published host ports are unreachable.No production library changes. The test-only Lambda runtime images are now pinned to multi-architecture digests; three existing expectations are refreshed for the reviewed Node 22/24 runtime update.
Motivation
Freeze the existing timeout contract before moving Lambda instrumentation into dd-trace. Checking all trace payloads prevents a matching span from hiding a duplicate invocation span in another trace.
Testing Guidelines
Validation on the merged pre-migration baseline
291fd14e(datadog-lambda-js12.143.0):container-cjsandmanual-throw-errorsnapshots passed unchanged on Node 22.node --test integration_tests_local/check-timeout-logs.test.js: 9 passed.Additional Notes
The log differences are
dd_traceversion taglinks: []fieldsNo checker assertions or normalization rules were loosened; timeout return-value goldens are unchanged.
CI then exposed floating-runtime drift: local cached images were from August 28 while clean CI runners pulled newer Node 22/24 images. Reproduced both differences with CI's exact images and reviewed their runtime source. The proactive-init snapshots now retain the new structured
runtime_worker_pool_initializingDEBUG record; the Node 24 thrown-error response now retains itsrequestIdfield with existing value normalization. No runtime log filtering or behavior assertions were weakened. The existing thrown-error log golden and all timeout goldens are unchanged by this follow-up. Test image digests are pinned inlambda_node_image_tag()so local and CI runs cannot silently diverge again.The earlier
cf751a76capture used dd-trace 5.105.0 on all runtimes and was no longer the correct baseline after merging main. The README records current provenance and verification.Local validation used
RIE_HTTP_TRANSPORT=containerto bypass broken Colima host-port forwarding. Native amd64 and real AWS timeout validation were not run locally. These are emulator goldens, not proof of deployed Lambda termination or layer packaging. CI run 36170985446 passed all ten native runtime/architecture jobs on85fdb2ee: Node 18/20/22/24/26 on amd64 and arm64, including the no-snapshot-writes guard. Unrelated migration-planning edits remain outside this PR.Types of Changes
Check all that apply