diff --git a/.github/workflows/integration_tests_local.yml b/.github/workflows/integration_tests_local.yml new file mode 100644 index 00000000..ccda10ac --- /dev/null +++ b/.github/workflows/integration_tests_local.yml @@ -0,0 +1,56 @@ +name: local integration tests + +# Runs the docker-only integration test harness in integration_tests_local/ +# against the real AWS Lambda base images + the Runtime Interface Emulator +# (RIE). No AWS account or credentials required. +# +# One job per Node major version; each job builds and tests both container +# variants (cjs, esm), which share the same ~1 GB base image, so each job +# pulls it exactly once. If public.ecr.aws anonymous pull limits ever bite, +# the fix is to mirror the base images to GHCR (same pattern dd-trace-js +# uses in its mirror-image.yml workflow). + +on: + pull_request: + push: + branches: + - "main" + workflow_dispatch: + +jobs: + container: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + node_major: ["18", "20", "22", "24", "26"] + + steps: + - name: Checkout + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + + - name: Set up Node 18.12 + uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3.9.1 + with: + node-version: 18.12 + + - name: Run local container integration tests (nodejs${{ matrix.node_major }}.x) + run: PLATFORM=linux/amd64 RUNTIME_PARAM=${{ matrix.node_major }} ./integration_tests_local/run.sh + + # Every leg is a strict comparison, so a run must leave the snapshots + # untouched. Writing here would mean the harness recorded its own output + # as the expectation instead of checking against it. + - name: Assert no snapshot was written + if: always() + run: | + if ! git diff --exit-code --stat integration_tests_local/snapshots; then + echo "FAILURE: this run modified committed snapshots" >&2 + exit 1 + fi + new_files=$(git ls-files --others --exclude-standard integration_tests_local/snapshots) + if [ -n "$new_files" ]; then + echo "FAILURE: strict leg created snapshots instead of comparing:" >&2 + echo "$new_files" >&2 + exit 1 + fi diff --git a/.gitignore b/.gitignore index 6e86ecca..449c8ae5 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,6 @@ package-lock.json # Local datadog-lambda-js tarballs produced for container integration tests integration_tests/container/*/datadog-lambda-js-local.tgz + +# Local integration test harness binaries +integration_tests_local/bin/ diff --git a/integration_tests_local/.gitignore b/integration_tests_local/.gitignore new file mode 100644 index 00000000..e660fd93 --- /dev/null +++ b/integration_tests_local/.gitignore @@ -0,0 +1 @@ +bin/ diff --git a/integration_tests_local/README.md b/integration_tests_local/README.md new file mode 100644 index 00000000..520cbece --- /dev/null +++ b/integration_tests_local/README.md @@ -0,0 +1,229 @@ +# Local integration tests (docker + AWS RIE, no AWS account required) + +This directory contains a **local** integration test harness for +datadog-lambda-js. It runs the container-image handler variants +(`integration_tests/container/cjs` and `integration_tests/container/esm`) +inside Docker against the +[AWS Lambda Runtime Interface Emulator (RIE)](https://github.com/aws/aws-lambda-runtime-interface-emulator), +invokes them with the same input events as the AWS-based suite, captures +logs from `docker logs`, normalizes them with `./normalize.sh` — the AWS +suite's filter chain plus documented RIE-specific handling, not an identical +copy — and diffs them against **local** snapshots in `./snapshots/`. + +Nothing here touches AWS, and nothing here touches +`integration_tests/snapshots/` (the AWS suite's snapshots). + +## Prerequisites + +- Docker (tested with colima on macOS arm64) +- `node`, `yarn`, `perl`, `sed`, `curl` (all already used by the AWS suite) +- Network access for the first run (pulls `public.ecr.aws/lambda/nodejs:*` + base images, ~1 GB each, and downloads the pinned RIE binary into `./bin/`) + +## Running + +```bash +# Everything: nodejs 18/20/22/24/26 x {cjs, esm} +./integration_tests_local/run.sh + +# One runtime / one variant +RUNTIME_PARAM=18 VARIANT_PARAM=esm ./integration_tests_local/run.sh + +# (Re)generate local snapshots +UPDATE_SNAPSHOTS=true ./integration_tests_local/run.sh + +# Skip repacking the library (reuse container/*/datadog-lambda-js-local.tgz) +SKIP_PACK=true RUNTIME_PARAM=18 VARIANT_PARAM=esm ./integration_tests_local/run.sh + +# Force amd64 images instead of arm64 +PLATFORM=linux/amd64 ./integration_tests_local/run.sh +``` + +Unless `SKIP_PACK=true` is set, each run repacks the library under test +(`yarn install --frozen-lockfile && yarn build && npm pack`) into +`integration_tests/container/{cjs,esm}/datadog-lambda-js-local.tgz`, exactly +like `scripts/run_integration_tests.sh` does, so the containers always test +the working tree. + +The harness takes no flags or positional arguments — configuration is +environment-only, and an unexpected argument is rejected rather than ignored. + +Without `UPDATE_SNAPSHOTS=true`, every expected return-value and log snapshot +must already exist. A missing snapshot fails the run and is never created +implicitly. Update mode is the only path that creates or overwrites snapshots. + +## Snapshot layout: shared goldens with per-case overrides + +There are three committed snapshots, not one per case: + +``` +snapshots/return_values/default.json # every event, every runtime, every variant +snapshots/logs/cjs.log # nodejs 18/20/22/24/26, cjs +snapshots/logs/esm.log # nodejs 18/20/22/24/26, esm +``` + +All 9 input events return the same fixture response, and the normalized logs +are identical across all five runtimes, so a per-case file per leg would be 80 +copies of 3 distinct expectations — and 80 files to review when one of them +legitimately changes. + +Two things make the sharing safe rather than lossy: + +- **The runtime is asserted before it is collapsed.** `runtime:nodejsNN.x` is + the only genuinely runtime-specific line in the log. `run.sh` checks that it + appears on every invocation with the major actually under test, and only then + rewrites it to `nodejsXX.x`. Sharing the golden therefore does not stop the + suite from checking that the library reports the runtime it is running on. +- **`AWS_LAMBDA_FUNCTION_NAME` carries no runtime major.** It propagates into + `service`, `resource`, `resource_names`, `functionname`, `function_arn`, + `_dd.base_service` and `_dd.tags.process`, so embedding the runtime there + made every runtime's golden differ in ~100 lines of pure fixture naming, + burying the one line that was actually runtime-specific. + +Divergence is expressed by **adding a file**, never by loosening a comparison: + +``` +snapshots/logs/${variant}_node${major}.log # overrides the shared log +snapshots/return_values/${variant}_node${major}_${event}.json # overrides the shared return value +``` + +When an override is present it wins for that leg alone. This keeps a real +behavioral difference visible in review, whereas widening a normalization +filter to absorb it would be invisible. + +In update mode, a leg that disagrees with an existing shared golden **fails** +instead of overwriting it — otherwise the last runtime to run would silently +define the expectation for all of them. + +## Pinned runtime infrastructure + +The harness pins AWS Runtime Interface Emulator (RIE) `v1.36` and verifies the +cached binary on every run before mounting it into a container: + +| Asset | SHA-256 | +|---|---| +| `aws-lambda-rie-x86_64` | `ba57f2683260127135ad5ba9bafea141f90492143cbaeb9312cde6dae8d1c08e` | +| `aws-lambda-rie-arm64` | `7826415f278663274e279085ff96d7c9da210a30213fa72279e56e59f028ce76` | + +If `./bin/aws-lambda-rie` is absent or has a different checksum, `run.sh` +downloads and verifies the platform-specific asset before replacing the cache. + +Node 26 is still preview-only in ECR Public: the bare +`public.ecr.aws/lambda/nodejs:26` tag does not exist. The logical runtime stays +`26` for image names, function names, and snapshot paths, while the Docker +base-image build argument maps to the dated multi-arch tag +`26-preview.2026.08.21.22`. + +Node 26 is a strict leg like every other: its normalized output matches the +shared goldens exactly, so it needs no snapshots of its own. + +When AWS publishes the bare Node 26 GA image, swap the pinned tag and re-run. +If GA output diverges, add a `*_node26` override captured from the pinned +pre-migration ref rather than absorbing the difference into `normalize.sh` — +the oracle is tied to the implementation under test, and a base-image change +must be reviewed, not hidden by normalization. + +## Proactive-initialization simulation (manual diagnostic, not a gate) + +**Nothing uses this.** It is not set in CI, not set in the default run, and +nothing gates on it. A run with it is **expected to differ** from the goldens +rather than match them, so it is a tool for reproducing a sandbox state by +hand and reading the diff — not a pass/fail check. It also cannot affect the +baseline: in update mode the shared-golden guard rejects a proactive run +instead of overwriting. Update this section if it ever becomes part of the +gate. + +```bash +SIMULATE_PROACTIVE_INIT=true RUNTIME_PARAM=18 VARIANT_PARAM=esm ./integration_tests_local/run.sh +``` + +The library stamps `initTime = Date.now()` at wrapper-module load +(`src/index.ts`) and marks the sandbox as proactively initialized when the +first invocation starts more than 10 s after that +(`src/utils/cold-start.ts`). On real Lambda, AWS sometimes runs the init +phase well before the first invoke (proactive initialization), flipping that +flag. + +Reproducing this under RIE takes two ingredients, because **the classic RIE +runs the init phase lazily on the first invocation** — a post-start `sleep` +alone creates no init→invoke gap (verified: with only a sleep, the logs are +byte-identical to an immediate run): + +1. `run.sh` sets `AWS_LAMBDA_MAX_CONCURRENCY=1`, which switches the same RIE + binary into its managed-instances path; that path performs the init phase + (bootstrap + wrapper module load) **eagerly at container start**. Side + effects are contained: the function env gains + `AWS_LAMBDA_INITIALIZATION_TYPE=lambda-managed-instances`, which the + library only uses to gate cold-start tracing spans (already disabled here + via `DD_COLD_START_TRACING=false`), and `AWS_LAMBDA_LOG_FORMAT=text` is + pinned to keep runtime logs in the classic text format. +2. `run.sh` then sleeps 15 s before the first invocation, producing an + init→invoke gap > 10 s. + +The first invocation then emits, exactly as in the CI failure on +`container-esm_node18`: + +- `"proactive_initialization": 1` in the `aws.lambda` span's `metrics`, +- `"proactive_initialization:true"` in the `aws.lambda.enhanced.invocations` + metric tags, +- `cold_start:false` (instead of `true`) on the first invocation. + +A `SIMULATE_PROACTIVE_INIT=true` run is therefore **expected to fail** the +diff against the immediate-run snapshots, with precisely those lines added +(plus RIE-mode platform-log noise: `INIT/REPORT` line shapes and the emulated +region/account in ARNs differ between the two RIE paths). The platform-side +half of the CI diff, `END Duration: XXXX ms (init: XXXX ms)`, is emitted by +the real Lambda platform and does not appear under RIE in either mode. + +## Files + +- `run.sh` — the runner (build images, run under RIE, invoke, diff snapshots) +- `normalize.sh` — the local log-normalization pipeline, based on the AWS + suite's filters with documented RIE-specific handling. Reads stdin, writes + stdout; honors `RUN_ID` for optional per-run ID stripping. +- `bin/` — downloaded RIE binary (gitignored) +- `snapshots/logs/` — normalized log snapshots, shared per variant across + runtimes, with optional `${variant}_node${major}.log` overrides +- `snapshots/return_values/` — handler return-value snapshot, shared by every + case, with optional `${variant}_node${major}_${event}.json` overrides + +## Comparison with the AWS-based suite + +| | AWS suite (`scripts/run_integration_tests.sh`) | this harness | +|---|---|---| +| handlers | 9 variants (layers + container images) | container images only (cjs, esm) | +| infra | real Lambda via serverless, CloudWatch logs | docker + RIE, `docker logs` | +| snapshots | `integration_tests/snapshots/` | `integration_tests_local/snapshots/` | +| credentials | AWS account + DD_API_KEY | none | +| cost/wait | deploy + invoke + 20 s log wait | image build + invoke | + +Local snapshots legitimately differ from the AWS ones (fake account/region +context, no real API Gateway IDs, RIE-formatted `START`/`END`/`REPORT` +lines, no platform `init:` duration suffix). Do not diff one suite's output +against the other's snapshots. + +## Known emulation gaps (RIE vs real Lambda) + +- The classic RIE runs the init phase **lazily on the first invocation**, so + init→invoke timing behavior (proactive initialization) cannot be observed + in the default mode; use `SIMULATE_PROACTIVE_INIT=true`, which switches + RIE to its eager-init managed-instances path (see above). +- No platform `INIT_START` / `END ... (init: N ms)` lines — those come from + the Lambda platform, not the runtime. +- No real AWS service context: API Gateway/DynamoDB/S3/SNS/SQS resource ARNs, + account IDs, and inferred-span metadata are derived only from the event + payloads, so they differ from the AWS snapshots. +- `AWS_REGION` is faked to `eu-west-1` to keep the enhanced-metric region + tag stable. +- Enhanced metrics that depend on platform-provided values (e.g. real + memory size / billed duration) may be absent or differ. +- Onboarding-mode coverage is partial, and it is two modes short, not three. + Both container fixtures end in + `CMD ["node_modules/datadog-lambda-js/dist/handler.handler"]`, so the + **npm-installed** handler path is already exercised on every runtime. What + this harness does not cover is the **layer** path + (`/opt/nodejs/node_modules/datadog-lambda-js/handler.handler`, which needs the + built layer zip and a zip-based deployment model) and **manual** + `datadog(handler)` wrapping in customer code. Adding those two means new + fixtures and new goldens, so they belong to a separately scoped follow-up + rather than to the harness-hardening PR. diff --git a/integration_tests_local/normalize.sh b/integration_tests_local/normalize.sh new file mode 100755 index 00000000..f5ae7ada --- /dev/null +++ b/integration_tests_local/normalize.sh @@ -0,0 +1,82 @@ +#!/bin/bash + +# Local log-normalization pipeline for integration test snapshots. +# +# This is based on the filter chain used by scripts/run_integration_tests.sh +# to replace invocation-specific data (timestamps, IDs, durations, ...) with +# XXXX before diffing logs against snapshots. Local-only RIE filters and +# deterministic cold-start assertions are documented below. +# +# Usage: +# some-log-producer | ./normalize.sh +# RUN_ID=abcdef12 ./normalize.sh < raw.log > normalized.log +# +# Reads from stdin, writes to stdout. +# Optional env: +# RUN_ID - random per-run ID embedded in deployed function names; stripped +# to XXXX when set (AWS suite only; the local harness uses static +# function names and leaves this unset). + +set -e + +script_path=${BASH_SOURCE[0]} +local_dir=$(dirname "$script_path") +repo_dir=$(dirname "$local_dir") + +# An empty Perl program is a pass-through when RUN_ID is unset. +run_id_filter='' +if [ -n "$RUN_ID" ]; then + run_id_filter="s/${RUN_ID}/XXXX/g" +fi + +node "$repo_dir/integration_tests/parse-json.js" | + # Filter serverless cli errors + sed '/Serverless: Recoverable error occurred/d' | + # Normalize Lambda runtime report logs + perl -p -e 's/(RequestId|TraceId|init|SegmentId|Duration|Memory Used|"e"):( )?[a-z0-9\.\-]+/\1:\2XXXX/g' | + # Node.js 26 preview and container-image runtimes emit extra platform noise. + sed '/preview runtime version and should not be used for production workloads/d' | + sed '/^INIT_REPORT /d' | + sed '/DEP0205.*module\.register()/d' | + sed '/node --trace-deprecation.*where the warning was created/d' | + # Normalize DD APM headers and AWS account ID + perl -p -e "s/(x-datadog-parent-id:|x-datadog-trace-id:|account_id:)[0-9]+/\1XXXX/g" | + # Strip API key from logged requests + perl -p -e "s/(api_key=|'api_key': ')[a-z0-9\.\-]+/\1XXXX/g" | + # Normalize log timestamps + perl -p -e "s/[0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]+( \(\-?\+?[0-9:]+\))?/XXXX-XX-XX XX:XX:XX.XXX/" | + # Normalize DD trace ID injection + perl -p -e "s/(dd\.trace_id=)[0-9]+ (dd\.span_id=)[0-9]+/\1XXXX \2XXXX/" | + # Normalize execution ID in logs prefix + perl -p -e $'s/[0-9a-z]+\-[0-9a-z]+\-[0-9a-z]+\-[0-9a-z]+\-[0-9a-z]+\t/XXXX-XXXX-XXXX-XXXX-XXXX\t/' | + # Normalize minor package version tag so that these snapshots aren't broken on version bumps + perl -p -e "s/(dd_lambda_layer:datadog-nodev[0-9]+\.)[0-9]+\.[0-9]+/\1XX\.X/g" | + perl -p -e 's/"(span_id|apiid|runtime-id|record_ids|parent_id|trace_id|start|duration|tcp\.local\.address|tcp\.local\.port|dns\.address|request_id|function_arn|x-datadog-trace-id|x-datadog-parent-id|datadog_lambda|dd_trace|process_id)":\ ("?)[a-zA-Z0-9\.:\-]+("?)/"\1":\2XXXX\3/g' | + # Strip out run ID (from function name, resource, etc.) + perl -p -e "$run_id_filter" | + # Normalize line numbers in stack traces + perl -p -e 's/(.js:)[0-9]*:[0-9]*/\1XXX:XXX/g' | + # Preserve stable span meta and metrics; volatile values are normalized above. + # Normalize enhanced metric datadog_lambda tag + perl -p -e "s/(datadog_lambda:v)[0-9\.]+/\1X.X.X/g" | + # Normalize lookup resource + perl -p -e "s/(\"resource\":\"169.)[0-9\.]+/\1X.X.X/g" | + # Normalize Axios version + perl -p -e "s/User-Agent:axios\/\d+\.\d+\.\d+/User-Agent:axios\/X\.X\.X/g" | + # Remove init start line + perl -p -e "s/INIT_START.*//g" | + # Proactive initialization is platform scheduling, not code behavior. + # Keep cold_start to cover the deterministic local cold-to-warm transition. + sed '/proactive_initialization/d' | + perl -p -e 's/ \(init: [^)]*\)//g' | + # Normalize RIE platform log lines (local harness only; no-op on AWS logs): + # "28 Jul 2026 19:42:34,536 [INFO] (rapid) ..." timestamps, request ids, + # and init/invoke durations vary run to run + perl -p -e 's/^[0-9]{2} \w{3} [0-9]{4} [0-9]{2}:[0-9]{2}:[0-9]{2},[0-9]{3} (\[INFO\] \(rapid\))/XXXX \1/' | + perl -p -e 's/(requestId: )[0-9a-f-]+/\1XXXX/g' | + perl -p -e 's/(duration(Ms)?: )[0-9.]+/\1XXXX/g' | + sed -E "s/(tracestate\:)([A-Za-z0-9\-\=\:\;].+)/\1XXX/g" | + sed -E "s/(\"_dd.p.tid\"\: \")[a-z0-9\.\-]+/\1XXXX/g" | + sed -E "s/(_dd.p.tid=)[a-z0-9\.\-]+/\1XXXX/g" | + # Remove RIE's trailing REPORT tab without changing application output. + sed -E '/^REPORT RequestId:/s/[[:blank:]]+$//' diff --git a/integration_tests_local/run.sh b/integration_tests_local/run.sh new file mode 100755 index 00000000..0636f3ce --- /dev/null +++ b/integration_tests_local/run.sh @@ -0,0 +1,462 @@ +#!/bin/bash + +# Local (docker-based) integration tests for datadog-lambda-js. +# +# Runs the container-image handler variants (container/cjs, container/esm) +# against the AWS Runtime Interface Emulator (RIE) — no AWS account needed. +# Logs are captured from `docker logs`, normalized with the local pipeline in +# ./normalize.sh, and diffed against LOCAL snapshots in ./snapshots/ (not +# integration_tests/snapshots/). +# +# Usage (from repo root or this directory): +# ./integration_tests_local/run.sh # all runtimes, both variants +# RUNTIME_PARAM=18 ./integration_tests_local/run.sh +# RUNTIME_PARAM=18 VARIANT_PARAM=esm ./integration_tests_local/run.sh +# UPDATE_SNAPSHOTS=true ./integration_tests_local/run.sh +# SIMULATE_PROACTIVE_INIT=true RUNTIME_PARAM=18 VARIANT_PARAM=esm ./integration_tests_local/run.sh +# +# Env knobs: +# RUNTIME_PARAM - node major version: 18|20|22|24|26 (default: all) +# VARIANT_PARAM - container variant: cjs|esm (default: both) +# PLATFORM - docker platform (default: linux/arm64) +# UPDATE_SNAPSHOTS=true - overwrite local snapshots instead of diffing +# SIMULATE_PROACTIVE_INIT=true - initialize eagerly, then wait 15s before invoke +# SKIP_PACK=true - reuse existing container/*/datadog-lambda-js-local.tgz + +set -e + +# Reject arguments; configuration is environment-only. +if [ "$#" -gt 0 ]; then + echo "Unexpected argument: $1" >&2 + echo "This script takes no flags or positional arguments; use the env knobs, e.g." >&2 + echo " RUNTIME_PARAM=18 VARIANT_PARAM=esm $0" >&2 + exit 2 +fi + +script_path=${BASH_SOURCE[0]} +local_dir=$(cd "$(dirname "$script_path")" && pwd) +repo_dir=$(dirname "$local_dir") +integration_tests_dir="$repo_dir/integration_tests" + +PLATFORM=${PLATFORM:-linux/arm64} +RIE_VERSION=1.36 +case "$PLATFORM" in + linux/arm64) + RIE_ASSET=aws-lambda-rie-arm64 + RIE_SHA256=7826415f278663274e279085ff96d7c9da210a30213fa72279e56e59f028ce76 + ;; + linux/amd64) + RIE_ASSET=aws-lambda-rie-x86_64 + RIE_SHA256=ba57f2683260127135ad5ba9bafea141f90492143cbaeb9312cde6dae8d1c08e + ;; + *) echo "Unsupported PLATFORM: $PLATFORM (use linux/arm64 or linux/amd64)"; exit 1 ;; +esac + +function contains() { + local candidate=$1 + shift + local item + for item in "$@"; do + if [ "$item" = "$candidate" ]; then + return 0 + fi + done + return 1 +} + +SUPPORTED_RUNTIMES=("18" "20" "22" "24" "26") +RUNTIMES=("${SUPPORTED_RUNTIMES[@]}") +if [ -n "${RUNTIME_PARAM:-}" ]; then + if ! contains "$RUNTIME_PARAM" "${SUPPORTED_RUNTIMES[@]}"; then + echo "Unsupported RUNTIME_PARAM: $RUNTIME_PARAM (use 18, 20, 22, 24, or 26)" + exit 1 + fi + echo "Node version is specified: $RUNTIME_PARAM" + RUNTIMES=("$RUNTIME_PARAM") +else + echo "Node version not specified, running for all node versions." +fi + +SUPPORTED_VARIANTS=("cjs" "esm") +VARIANTS=("${SUPPORTED_VARIANTS[@]}") +if [ -n "${VARIANT_PARAM:-}" ]; then + if ! contains "$VARIANT_PARAM" "${SUPPORTED_VARIANTS[@]}"; then + echo "Unsupported VARIANT_PARAM: $VARIANT_PARAM (use cjs or esm)" + exit 1 + fi + echo "Variant is specified: $VARIANT_PARAM" + VARIANTS=("$VARIANT_PARAM") +fi + +update_snapshots=false +case "${UPDATE_SNAPSHOTS:-}" in + "") ;; + true) update_snapshots=true ;; + *) echo "Unsupported UPDATE_SNAPSHOTS value: $UPDATE_SNAPSHOTS (use true or leave unset)"; exit 1 ;; +esac +if [ "$update_snapshots" = true ]; then + echo "Overwriting snapshots in this execution" +fi +extra_docker_env=() +if [ -n "${SIMULATE_PROACTIVE_INIT:-}" ]; then + echo "SIMULATE_PROACTIVE_INIT: eager init + 15s sleep between container start and first invocation" + # Managed-instances mode initializes eagerly, so the delay creates the + # init-to-invoke gap needed to simulate proactive initialization. + extra_docker_env=(-e AWS_LAMBDA_MAX_CONCURRENCY=1 -e AWS_LAMBDA_LOG_FORMAT=text) +fi + +mismatch_found=false +container_ids=() +rie_download="" + +function cleanup() { + if [ -n "$rie_download" ] && [ -f "$rie_download" ]; then + rm -f "$rie_download" + fi + for cid in "${container_ids[@]}"; do + # Containers removed inline leave an empty slot behind (the + # "${array[@]/$cid}" idiom blanks rather than unsets). + [ -n "$cid" ] || continue + docker rm -f "$cid" >/dev/null 2>&1 || true + done +} +trap cleanup EXIT + +# Download the pinned RIE binary into ./bin (gitignored). Verify the cached +# file on every run so an older `latest` download cannot silently survive. +rie_binary="$local_dir/bin/aws-lambda-rie" +rie_actual_sha256="" +if [ -f "$rie_binary" ]; then + rie_actual_sha256=$(shasum -a 256 "$rie_binary" | awk '{print $1}') +fi +if [ "$rie_actual_sha256" != "$RIE_SHA256" ]; then + if [ -n "$rie_actual_sha256" ]; then + echo "Cached RIE checksum does not match v$RIE_VERSION; downloading the pinned binary" + else + echo "Downloading AWS Runtime Interface Emulator v$RIE_VERSION ($RIE_ASSET)" + fi + mkdir -p "$local_dir/bin" + rie_download=$(mktemp "$local_dir/bin/aws-lambda-rie.XXXXXX") + curl -fSL --retry 3 -o "$rie_download" \ + "https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/download/v$RIE_VERSION/$RIE_ASSET" + rie_actual_sha256=$(shasum -a 256 "$rie_download" | awk '{print $1}') + if [ "$rie_actual_sha256" != "$RIE_SHA256" ]; then + echo "FAILURE: RIE checksum mismatch for $RIE_ASSET" >&2 + echo "Expected: $RIE_SHA256" >&2 + echo "Actual: $rie_actual_sha256" >&2 + exit 1 + fi + chmod +x "$rie_download" + mv "$rie_download" "$rie_binary" + rie_download="" +fi + +# Build and pack the locally-modified datadog-lambda-js so the container-image +# tests install the version under test (same as scripts/run_integration_tests.sh). +if [ -z "$SKIP_PACK" ]; then + echo "Packing local datadog-lambda-js for container tests" + cd "$repo_dir" + yarn install --frozen-lockfile + yarn build + npm pack + cp datadog-lambda-js-*.tgz "$integration_tests_dir/container/cjs/datadog-lambda-js-local.tgz" + cp datadog-lambda-js-*.tgz "$integration_tests_dir/container/esm/datadog-lambda-js-local.tgz" + rm -f datadog-lambda-js-*.tgz +else + echo "SKIP_PACK: reusing existing container/*/datadog-lambda-js-local.tgz" +fi + +input_event_files=$(ls "$integration_tests_dir/input_events") +# Sort event files by name so that snapshots stay consistent +input_event_files=($(for file_name in ${input_event_files[@]}; do echo $file_name; done | sort)) + +set +e # Don't exit this script if an invocation fails or there's a diff + +function lambda_node_image_tag() { + if [ "$1" = "26" ]; then + echo "26-preview.2026.08.21.22" + else + echo "$1" + fi +} + +function compare_snapshot() { + local actual=$1 + local snapshot_path=$2 + local description=$3 + local sort_lines=${4:-false} + local diff_output + local diff_status + + if [ "$sort_lines" = true ]; then + # Preserve normalized whitespace; normalize.sh removes RIE's REPORT tab. + diff_output=$(printf '%s\n' "$actual" | LC_ALL=C sort | diff - <(LC_ALL=C sort "$snapshot_path")) + else + diff_output=$(printf '%s\n' "$actual" | diff - "$snapshot_path") + fi + diff_status=$? + + case "$diff_status" in + 0) + echo "Ok: $description matches snapshot" + ;; + 1) + echo "Failed: $description does not match snapshot:" + echo "$diff_output" + mismatch_found=true + ;; + *) + echo "FAILURE: diff failed for $description (exit $diff_status):" >&2 + echo "$diff_output" >&2 + mismatch_found=true + ;; + esac +} + +# Write a golden in update mode. +# +# A shared golden is written by every leg, so each leg after the first must +# agree with what is already there. If one diverges, the sharing assumption is +# wrong for that case and we say so, rather than letting the last leg to run +# silently overwrite the others. +function write_snapshot() { + local actual=$1 + local snapshot_path=$2 + local description=$3 + local shared=${4:-false} + local sort_lines=${5:-false} + local agree + + if [ "$shared" = true ] && [ -f "$snapshot_path" ]; then + # Agreement must use the same semantics as compare_snapshot. Log lines + # are compared sorted because RIE's platform logging races with + # application output, so RTDONE can land on either side of a nearby + # line; that is ordering noise, not a divergence between runtimes. + if [ "$sort_lines" = true ]; then + printf '%s\n' "$actual" | LC_ALL=C sort | diff -q - <(LC_ALL=C sort "$snapshot_path") >/dev/null + agree=$? + else + [ "$(printf '%s\n' "$actual")" = "$(cat "$snapshot_path")" ] + agree=$? + fi + if [ "$agree" -ne 0 ]; then + echo "FAILURE: $description diverges from shared golden $snapshot_path" >&2 + echo " Shared goldens require every leg to agree. Express a real" >&2 + echo " divergence by adding a case-specific override file, not by" >&2 + echo " overwriting the shared one." >&2 + printf '%s\n' "$actual" | diff - "$snapshot_path" >&2 + mismatch_found=true + return + fi + echo "Ok: $description already matches shared golden $snapshot_path" + return + fi + + echo "Writing $description to $snapshot_path" + printf '%s\n' "$actual" >"$snapshot_path" +} + +for node_version in "${RUNTIMES[@]}"; do + for variant in "${VARIANTS[@]}"; do + handler_name="container-${variant}" + image_tag="datadog-lambda-js-local-test:${handler_name}-node${node_version}" + # AWS_LAMBDA_FUNCTION_NAME deliberately carries no runtime major. It + # propagates into service, resource, resource_names, functionname, + # function_arn, _dd.base_service and _dd.tags.process, so embedding the + # runtime here made every runtime's golden differ in ~100 lines of pure + # fixture naming, which buried the one line that is actually + # runtime-specific. + function_name="integration-tests-js-local-${handler_name}" + node_image_tag=$(lambda_node_image_tag "$node_version") + + echo "" + echo "=== Building $image_tag from Lambda Node image $node_image_tag (platform $PLATFORM) ===" + docker build --platform "$PLATFORM" \ + --build-arg NODE_VERSION="$node_image_tag" \ + -t "$image_tag" \ + "$integration_tests_dir/container/$variant" || exit 1 + + echo "=== Starting $function_name under RIE ===" + cid=$(docker run -d --rm --platform "$PLATFORM" \ + -p 127.0.0.1::8080 \ + -v "$local_dir/bin:/aws-lambda-rie" \ + --entrypoint /aws-lambda-rie/aws-lambda-rie \ + -e DD_API_KEY=local-test \ + -e DD_SITE=datadoghq.com \ + -e DD_FLUSH_TO_LOG=true \ + -e DD_LAMBDA_HANDLER=handler.handle \ + -e DD_INTEGRATION_TEST=true \ + -e DD_COLD_START_TRACING=false \ + -e DD_SERVICE_MAPPING="lambda_api_gateway:remappedApiGatewayServiceName,lambda_sns:remappedSnsServiceName,lambda_sqs:remappedSqsServiceName,lambda_s3:remappedS3ServiceName,lambda_eventbridge:remappedEventBridgeServiceName,lambda_kinesis:remappedKinesisServiceName,lambda_dynamodb:remappedDynamoDbServiceName,lambda_url:remappedUrlServiceName" \ + -e AWS_LAMBDA_FUNCTION_NAME="$function_name" \ + -e AWS_REGION=eu-west-1 \ + ${DD_DEBUG:+-e DD_DEBUG="$DD_DEBUG"} \ + "${extra_docker_env[@]}" \ + "$image_tag" \ + /lambda-entrypoint.sh node_modules/datadog-lambda-js/dist/handler.handler) + container_ids+=("$cid") + + port=$(docker port "$cid" 8080 | head -1 | sed 's/.*://') + echo "Container $cid listening on port $port" + + # Wait for the RIE port to accept TCP connections. NOTE: we must NOT + # probe with a POST to the invocations endpoint — that would consume + # the cold-start first invocation (and break the proactive- + # initialization simulation, which keys off init->first-invoke delay). + ready=false + for i in $(seq 1 60); do + if (exec 3<>"/dev/tcp/localhost/$port") 2>/dev/null; then + ready=true + break + fi + sleep 0.5 + done + if [ "$ready" != true ]; then + echo "FAILURE: $function_name did not become ready. Container logs:" + docker logs "$cid" 2>&1 | tail -30 + mismatch_found=true + docker rm -f "$cid" >/dev/null 2>&1 + container_ids=("${container_ids[@]/$cid}") + continue + fi + + if [ -n "${SIMULATE_PROACTIVE_INIT:-}" ]; then + echo "Sleeping 15s to simulate proactive initialization..." + sleep 15 + fi + + echo "=== Invoking $function_name with input events ===" + for input_event_file in "${input_event_files[@]}"; do + input_event_name=$(echo "$input_event_file" | sed "s/.json//") + # curl does not fail on HTTP errors, so validate the response status. + invoke_response=$(curl -s -w '\n%{http_code}' -XPOST \ + "http://localhost:$port/2015-03-31/functions/function/invocations" \ + -d @"$integration_tests_dir/input_events/$input_event_file") + invoke_success=$? + http_code=$(printf '%s' "$invoke_response" | tail -n1) + return_value=$(printf '%s' "$invoke_response" | sed '$d') + if [ $invoke_success -ne 0 ]; then + echo "FAILURE: Invocation transport error (curl exit $invoke_success) for $handler_name with $input_event_name" >&2 + mismatch_found=true + continue + fi + if [ "$http_code" != "200" ]; then + echo "FAILURE: Invocation returned HTTP $http_code for $handler_name with $input_event_name" >&2 + echo " body: $return_value" >&2 + mismatch_found=true + continue + fi + echo " $input_event_name -> $return_value" + + # Every runtime, variant and input event returns the same fixture + # response, so one shared golden carries the whole assertion. A + # case-specific file wins when present: that is how an event which + # legitimately returns something else gets expressed, and adding a + # file is visible in review where loosening a comparison is not. + case_return_snapshot="$local_dir/snapshots/return_values/${variant}_node${node_version}_${input_event_name}.json" + if [ -f "$case_return_snapshot" ]; then + return_snapshot=$case_return_snapshot + return_shared=false + else + return_snapshot="$local_dir/snapshots/return_values/default.json" + return_shared=true + fi + + if [ "$update_snapshots" = true ]; then + write_snapshot "$return_value" "$return_snapshot" \ + "Return value for $handler_name with $input_event_name" \ + "$return_shared" + elif [ ! -f "$return_snapshot" ]; then + echo "Failed: Missing return-value snapshot: $return_snapshot" + mismatch_found=true + else + compare_snapshot "$return_value" "$return_snapshot" \ + "Return value for $handler_name with $input_event_name" + fi + done + + # Wait for both completion markers; RIE may emit RTDONE after REPORT. + # The managed-instances path used by SIMULATE_PROACTIVE_INIT emits + # REPORT but never RTDONE, so requiring it there would always time out. + expected_invocation_count=${#input_event_files[@]} + if [ -n "${SIMULATE_PROACTIVE_INIT:-}" ]; then + expected_rtdone_count=0 + else + expected_rtdone_count=$expected_invocation_count + fi + logs_ready=false + raw_logs="" + for i in $(seq 1 40); do + raw_logs=$(docker logs "$cid" 2>&1) + report_count=$(printf '%s\n' "$raw_logs" | grep -c '^REPORT RequestId:' || true) + rtdone_count=$(printf '%s\n' "$raw_logs" | grep -c 'INVOKE RTDONE' || true) + if [ "$report_count" -ge "$expected_invocation_count" ] && \ + [ "$rtdone_count" -ge "$expected_rtdone_count" ]; then + logs_ready=true + break + fi + sleep 0.25 + done + if [ "$logs_ready" != true ]; then + echo "FAILURE: Timed out waiting for $expected_invocation_count REPORT and $expected_rtdone_count RTDONE markers from $function_name; found $report_count/$rtdone_count" >&2 + echo "$raw_logs" | tail -30 >&2 + mismatch_found=true + docker rm -f "$cid" >/dev/null 2>&1 + container_ids=("${container_ids[@]/$cid}") + continue + fi + + logs=$(printf '%s\n' "$raw_logs" | "$local_dir/normalize.sh") + + # `runtime:nodejsNN.x` is the only genuinely runtime-specific line in the + # whole log — everything else is identical across 18/20/22/24/26. Assert + # it explicitly, then collapse it so one golden serves every runtime. + # Without this assertion, sharing the golden would silently stop checking + # that the library reports the runtime it is actually running on. + runtime_tag_count=$(printf '%s\n' "$logs" | grep -c "runtime:nodejs${node_version}\.x" || true) + if [ "$runtime_tag_count" -ne "$expected_invocation_count" ]; then + echo "Failed: expected $expected_invocation_count runtime:nodejs${node_version}.x tags for $function_name, found $runtime_tag_count" + mismatch_found=true + else + echo "Ok: $function_name tagged runtime:nodejs${node_version}.x on all $expected_invocation_count invocations" + fi + logs=$(printf '%s\n' "$logs" | sed -E 's/runtime:nodejs[0-9]+\.x/runtime:nodejsXX.x/g') + + docker rm -f "$cid" >/dev/null 2>&1 + container_ids=("${container_ids[@]/$cid}") + + # Shared per variant, with a per-runtime override for real divergence. + runtime_log_snapshot="$local_dir/snapshots/logs/${variant}_node${node_version}.log" + if [ -f "$runtime_log_snapshot" ]; then + log_snapshot=$runtime_log_snapshot + log_shared=false + else + log_snapshot="$local_dir/snapshots/logs/${variant}.log" + log_shared=true + fi + + if [ "$update_snapshots" = true ]; then + write_snapshot "$logs" "$log_snapshot" "Logs for $function_name" "$log_shared" true + elif [ ! -f "$log_snapshot" ]; then + echo "Failed: Missing log snapshot: $log_snapshot" + mismatch_found=true + else + compare_snapshot "$logs" "$log_snapshot" "Logs for $function_name" true + fi + done +done + +set -e + +if [ "$mismatch_found" = true ]; then + echo "FAILURE: A mismatch between new data and a snapshot was found and printed above." + echo "If the change is expected, generate new snapshots by running 'UPDATE_SNAPSHOTS=true ./integration_tests_local/run.sh'" + exit 1 +fi + +if [ "$update_snapshots" = true ]; then + echo "SUCCESS: Wrote new snapshots" + exit 0 +fi + +echo "SUCCESS: No difference found between snapshots and new return values or logs" diff --git a/integration_tests_local/snapshots/logs/cjs.log b/integration_tests_local/snapshots/logs/cjs.log new file mode 100644 index 00000000..e09052ad --- /dev/null +++ b/integration_tests_local/snapshots/logs/cjs.log @@ -0,0 +1,980 @@ +XXXX [INFO] (rapid) exec '/lambda-entrypoint.sh' (cwd=/var/task, handler=node_modules/datadog-lambda-js/dist/handler.handler) +START RequestId: XXXX Version: $LATEST +XXXX [INFO] (rapid) INIT START(type: on-demand, phase: init) +XXXX [INFO] (rapid) The extension's directory "/opt/extensions" does not exist, assuming no extensions to be loaded. +XXXX [INFO] (rapid) Starting runtime without AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN , Expected?: false +XXXX [INFO] (rapid) INIT RTDONE(status: success) +XXXX [INFO] (rapid) INIT REPORT(durationMs: XXXX) +XXXX [INFO] (rapid) INVOKE START(requestId: XXXX) +{ + "e": XXXX, + "m": "aws.lambda.enhanced.invocations", + "t": [ + "region:us-east-1", + "account_id:XXXX", + "functionname:integration-tests-js-local-container-cjs", + "resource:integration-tests-js-local-container-cjs", + "memorysize:3008", + "cold_start:true", + "datadog_lambda:vX.X.X", + "runtime:nodejsXX.x" + ], + "v": 1 +} +{ + "traces": [ + [ + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.apigateway", + "resource": "GET /{proxy+}", + "service": "remappedApiGatewayServiceName", + "type": "web", + "error": 0, + "meta": { + "_dd.tags.process": "entrypoint.type:script,entrypoint.workdir:task,package.json.name:container-cjs-test,svc.auto:integration-tests-js-local-container-cjs", + "_dd.p.tid": "XXXX", + "_dd.p.dm": "-0", + "_dd.origin": "lambda", + "service": "remappedApiGatewayServiceName", + "runtime-id":"XXXX", + "http.url": "https://undefined", + "resource_names": "GET /{proxy+}", + "request_id":"XXXX", + "span.kind": "server", + "apiid":"XXXX", + "_inferred_span.tag_source": "self", + "_inferred_span.synchronicity": "sync", + "http.method": "GET", + "stage": "test", + "domain_name": "", + "dd_resource_key": "arn:aws:apigateway:us-east-1::/restapis/wt6mne2s9k", + "http.status_code": "200", + "_dd.integration": "opentracing", + "_dd.svc_src": "m", + "_dd.base_service": "integration-tests-js-local-container-cjs", + "language": "javascript" + }, + "metrics": { + "_dd.agent_psr": 1, + "_dd.top_level": 1, + "_dd.measured": 1, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + }, + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.lambda", + "resource": "integration-tests-js-local-container-cjs", + "service": "integration-tests-js-local-container-cjs", + "type": "serverless", + "error": 0, + "meta": { + "_dd.origin": "lambda", + "version": "1.0.0", + "service": "integration-tests-js-local-container-cjs", + "runtime-id":"XXXX", + "span.kind": "server", + "cold_start": "true", + "function_arn":"XXXX", + "function_version": "$LATEST", + "request_id":"XXXX", + "resource_names": "integration-tests-js-local-container-cjs", + "functionname": "integration-tests-js-local-container-cjs", + "datadog_lambda":"XXXX", + "dd_trace": "", + "function_trigger.event_source": "api-gateway", + "function_trigger.event_source_arn": "arn:aws:apigateway:us-east-1::/restapis/wt6mne2s9k/stages/test", + "http.method": "GET", + "http.route": "/{proxy+}", + "http.status_code": "200", + "_dd.integration": "opentracing", + "language": "javascript" + }, + "metrics": { + "_dd.measured": 1, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + } + ] + ] +} +END RequestId: XXXX +XXXX [INFO] (rapid) INVOKE RTDONE(status: success, produced bytes: 0, duration: XXXXms) +REPORT RequestId: XXXX Init Duration: XXXX ms Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 3008 MB Max Memory Used: XXXX MB +START RequestId: XXXX Version: $LATEST +XXXX [INFO] (rapid) INVOKE START(requestId: XXXX) +{ + "e": XXXX, + "m": "aws.lambda.enhanced.invocations", + "t": [ + "region:us-east-1", + "account_id:XXXX", + "functionname:integration-tests-js-local-container-cjs", + "resource:integration-tests-js-local-container-cjs", + "memorysize:3008", + "cold_start:false", + "datadog_lambda:vX.X.X", + "runtime:nodejsXX.x" + ], + "v": 1 +} +{ + "traces": [ + [ + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.dynamodb", + "resource": "MODIFY someTableName", + "service": "remappedDynamoDbServiceName", + "type": "web", + "error": 0, + "meta": { + "_dd.span_links": "[{\"trace_id\":\"00000000000000000000000000000000\",\"span_id\":\"0000000000000000\",\"attributes\":{\"ptr.kind\":\"aws.dynamodb.item\",\"ptr.dir\":\"u\",\"ptr.hash\":\"a23821b540813527937fbe833d70a005\",\"link.kind\":\"span-pointer\"}}]", + "_dd.tags.process": "entrypoint.type:script,entrypoint.workdir:task,package.json.name:container-cjs-test,svc.auto:integration-tests-js-local-container-cjs", + "_dd.p.tid": "XXXX", + "_dd.p.dm": "-0", + "_dd.origin": "lambda", + "service": "remappedDynamoDbServiceName", + "runtime-id":"XXXX", + "operation_name": "aws.dynamodb", + "tablename": "someTableName", + "resource_names": "MODIFY someTableName", + "request_id":"XXXX", + "span.kind": "server", + "_inferred_span.tag_source": "self", + "_inferred_span.synchronicity": "async", + "event_name": "MODIFY", + "event_version": "1.1", + "event_source_arn": "arn:aws:dynamodb:us-east-1:1234567890:table/someTableName/stream/2024-12-11T20:00:00.000", + "event_id": "0123456789abcdef09123456789abcdef", + "stream_view_type": "KEYS_ONLY", + "_dd.integration": "opentracing", + "_dd.svc_src": "m", + "_dd.base_service": "integration-tests-js-local-container-cjs", + "language": "javascript" + }, + "metrics": { + "_dd.agent_psr": 1, + "_dd.top_level": 1, + "_dd.measured": 1, + "size_bytes": 37, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + }, + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.lambda", + "resource": "integration-tests-js-local-container-cjs", + "service": "integration-tests-js-local-container-cjs", + "type": "serverless", + "error": 0, + "meta": { + "_dd.origin": "lambda", + "version": "1.0.0", + "service": "integration-tests-js-local-container-cjs", + "runtime-id":"XXXX", + "span.kind": "server", + "cold_start": "false", + "function_arn":"XXXX", + "function_version": "$LATEST", + "request_id":"XXXX", + "resource_names": "integration-tests-js-local-container-cjs", + "functionname": "integration-tests-js-local-container-cjs", + "datadog_lambda":"XXXX", + "dd_trace": "", + "function_trigger.event_source": "dynamodb", + "function_trigger.event_source_arn": "arn:aws:dynamodb:us-east-1:1234567890:table/someTableName/stream/2024-12-11T20:00:00.000", + "_dd.integration": "opentracing", + "language": "javascript" + }, + "metrics": { + "_dd.measured": 1, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + } + ] + ] +} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 3008 MB Max Memory Used: XXXX MB +XXXX [INFO] (rapid) INVOKE RTDONE(status: success, produced bytes: 0, duration: XXXXms) +START RequestId: XXXX Version: $LATEST +XXXX [INFO] (rapid) INVOKE START(requestId: XXXX) +{ + "e": XXXX, + "m": "aws.lambda.enhanced.invocations", + "t": [ + "region:us-east-1", + "account_id:XXXX", + "functionname:integration-tests-js-local-container-cjs", + "resource:integration-tests-js-local-container-cjs", + "memorysize:3008", + "cold_start:false", + "datadog_lambda:vX.X.X", + "runtime:nodejsXX.x" + ], + "v": 1 +} +{ + "traces": [ + [ + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.dynamodb", + "resource": "REMOVE someTableName", + "service": "remappedDynamoDbServiceName", + "type": "web", + "error": 0, + "meta": { + "_dd.span_links": "[{\"trace_id\":\"00000000000000000000000000000000\",\"span_id\":\"0000000000000000\",\"attributes\":{\"ptr.kind\":\"aws.dynamodb.item\",\"ptr.dir\":\"u\",\"ptr.hash\":\"a23821b540813527937fbe833d70a005\",\"link.kind\":\"span-pointer\"}}]", + "_dd.tags.process": "entrypoint.type:script,entrypoint.workdir:task,package.json.name:container-cjs-test,svc.auto:integration-tests-js-local-container-cjs", + "_dd.p.tid": "XXXX", + "_dd.p.dm": "-0", + "_dd.origin": "lambda", + "service": "remappedDynamoDbServiceName", + "runtime-id":"XXXX", + "operation_name": "aws.dynamodb", + "tablename": "someTableName", + "resource_names": "REMOVE someTableName", + "request_id":"XXXX", + "span.kind": "server", + "_inferred_span.tag_source": "self", + "_inferred_span.synchronicity": "async", + "event_name": "REMOVE", + "event_version": "1.1", + "event_source_arn": "arn:aws:dynamodb:us-east-1:1234567890:table/someTableName/stream/2024-12-11T20:00:00.000", + "event_id": "0123456789abcdef09123456789abcdef", + "stream_view_type": "KEYS_ONLY", + "_dd.integration": "opentracing", + "_dd.svc_src": "m", + "_dd.base_service": "integration-tests-js-local-container-cjs", + "language": "javascript" + }, + "metrics": { + "_dd.agent_psr": 1, + "_dd.top_level": 1, + "_dd.measured": 1, + "size_bytes": 37, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + }, + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.lambda", + "resource": "integration-tests-js-local-container-cjs", + "service": "integration-tests-js-local-container-cjs", + "type": "serverless", + "error": 0, + "meta": { + "_dd.origin": "lambda", + "version": "1.0.0", + "service": "integration-tests-js-local-container-cjs", + "runtime-id":"XXXX", + "span.kind": "server", + "cold_start": "false", + "function_arn":"XXXX", + "function_version": "$LATEST", + "request_id":"XXXX", + "resource_names": "integration-tests-js-local-container-cjs", + "functionname": "integration-tests-js-local-container-cjs", + "datadog_lambda":"XXXX", + "dd_trace": "", + "function_trigger.event_source": "dynamodb", + "function_trigger.event_source_arn": "arn:aws:dynamodb:us-east-1:1234567890:table/someTableName/stream/2024-12-11T20:00:00.000", + "_dd.integration": "opentracing", + "language": "javascript" + }, + "metrics": { + "_dd.measured": 1, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + } + ] + ] +} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 3008 MB Max Memory Used: XXXX MB +XXXX [INFO] (rapid) INVOKE RTDONE(status: success, produced bytes: 0, duration: XXXXms) +START RequestId: XXXX Version: $LATEST +XXXX [INFO] (rapid) INVOKE START(requestId: XXXX) +{ + "e": XXXX, + "m": "aws.lambda.enhanced.invocations", + "t": [ + "region:us-east-1", + "account_id:XXXX", + "functionname:integration-tests-js-local-container-cjs", + "resource:integration-tests-js-local-container-cjs", + "memorysize:3008", + "cold_start:false", + "datadog_lambda:vX.X.X", + "runtime:nodejsXX.x" + ], + "v": 1 +} +{ + "traces": [ + [ + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.dynamodb", + "resource": "INSERT someTableName", + "service": "remappedDynamoDbServiceName", + "type": "web", + "error": 0, + "meta": { + "_dd.span_links": "[{\"trace_id\":\"00000000000000000000000000000000\",\"span_id\":\"0000000000000000\",\"attributes\":{\"ptr.kind\":\"aws.dynamodb.item\",\"ptr.dir\":\"u\",\"ptr.hash\":\"843472b4a65c45fcc3f14939c6cae6d1\",\"link.kind\":\"span-pointer\"}}]", + "_dd.tags.process": "entrypoint.type:script,entrypoint.workdir:task,package.json.name:container-cjs-test,svc.auto:integration-tests-js-local-container-cjs", + "_dd.p.tid": "XXXX", + "_dd.p.dm": "-0", + "_dd.origin": "lambda", + "service": "remappedDynamoDbServiceName", + "runtime-id":"XXXX", + "operation_name": "aws.dynamodb", + "tablename": "someTableName", + "resource_names": "INSERT someTableName", + "request_id":"XXXX", + "span.kind": "server", + "_inferred_span.tag_source": "self", + "_inferred_span.synchronicity": "async", + "event_name": "INSERT", + "event_version": "1.1", + "event_source_arn": "arn:aws:dynamodb:us-east-1:1234567890:table/someTableName/stream/2024-12-11T20:00:00.000", + "event_id": "0123456789abcdef09123456789abcdef", + "stream_view_type": "KEYS_ONLY", + "_dd.integration": "opentracing", + "_dd.svc_src": "m", + "_dd.base_service": "integration-tests-js-local-container-cjs", + "language": "javascript" + }, + "metrics": { + "_dd.agent_psr": 1, + "_dd.top_level": 1, + "_dd.measured": 1, + "size_bytes": 37, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + }, + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.lambda", + "resource": "integration-tests-js-local-container-cjs", + "service": "integration-tests-js-local-container-cjs", + "type": "serverless", + "error": 0, + "meta": { + "_dd.origin": "lambda", + "version": "1.0.0", + "service": "integration-tests-js-local-container-cjs", + "runtime-id":"XXXX", + "span.kind": "server", + "cold_start": "false", + "function_arn":"XXXX", + "function_version": "$LATEST", + "request_id":"XXXX", + "resource_names": "integration-tests-js-local-container-cjs", + "functionname": "integration-tests-js-local-container-cjs", + "datadog_lambda":"XXXX", + "dd_trace": "", + "function_trigger.event_source": "dynamodb", + "function_trigger.event_source_arn": "arn:aws:dynamodb:us-east-1:1234567890:table/someTableName/stream/2024-12-11T20:00:00.000", + "_dd.integration": "opentracing", + "language": "javascript" + }, + "metrics": { + "_dd.measured": 1, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + } + ] + ] +} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 3008 MB Max Memory Used: XXXX MB +XXXX [INFO] (rapid) INVOKE RTDONE(status: success, produced bytes: 0, duration: XXXXms) +START RequestId: XXXX Version: $LATEST +XXXX [INFO] (rapid) INVOKE START(requestId: XXXX) +{ + "e": XXXX, + "m": "aws.lambda.enhanced.invocations", + "t": [ + "region:us-east-1", + "account_id:XXXX", + "functionname:integration-tests-js-local-container-cjs", + "resource:integration-tests-js-local-container-cjs", + "memorysize:3008", + "cold_start:false", + "datadog_lambda:vX.X.X", + "runtime:nodejsXX.x" + ], + "v": 1 +} +{ + "traces": [ + [ + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.s3", + "resource": "my-bucket-name", + "service": "remappedS3ServiceName", + "type": "web", + "error": 0, + "meta": { + "_dd.span_links": "[{\"trace_id\":\"00000000000000000000000000000000\",\"span_id\":\"0000000000000000\",\"attributes\":{\"ptr.kind\":\"aws.s3.object\",\"ptr.dir\":\"u\",\"ptr.hash\":\"5e945cd2009d743bdef019835b237969\",\"link.kind\":\"span-pointer\"}}]", + "_dd.tags.process": "entrypoint.type:script,entrypoint.workdir:task,package.json.name:container-cjs-test,svc.auto:integration-tests-js-local-container-cjs", + "_dd.p.tid": "XXXX", + "_dd.p.dm": "-0", + "_dd.origin": "lambda", + "service": "remappedS3ServiceName", + "runtime-id":"XXXX", + "operation_name": "aws.s3", + "resource_names": "my-bucket-name", + "request_id":"XXXX", + "span.kind": "server", + "_inferred_span.tag_source": "self", + "_inferred_span.synchronicity": "async", + "bucketname": "my-bucket-name", + "bucket_arn": "arn:aws:s3:::my-bucket-name", + "event_name": "ObjectCreated:CompleteMultipartUpload", + "object_key": "multipart_object.txt", + "object_etag": "09876543210987654321098765432109-2", + "_dd.integration": "opentracing", + "_dd.svc_src": "m", + "_dd.base_service": "integration-tests-js-local-container-cjs", + "language": "javascript" + }, + "metrics": { + "_dd.agent_psr": 1, + "_dd.top_level": 1, + "_dd.measured": 1, + "object_size": 8388608, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + }, + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.lambda", + "resource": "integration-tests-js-local-container-cjs", + "service": "integration-tests-js-local-container-cjs", + "type": "serverless", + "error": 0, + "meta": { + "_dd.origin": "lambda", + "version": "1.0.0", + "service": "integration-tests-js-local-container-cjs", + "runtime-id":"XXXX", + "span.kind": "server", + "cold_start": "false", + "function_arn":"XXXX", + "function_version": "$LATEST", + "request_id":"XXXX", + "resource_names": "integration-tests-js-local-container-cjs", + "functionname": "integration-tests-js-local-container-cjs", + "datadog_lambda":"XXXX", + "dd_trace": "", + "function_trigger.event_source": "s3", + "function_trigger.event_source_arn": "arn:aws:s3:::my-bucket-name", + "_dd.integration": "opentracing", + "language": "javascript" + }, + "metrics": { + "_dd.measured": 1, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + } + ] + ] +} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 3008 MB Max Memory Used: XXXX MB +XXXX [INFO] (rapid) INVOKE RTDONE(status: success, produced bytes: 0, duration: XXXXms) +START RequestId: XXXX Version: $LATEST +XXXX [INFO] (rapid) INVOKE START(requestId: XXXX) +{ + "e": XXXX, + "m": "aws.lambda.enhanced.invocations", + "t": [ + "region:us-east-1", + "account_id:XXXX", + "functionname:integration-tests-js-local-container-cjs", + "resource:integration-tests-js-local-container-cjs", + "memorysize:3008", + "cold_start:false", + "datadog_lambda:vX.X.X", + "runtime:nodejsXX.x" + ], + "v": 1 +} +{ + "traces": [ + [ + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.s3", + "resource": "my-bucket-name", + "service": "remappedS3ServiceName", + "type": "web", + "error": 0, + "meta": { + "_dd.span_links": "[{\"trace_id\":\"00000000000000000000000000000000\",\"span_id\":\"0000000000000000\",\"attributes\":{\"ptr.kind\":\"aws.s3.object\",\"ptr.dir\":\"u\",\"ptr.hash\":\"9b03fa9d6a34c7b40a2a2907eb0db1f6\",\"link.kind\":\"span-pointer\"}}]", + "_dd.tags.process": "entrypoint.type:script,entrypoint.workdir:task,package.json.name:container-cjs-test,svc.auto:integration-tests-js-local-container-cjs", + "_dd.p.tid": "XXXX", + "_dd.p.dm": "-0", + "_dd.origin": "lambda", + "service": "remappedS3ServiceName", + "runtime-id":"XXXX", + "operation_name": "aws.s3", + "resource_names": "my-bucket-name", + "request_id":"XXXX", + "span.kind": "server", + "_inferred_span.tag_source": "self", + "_inferred_span.synchronicity": "async", + "bucketname": "my-bucket-name", + "bucket_arn": "arn:aws:s3:::my-bucket-name", + "event_name": "ObjectCreated:Copy", + "object_key": "copied_object.txt", + "object_etag": "01234567890123456789012345678901", + "_dd.integration": "opentracing", + "_dd.svc_src": "m", + "_dd.base_service": "integration-tests-js-local-container-cjs", + "language": "javascript" + }, + "metrics": { + "_dd.agent_psr": 1, + "_dd.top_level": 1, + "_dd.measured": 1, + "object_size": 100, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + }, + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.lambda", + "resource": "integration-tests-js-local-container-cjs", + "service": "integration-tests-js-local-container-cjs", + "type": "serverless", + "error": 0, + "meta": { + "_dd.origin": "lambda", + "version": "1.0.0", + "service": "integration-tests-js-local-container-cjs", + "runtime-id":"XXXX", + "span.kind": "server", + "cold_start": "false", + "function_arn":"XXXX", + "function_version": "$LATEST", + "request_id":"XXXX", + "resource_names": "integration-tests-js-local-container-cjs", + "functionname": "integration-tests-js-local-container-cjs", + "datadog_lambda":"XXXX", + "dd_trace": "", + "function_trigger.event_source": "s3", + "function_trigger.event_source_arn": "arn:aws:s3:::my-bucket-name", + "_dd.integration": "opentracing", + "language": "javascript" + }, + "metrics": { + "_dd.measured": 1, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + } + ] + ] +} +END RequestId: XXXX +XXXX [INFO] (rapid) INVOKE RTDONE(status: success, produced bytes: 0, duration: XXXXms) +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 3008 MB Max Memory Used: XXXX MB +START RequestId: XXXX Version: $LATEST +XXXX [INFO] (rapid) INVOKE START(requestId: XXXX) +{ + "e": XXXX, + "m": "aws.lambda.enhanced.invocations", + "t": [ + "region:us-east-1", + "account_id:XXXX", + "functionname:integration-tests-js-local-container-cjs", + "resource:integration-tests-js-local-container-cjs", + "memorysize:3008", + "cold_start:false", + "datadog_lambda:vX.X.X", + "runtime:nodejsXX.x" + ], + "v": 1 +} +{ + "traces": [ + [ + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.s3", + "resource": "my-bucket-name", + "service": "remappedS3ServiceName", + "type": "web", + "error": 0, + "meta": { + "_dd.span_links": "[{\"trace_id\":\"00000000000000000000000000000000\",\"span_id\":\"0000000000000000\",\"attributes\":{\"ptr.kind\":\"aws.s3.object\",\"ptr.dir\":\"u\",\"ptr.hash\":\"b2229b8289f3e49de4f01af8d228ebd8\",\"link.kind\":\"span-pointer\"}}]", + "_dd.tags.process": "entrypoint.type:script,entrypoint.workdir:task,package.json.name:container-cjs-test,svc.auto:integration-tests-js-local-container-cjs", + "_dd.p.tid": "XXXX", + "_dd.p.dm": "-0", + "_dd.origin": "lambda", + "service": "remappedS3ServiceName", + "runtime-id":"XXXX", + "operation_name": "aws.s3", + "resource_names": "my-bucket-name", + "request_id":"XXXX", + "span.kind": "server", + "_inferred_span.tag_source": "self", + "_inferred_span.synchronicity": "async", + "bucketname": "my-bucket-name", + "bucket_arn": "arn:aws:s3:::my-bucket-name", + "event_name": "ObjectCreated:Put", + "object_key": "test_object.txt", + "object_etag": "abcdef0123456789abcdef01234567890", + "_dd.integration": "opentracing", + "_dd.svc_src": "m", + "_dd.base_service": "integration-tests-js-local-container-cjs", + "language": "javascript" + }, + "metrics": { + "_dd.agent_psr": 1, + "_dd.top_level": 1, + "_dd.measured": 1, + "object_size": 100, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + }, + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.lambda", + "resource": "integration-tests-js-local-container-cjs", + "service": "integration-tests-js-local-container-cjs", + "type": "serverless", + "error": 0, + "meta": { + "_dd.origin": "lambda", + "version": "1.0.0", + "service": "integration-tests-js-local-container-cjs", + "runtime-id":"XXXX", + "span.kind": "server", + "cold_start": "false", + "function_arn":"XXXX", + "function_version": "$LATEST", + "request_id":"XXXX", + "resource_names": "integration-tests-js-local-container-cjs", + "functionname": "integration-tests-js-local-container-cjs", + "datadog_lambda":"XXXX", + "dd_trace": "", + "function_trigger.event_source": "s3", + "function_trigger.event_source_arn": "arn:aws:s3:::my-bucket-name", + "_dd.integration": "opentracing", + "language": "javascript" + }, + "metrics": { + "_dd.measured": 1, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + } + ] + ] +} +END RequestId: XXXX +XXXX [INFO] (rapid) INVOKE RTDONE(status: success, produced bytes: 0, duration: XXXXms) +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 3008 MB Max Memory Used: XXXX MB +START RequestId: XXXX Version: $LATEST +XXXX [INFO] (rapid) INVOKE START(requestId: XXXX) +{ + "e": XXXX, + "m": "aws.lambda.enhanced.invocations", + "t": [ + "region:us-east-1", + "account_id:XXXX", + "functionname:integration-tests-js-local-container-cjs", + "resource:integration-tests-js-local-container-cjs", + "memorysize:3008", + "cold_start:false", + "datadog_lambda:vX.X.X", + "runtime:nodejsXX.x" + ], + "v": 1 +} +{ + "traces": [ + [ + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.sns", + "resource": "sns-lambda", + "service": "remappedSnsServiceName", + "type": "sns", + "error": 0, + "meta": { + "_dd.tags.process": "entrypoint.type:script,entrypoint.workdir:task,package.json.name:container-cjs-test,svc.auto:integration-tests-js-local-container-cjs", + "_dd.p.tid": "XXXX", + "_dd.p.dm": "-0", + "_dd.origin": "lambda", + "service": "remappedSnsServiceName", + "runtime-id":"XXXX", + "operation_name": "aws.sns", + "resource_names": "sns-lambda", + "request_id":"XXXX", + "span.kind": "server", + "_inferred_span.tag_source": "self", + "_inferred_span.synchronicity": "async", + "type": "Notification", + "subject": "TestInvoke", + "message_id": "95df01b4-ee98-5cb9-9903-4c221d41eb5e", + "topicname": "sns-lambda", + "topic_arn": "arn:aws:sns:us-east-2:123456789012:sns-lambda", + "event_subscription_arn": "arn:aws:sns:us-east-2:123456789012:sns-lambda:21be56ed-a058-49f5-8c98-aedd2564c486", + "_dd.integration": "opentracing", + "_dd.svc_src": "m", + "_dd.base_service": "integration-tests-js-local-container-cjs", + "language": "javascript" + }, + "metrics": { + "_dd.agent_psr": 1, + "_dd.top_level": 1, + "_dd.measured": 1, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + }, + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.lambda", + "resource": "integration-tests-js-local-container-cjs", + "service": "integration-tests-js-local-container-cjs", + "type": "serverless", + "error": 0, + "meta": { + "_dd.origin": "lambda", + "version": "1.0.0", + "service": "integration-tests-js-local-container-cjs", + "runtime-id":"XXXX", + "span.kind": "server", + "cold_start": "false", + "function_arn":"XXXX", + "function_version": "$LATEST", + "request_id":"XXXX", + "resource_names": "integration-tests-js-local-container-cjs", + "functionname": "integration-tests-js-local-container-cjs", + "datadog_lambda":"XXXX", + "dd_trace": "", + "function_trigger.event_source": "sns", + "function_trigger.event_source_arn": "arn:aws:sns:us-east-2:123456789012:sns-lambda", + "_dd.integration": "opentracing", + "language": "javascript" + }, + "metrics": { + "_dd.measured": 1, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + } + ] + ] +} +END RequestId: XXXX +XXXX [INFO] (rapid) INVOKE RTDONE(status: success, produced bytes: 0, duration: XXXXms) +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 3008 MB Max Memory Used: XXXX MB +START RequestId: XXXX Version: $LATEST +XXXX [INFO] (rapid) INVOKE START(requestId: XXXX) +{ + "e": XXXX, + "m": "aws.lambda.enhanced.invocations", + "t": [ + "region:us-east-1", + "account_id:XXXX", + "functionname:integration-tests-js-local-container-cjs", + "resource:integration-tests-js-local-container-cjs", + "memorysize:3008", + "cold_start:false", + "datadog_lambda:vX.X.X", + "runtime:nodejsXX.x" + ], + "v": 1 +} +{ + "traces": [ + [ + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.sqs", + "resource": "my-queue", + "service": "remappedSqsServiceName", + "type": "web", + "error": 0, + "meta": { + "_dd.tags.process": "entrypoint.type:script,entrypoint.workdir:task,package.json.name:container-cjs-test,svc.auto:integration-tests-js-local-container-cjs", + "_dd.p.tid": "XXXX", + "_dd.p.dm": "-0", + "_dd.origin": "lambda", + "service": "remappedSqsServiceName", + "runtime-id":"XXXX", + "operation_name": "aws.sqs", + "resource_names": "my-queue", + "request_id":"XXXX", + "span.kind": "server", + "_inferred_span.tag_source": "self", + "_inferred_span.synchronicity": "async", + "queuename": "my-queue", + "event_source_arn": "arn:aws:sqs:us-east-2:123456789012:my-queue", + "receipt_handle": "AQEBwJnKyrHigUMZj6rYigCgxlaS3SLy0a...", + "sender_id": "AIDAIENQZJOLO23YVJ4VO", + "_dd.integration": "opentracing", + "_dd.svc_src": "m", + "_dd.base_service": "integration-tests-js-local-container-cjs", + "language": "javascript" + }, + "metrics": { + "_dd.agent_psr": 1, + "_dd.top_level": 1, + "_dd.measured": 1, + "retry_count": 1, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + }, + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.lambda", + "resource": "integration-tests-js-local-container-cjs", + "service": "integration-tests-js-local-container-cjs", + "type": "serverless", + "error": 0, + "meta": { + "_dd.origin": "lambda", + "version": "1.0.0", + "service": "integration-tests-js-local-container-cjs", + "runtime-id":"XXXX", + "span.kind": "server", + "cold_start": "false", + "function_arn":"XXXX", + "function_version": "$LATEST", + "request_id":"XXXX", + "resource_names": "integration-tests-js-local-container-cjs", + "functionname": "integration-tests-js-local-container-cjs", + "datadog_lambda":"XXXX", + "dd_trace": "", + "function_trigger.event_source": "sqs", + "function_trigger.event_source_arn": "arn:aws:sqs:us-east-2:123456789012:my-queue", + "_dd.integration": "opentracing", + "language": "javascript" + }, + "metrics": { + "_dd.measured": 1, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + } + ] + ] +} +END RequestId: XXXX +XXXX [INFO] (rapid) INVOKE RTDONE(status: success, produced bytes: 0, duration: XXXXms) +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 3008 MB Max Memory Used: XXXX MB diff --git a/integration_tests_local/snapshots/logs/esm.log b/integration_tests_local/snapshots/logs/esm.log new file mode 100644 index 00000000..cb3331bf --- /dev/null +++ b/integration_tests_local/snapshots/logs/esm.log @@ -0,0 +1,980 @@ +XXXX [INFO] (rapid) exec '/lambda-entrypoint.sh' (cwd=/var/task, handler=node_modules/datadog-lambda-js/dist/handler.handler) +XXXX [INFO] (rapid) INIT START(type: on-demand, phase: init) +XXXX [INFO] (rapid) The extension's directory "/opt/extensions" does not exist, assuming no extensions to be loaded. +XXXX [INFO] (rapid) Starting runtime without AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN , Expected?: false +START RequestId: XXXX Version: $LATEST +XXXX [INFO] (rapid) INIT RTDONE(status: success) +XXXX [INFO] (rapid) INIT REPORT(durationMs: XXXX) +XXXX [INFO] (rapid) INVOKE START(requestId: XXXX) +{ + "e": XXXX, + "m": "aws.lambda.enhanced.invocations", + "t": [ + "region:us-east-1", + "account_id:XXXX", + "functionname:integration-tests-js-local-container-esm", + "resource:integration-tests-js-local-container-esm", + "memorysize:3008", + "cold_start:true", + "datadog_lambda:vX.X.X", + "runtime:nodejsXX.x" + ], + "v": 1 +} +{ + "traces": [ + [ + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.apigateway", + "resource": "GET /{proxy+}", + "service": "remappedApiGatewayServiceName", + "type": "web", + "error": 0, + "meta": { + "_dd.tags.process": "entrypoint.type:script,entrypoint.workdir:task,package.json.name:container-esm-test,svc.auto:integration-tests-js-local-container-esm", + "_dd.p.tid": "XXXX", + "_dd.p.dm": "-0", + "_dd.origin": "lambda", + "service": "remappedApiGatewayServiceName", + "runtime-id":"XXXX", + "http.url": "https://undefined", + "resource_names": "GET /{proxy+}", + "request_id":"XXXX", + "span.kind": "server", + "apiid":"XXXX", + "_inferred_span.tag_source": "self", + "_inferred_span.synchronicity": "sync", + "http.method": "GET", + "stage": "test", + "domain_name": "", + "dd_resource_key": "arn:aws:apigateway:us-east-1::/restapis/wt6mne2s9k", + "http.status_code": "200", + "_dd.integration": "opentracing", + "_dd.svc_src": "m", + "_dd.base_service": "integration-tests-js-local-container-esm", + "language": "javascript" + }, + "metrics": { + "_dd.agent_psr": 1, + "_dd.top_level": 1, + "_dd.measured": 1, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + }, + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.lambda", + "resource": "integration-tests-js-local-container-esm", + "service": "integration-tests-js-local-container-esm", + "type": "serverless", + "error": 0, + "meta": { + "_dd.origin": "lambda", + "version": "1.0.0", + "service": "integration-tests-js-local-container-esm", + "runtime-id":"XXXX", + "span.kind": "server", + "cold_start": "true", + "function_arn":"XXXX", + "function_version": "$LATEST", + "request_id":"XXXX", + "resource_names": "integration-tests-js-local-container-esm", + "functionname": "integration-tests-js-local-container-esm", + "datadog_lambda":"XXXX", + "dd_trace": "", + "function_trigger.event_source": "api-gateway", + "function_trigger.event_source_arn": "arn:aws:apigateway:us-east-1::/restapis/wt6mne2s9k/stages/test", + "http.method": "GET", + "http.route": "/{proxy+}", + "http.status_code": "200", + "_dd.integration": "opentracing", + "language": "javascript" + }, + "metrics": { + "_dd.measured": 1, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + } + ] + ] +} +END RequestId: XXXX +REPORT RequestId: XXXX Init Duration: XXXX ms Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 3008 MB Max Memory Used: XXXX MB +XXXX [INFO] (rapid) INVOKE RTDONE(status: success, produced bytes: 0, duration: XXXXms) +START RequestId: XXXX Version: $LATEST +XXXX [INFO] (rapid) INVOKE START(requestId: XXXX) +{ + "e": XXXX, + "m": "aws.lambda.enhanced.invocations", + "t": [ + "region:us-east-1", + "account_id:XXXX", + "functionname:integration-tests-js-local-container-esm", + "resource:integration-tests-js-local-container-esm", + "memorysize:3008", + "cold_start:false", + "datadog_lambda:vX.X.X", + "runtime:nodejsXX.x" + ], + "v": 1 +} +{ + "traces": [ + [ + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.dynamodb", + "resource": "MODIFY someTableName", + "service": "remappedDynamoDbServiceName", + "type": "web", + "error": 0, + "meta": { + "_dd.span_links": "[{\"trace_id\":\"00000000000000000000000000000000\",\"span_id\":\"0000000000000000\",\"attributes\":{\"ptr.kind\":\"aws.dynamodb.item\",\"ptr.dir\":\"u\",\"ptr.hash\":\"a23821b540813527937fbe833d70a005\",\"link.kind\":\"span-pointer\"}}]", + "_dd.tags.process": "entrypoint.type:script,entrypoint.workdir:task,package.json.name:container-esm-test,svc.auto:integration-tests-js-local-container-esm", + "_dd.p.tid": "XXXX", + "_dd.p.dm": "-0", + "_dd.origin": "lambda", + "service": "remappedDynamoDbServiceName", + "runtime-id":"XXXX", + "operation_name": "aws.dynamodb", + "tablename": "someTableName", + "resource_names": "MODIFY someTableName", + "request_id":"XXXX", + "span.kind": "server", + "_inferred_span.tag_source": "self", + "_inferred_span.synchronicity": "async", + "event_name": "MODIFY", + "event_version": "1.1", + "event_source_arn": "arn:aws:dynamodb:us-east-1:1234567890:table/someTableName/stream/2024-12-11T20:00:00.000", + "event_id": "0123456789abcdef09123456789abcdef", + "stream_view_type": "KEYS_ONLY", + "_dd.integration": "opentracing", + "_dd.svc_src": "m", + "_dd.base_service": "integration-tests-js-local-container-esm", + "language": "javascript" + }, + "metrics": { + "_dd.agent_psr": 1, + "_dd.top_level": 1, + "_dd.measured": 1, + "size_bytes": 37, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + }, + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.lambda", + "resource": "integration-tests-js-local-container-esm", + "service": "integration-tests-js-local-container-esm", + "type": "serverless", + "error": 0, + "meta": { + "_dd.origin": "lambda", + "version": "1.0.0", + "service": "integration-tests-js-local-container-esm", + "runtime-id":"XXXX", + "span.kind": "server", + "cold_start": "false", + "function_arn":"XXXX", + "function_version": "$LATEST", + "request_id":"XXXX", + "resource_names": "integration-tests-js-local-container-esm", + "functionname": "integration-tests-js-local-container-esm", + "datadog_lambda":"XXXX", + "dd_trace": "", + "function_trigger.event_source": "dynamodb", + "function_trigger.event_source_arn": "arn:aws:dynamodb:us-east-1:1234567890:table/someTableName/stream/2024-12-11T20:00:00.000", + "_dd.integration": "opentracing", + "language": "javascript" + }, + "metrics": { + "_dd.measured": 1, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + } + ] + ] +} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 3008 MB Max Memory Used: XXXX MB +XXXX [INFO] (rapid) INVOKE RTDONE(status: success, produced bytes: 0, duration: XXXXms) +START RequestId: XXXX Version: $LATEST +XXXX [INFO] (rapid) INVOKE START(requestId: XXXX) +{ + "e": XXXX, + "m": "aws.lambda.enhanced.invocations", + "t": [ + "region:us-east-1", + "account_id:XXXX", + "functionname:integration-tests-js-local-container-esm", + "resource:integration-tests-js-local-container-esm", + "memorysize:3008", + "cold_start:false", + "datadog_lambda:vX.X.X", + "runtime:nodejsXX.x" + ], + "v": 1 +} +{ + "traces": [ + [ + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.dynamodb", + "resource": "REMOVE someTableName", + "service": "remappedDynamoDbServiceName", + "type": "web", + "error": 0, + "meta": { + "_dd.span_links": "[{\"trace_id\":\"00000000000000000000000000000000\",\"span_id\":\"0000000000000000\",\"attributes\":{\"ptr.kind\":\"aws.dynamodb.item\",\"ptr.dir\":\"u\",\"ptr.hash\":\"a23821b540813527937fbe833d70a005\",\"link.kind\":\"span-pointer\"}}]", + "_dd.tags.process": "entrypoint.type:script,entrypoint.workdir:task,package.json.name:container-esm-test,svc.auto:integration-tests-js-local-container-esm", + "_dd.p.tid": "XXXX", + "_dd.p.dm": "-0", + "_dd.origin": "lambda", + "service": "remappedDynamoDbServiceName", + "runtime-id":"XXXX", + "operation_name": "aws.dynamodb", + "tablename": "someTableName", + "resource_names": "REMOVE someTableName", + "request_id":"XXXX", + "span.kind": "server", + "_inferred_span.tag_source": "self", + "_inferred_span.synchronicity": "async", + "event_name": "REMOVE", + "event_version": "1.1", + "event_source_arn": "arn:aws:dynamodb:us-east-1:1234567890:table/someTableName/stream/2024-12-11T20:00:00.000", + "event_id": "0123456789abcdef09123456789abcdef", + "stream_view_type": "KEYS_ONLY", + "_dd.integration": "opentracing", + "_dd.svc_src": "m", + "_dd.base_service": "integration-tests-js-local-container-esm", + "language": "javascript" + }, + "metrics": { + "_dd.agent_psr": 1, + "_dd.top_level": 1, + "_dd.measured": 1, + "size_bytes": 37, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + }, + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.lambda", + "resource": "integration-tests-js-local-container-esm", + "service": "integration-tests-js-local-container-esm", + "type": "serverless", + "error": 0, + "meta": { + "_dd.origin": "lambda", + "version": "1.0.0", + "service": "integration-tests-js-local-container-esm", + "runtime-id":"XXXX", + "span.kind": "server", + "cold_start": "false", + "function_arn":"XXXX", + "function_version": "$LATEST", + "request_id":"XXXX", + "resource_names": "integration-tests-js-local-container-esm", + "functionname": "integration-tests-js-local-container-esm", + "datadog_lambda":"XXXX", + "dd_trace": "", + "function_trigger.event_source": "dynamodb", + "function_trigger.event_source_arn": "arn:aws:dynamodb:us-east-1:1234567890:table/someTableName/stream/2024-12-11T20:00:00.000", + "_dd.integration": "opentracing", + "language": "javascript" + }, + "metrics": { + "_dd.measured": 1, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + } + ] + ] +} +XXXX [INFO] (rapid) INVOKE RTDONE(status: success, produced bytes: 0, duration: XXXXms) +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 3008 MB Max Memory Used: XXXX MB +START RequestId: XXXX Version: $LATEST +XXXX [INFO] (rapid) INVOKE START(requestId: XXXX) +{ + "e": XXXX, + "m": "aws.lambda.enhanced.invocations", + "t": [ + "region:us-east-1", + "account_id:XXXX", + "functionname:integration-tests-js-local-container-esm", + "resource:integration-tests-js-local-container-esm", + "memorysize:3008", + "cold_start:false", + "datadog_lambda:vX.X.X", + "runtime:nodejsXX.x" + ], + "v": 1 +} +{ + "traces": [ + [ + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.dynamodb", + "resource": "INSERT someTableName", + "service": "remappedDynamoDbServiceName", + "type": "web", + "error": 0, + "meta": { + "_dd.span_links": "[{\"trace_id\":\"00000000000000000000000000000000\",\"span_id\":\"0000000000000000\",\"attributes\":{\"ptr.kind\":\"aws.dynamodb.item\",\"ptr.dir\":\"u\",\"ptr.hash\":\"843472b4a65c45fcc3f14939c6cae6d1\",\"link.kind\":\"span-pointer\"}}]", + "_dd.tags.process": "entrypoint.type:script,entrypoint.workdir:task,package.json.name:container-esm-test,svc.auto:integration-tests-js-local-container-esm", + "_dd.p.tid": "XXXX", + "_dd.p.dm": "-0", + "_dd.origin": "lambda", + "service": "remappedDynamoDbServiceName", + "runtime-id":"XXXX", + "operation_name": "aws.dynamodb", + "tablename": "someTableName", + "resource_names": "INSERT someTableName", + "request_id":"XXXX", + "span.kind": "server", + "_inferred_span.tag_source": "self", + "_inferred_span.synchronicity": "async", + "event_name": "INSERT", + "event_version": "1.1", + "event_source_arn": "arn:aws:dynamodb:us-east-1:1234567890:table/someTableName/stream/2024-12-11T20:00:00.000", + "event_id": "0123456789abcdef09123456789abcdef", + "stream_view_type": "KEYS_ONLY", + "_dd.integration": "opentracing", + "_dd.svc_src": "m", + "_dd.base_service": "integration-tests-js-local-container-esm", + "language": "javascript" + }, + "metrics": { + "_dd.agent_psr": 1, + "_dd.top_level": 1, + "_dd.measured": 1, + "size_bytes": 37, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + }, + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.lambda", + "resource": "integration-tests-js-local-container-esm", + "service": "integration-tests-js-local-container-esm", + "type": "serverless", + "error": 0, + "meta": { + "_dd.origin": "lambda", + "version": "1.0.0", + "service": "integration-tests-js-local-container-esm", + "runtime-id":"XXXX", + "span.kind": "server", + "cold_start": "false", + "function_arn":"XXXX", + "function_version": "$LATEST", + "request_id":"XXXX", + "resource_names": "integration-tests-js-local-container-esm", + "functionname": "integration-tests-js-local-container-esm", + "datadog_lambda":"XXXX", + "dd_trace": "", + "function_trigger.event_source": "dynamodb", + "function_trigger.event_source_arn": "arn:aws:dynamodb:us-east-1:1234567890:table/someTableName/stream/2024-12-11T20:00:00.000", + "_dd.integration": "opentracing", + "language": "javascript" + }, + "metrics": { + "_dd.measured": 1, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + } + ] + ] +} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 3008 MB Max Memory Used: XXXX MB +XXXX [INFO] (rapid) INVOKE RTDONE(status: success, produced bytes: 0, duration: XXXXms) +START RequestId: XXXX Version: $LATEST +XXXX [INFO] (rapid) INVOKE START(requestId: XXXX) +{ + "e": XXXX, + "m": "aws.lambda.enhanced.invocations", + "t": [ + "region:us-east-1", + "account_id:XXXX", + "functionname:integration-tests-js-local-container-esm", + "resource:integration-tests-js-local-container-esm", + "memorysize:3008", + "cold_start:false", + "datadog_lambda:vX.X.X", + "runtime:nodejsXX.x" + ], + "v": 1 +} +{ + "traces": [ + [ + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.s3", + "resource": "my-bucket-name", + "service": "remappedS3ServiceName", + "type": "web", + "error": 0, + "meta": { + "_dd.span_links": "[{\"trace_id\":\"00000000000000000000000000000000\",\"span_id\":\"0000000000000000\",\"attributes\":{\"ptr.kind\":\"aws.s3.object\",\"ptr.dir\":\"u\",\"ptr.hash\":\"5e945cd2009d743bdef019835b237969\",\"link.kind\":\"span-pointer\"}}]", + "_dd.tags.process": "entrypoint.type:script,entrypoint.workdir:task,package.json.name:container-esm-test,svc.auto:integration-tests-js-local-container-esm", + "_dd.p.tid": "XXXX", + "_dd.p.dm": "-0", + "_dd.origin": "lambda", + "service": "remappedS3ServiceName", + "runtime-id":"XXXX", + "operation_name": "aws.s3", + "resource_names": "my-bucket-name", + "request_id":"XXXX", + "span.kind": "server", + "_inferred_span.tag_source": "self", + "_inferred_span.synchronicity": "async", + "bucketname": "my-bucket-name", + "bucket_arn": "arn:aws:s3:::my-bucket-name", + "event_name": "ObjectCreated:CompleteMultipartUpload", + "object_key": "multipart_object.txt", + "object_etag": "09876543210987654321098765432109-2", + "_dd.integration": "opentracing", + "_dd.svc_src": "m", + "_dd.base_service": "integration-tests-js-local-container-esm", + "language": "javascript" + }, + "metrics": { + "_dd.agent_psr": 1, + "_dd.top_level": 1, + "_dd.measured": 1, + "object_size": 8388608, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + }, + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.lambda", + "resource": "integration-tests-js-local-container-esm", + "service": "integration-tests-js-local-container-esm", + "type": "serverless", + "error": 0, + "meta": { + "_dd.origin": "lambda", + "version": "1.0.0", + "service": "integration-tests-js-local-container-esm", + "runtime-id":"XXXX", + "span.kind": "server", + "cold_start": "false", + "function_arn":"XXXX", + "function_version": "$LATEST", + "request_id":"XXXX", + "resource_names": "integration-tests-js-local-container-esm", + "functionname": "integration-tests-js-local-container-esm", + "datadog_lambda":"XXXX", + "dd_trace": "", + "function_trigger.event_source": "s3", + "function_trigger.event_source_arn": "arn:aws:s3:::my-bucket-name", + "_dd.integration": "opentracing", + "language": "javascript" + }, + "metrics": { + "_dd.measured": 1, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + } + ] + ] +} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 3008 MB Max Memory Used: XXXX MB +XXXX [INFO] (rapid) INVOKE RTDONE(status: success, produced bytes: 0, duration: XXXXms) +START RequestId: XXXX Version: $LATEST +XXXX [INFO] (rapid) INVOKE START(requestId: XXXX) +{ + "e": XXXX, + "m": "aws.lambda.enhanced.invocations", + "t": [ + "region:us-east-1", + "account_id:XXXX", + "functionname:integration-tests-js-local-container-esm", + "resource:integration-tests-js-local-container-esm", + "memorysize:3008", + "cold_start:false", + "datadog_lambda:vX.X.X", + "runtime:nodejsXX.x" + ], + "v": 1 +} +{ + "traces": [ + [ + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.s3", + "resource": "my-bucket-name", + "service": "remappedS3ServiceName", + "type": "web", + "error": 0, + "meta": { + "_dd.span_links": "[{\"trace_id\":\"00000000000000000000000000000000\",\"span_id\":\"0000000000000000\",\"attributes\":{\"ptr.kind\":\"aws.s3.object\",\"ptr.dir\":\"u\",\"ptr.hash\":\"9b03fa9d6a34c7b40a2a2907eb0db1f6\",\"link.kind\":\"span-pointer\"}}]", + "_dd.tags.process": "entrypoint.type:script,entrypoint.workdir:task,package.json.name:container-esm-test,svc.auto:integration-tests-js-local-container-esm", + "_dd.p.tid": "XXXX", + "_dd.p.dm": "-0", + "_dd.origin": "lambda", + "service": "remappedS3ServiceName", + "runtime-id":"XXXX", + "operation_name": "aws.s3", + "resource_names": "my-bucket-name", + "request_id":"XXXX", + "span.kind": "server", + "_inferred_span.tag_source": "self", + "_inferred_span.synchronicity": "async", + "bucketname": "my-bucket-name", + "bucket_arn": "arn:aws:s3:::my-bucket-name", + "event_name": "ObjectCreated:Copy", + "object_key": "copied_object.txt", + "object_etag": "01234567890123456789012345678901", + "_dd.integration": "opentracing", + "_dd.svc_src": "m", + "_dd.base_service": "integration-tests-js-local-container-esm", + "language": "javascript" + }, + "metrics": { + "_dd.agent_psr": 1, + "_dd.top_level": 1, + "_dd.measured": 1, + "object_size": 100, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + }, + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.lambda", + "resource": "integration-tests-js-local-container-esm", + "service": "integration-tests-js-local-container-esm", + "type": "serverless", + "error": 0, + "meta": { + "_dd.origin": "lambda", + "version": "1.0.0", + "service": "integration-tests-js-local-container-esm", + "runtime-id":"XXXX", + "span.kind": "server", + "cold_start": "false", + "function_arn":"XXXX", + "function_version": "$LATEST", + "request_id":"XXXX", + "resource_names": "integration-tests-js-local-container-esm", + "functionname": "integration-tests-js-local-container-esm", + "datadog_lambda":"XXXX", + "dd_trace": "", + "function_trigger.event_source": "s3", + "function_trigger.event_source_arn": "arn:aws:s3:::my-bucket-name", + "_dd.integration": "opentracing", + "language": "javascript" + }, + "metrics": { + "_dd.measured": 1, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + } + ] + ] +} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 3008 MB Max Memory Used: XXXX MB +XXXX [INFO] (rapid) INVOKE RTDONE(status: success, produced bytes: 0, duration: XXXXms) +START RequestId: XXXX Version: $LATEST +XXXX [INFO] (rapid) INVOKE START(requestId: XXXX) +{ + "e": XXXX, + "m": "aws.lambda.enhanced.invocations", + "t": [ + "region:us-east-1", + "account_id:XXXX", + "functionname:integration-tests-js-local-container-esm", + "resource:integration-tests-js-local-container-esm", + "memorysize:3008", + "cold_start:false", + "datadog_lambda:vX.X.X", + "runtime:nodejsXX.x" + ], + "v": 1 +} +{ + "traces": [ + [ + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.s3", + "resource": "my-bucket-name", + "service": "remappedS3ServiceName", + "type": "web", + "error": 0, + "meta": { + "_dd.span_links": "[{\"trace_id\":\"00000000000000000000000000000000\",\"span_id\":\"0000000000000000\",\"attributes\":{\"ptr.kind\":\"aws.s3.object\",\"ptr.dir\":\"u\",\"ptr.hash\":\"b2229b8289f3e49de4f01af8d228ebd8\",\"link.kind\":\"span-pointer\"}}]", + "_dd.tags.process": "entrypoint.type:script,entrypoint.workdir:task,package.json.name:container-esm-test,svc.auto:integration-tests-js-local-container-esm", + "_dd.p.tid": "XXXX", + "_dd.p.dm": "-0", + "_dd.origin": "lambda", + "service": "remappedS3ServiceName", + "runtime-id":"XXXX", + "operation_name": "aws.s3", + "resource_names": "my-bucket-name", + "request_id":"XXXX", + "span.kind": "server", + "_inferred_span.tag_source": "self", + "_inferred_span.synchronicity": "async", + "bucketname": "my-bucket-name", + "bucket_arn": "arn:aws:s3:::my-bucket-name", + "event_name": "ObjectCreated:Put", + "object_key": "test_object.txt", + "object_etag": "abcdef0123456789abcdef01234567890", + "_dd.integration": "opentracing", + "_dd.svc_src": "m", + "_dd.base_service": "integration-tests-js-local-container-esm", + "language": "javascript" + }, + "metrics": { + "_dd.agent_psr": 1, + "_dd.top_level": 1, + "_dd.measured": 1, + "object_size": 100, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + }, + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.lambda", + "resource": "integration-tests-js-local-container-esm", + "service": "integration-tests-js-local-container-esm", + "type": "serverless", + "error": 0, + "meta": { + "_dd.origin": "lambda", + "version": "1.0.0", + "service": "integration-tests-js-local-container-esm", + "runtime-id":"XXXX", + "span.kind": "server", + "cold_start": "false", + "function_arn":"XXXX", + "function_version": "$LATEST", + "request_id":"XXXX", + "resource_names": "integration-tests-js-local-container-esm", + "functionname": "integration-tests-js-local-container-esm", + "datadog_lambda":"XXXX", + "dd_trace": "", + "function_trigger.event_source": "s3", + "function_trigger.event_source_arn": "arn:aws:s3:::my-bucket-name", + "_dd.integration": "opentracing", + "language": "javascript" + }, + "metrics": { + "_dd.measured": 1, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + } + ] + ] +} +END RequestId: XXXX +XXXX [INFO] (rapid) INVOKE RTDONE(status: success, produced bytes: 0, duration: XXXXms) +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 3008 MB Max Memory Used: XXXX MB +START RequestId: XXXX Version: $LATEST +XXXX [INFO] (rapid) INVOKE START(requestId: XXXX) +{ + "e": XXXX, + "m": "aws.lambda.enhanced.invocations", + "t": [ + "region:us-east-1", + "account_id:XXXX", + "functionname:integration-tests-js-local-container-esm", + "resource:integration-tests-js-local-container-esm", + "memorysize:3008", + "cold_start:false", + "datadog_lambda:vX.X.X", + "runtime:nodejsXX.x" + ], + "v": 1 +} +{ + "traces": [ + [ + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.sns", + "resource": "sns-lambda", + "service": "remappedSnsServiceName", + "type": "sns", + "error": 0, + "meta": { + "_dd.tags.process": "entrypoint.type:script,entrypoint.workdir:task,package.json.name:container-esm-test,svc.auto:integration-tests-js-local-container-esm", + "_dd.p.tid": "XXXX", + "_dd.p.dm": "-0", + "_dd.origin": "lambda", + "service": "remappedSnsServiceName", + "runtime-id":"XXXX", + "operation_name": "aws.sns", + "resource_names": "sns-lambda", + "request_id":"XXXX", + "span.kind": "server", + "_inferred_span.tag_source": "self", + "_inferred_span.synchronicity": "async", + "type": "Notification", + "subject": "TestInvoke", + "message_id": "95df01b4-ee98-5cb9-9903-4c221d41eb5e", + "topicname": "sns-lambda", + "topic_arn": "arn:aws:sns:us-east-2:123456789012:sns-lambda", + "event_subscription_arn": "arn:aws:sns:us-east-2:123456789012:sns-lambda:21be56ed-a058-49f5-8c98-aedd2564c486", + "_dd.integration": "opentracing", + "_dd.svc_src": "m", + "_dd.base_service": "integration-tests-js-local-container-esm", + "language": "javascript" + }, + "metrics": { + "_dd.agent_psr": 1, + "_dd.top_level": 1, + "_dd.measured": 1, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + }, + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.lambda", + "resource": "integration-tests-js-local-container-esm", + "service": "integration-tests-js-local-container-esm", + "type": "serverless", + "error": 0, + "meta": { + "_dd.origin": "lambda", + "version": "1.0.0", + "service": "integration-tests-js-local-container-esm", + "runtime-id":"XXXX", + "span.kind": "server", + "cold_start": "false", + "function_arn":"XXXX", + "function_version": "$LATEST", + "request_id":"XXXX", + "resource_names": "integration-tests-js-local-container-esm", + "functionname": "integration-tests-js-local-container-esm", + "datadog_lambda":"XXXX", + "dd_trace": "", + "function_trigger.event_source": "sns", + "function_trigger.event_source_arn": "arn:aws:sns:us-east-2:123456789012:sns-lambda", + "_dd.integration": "opentracing", + "language": "javascript" + }, + "metrics": { + "_dd.measured": 1, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + } + ] + ] +} +XXXX [INFO] (rapid) INVOKE RTDONE(status: success, produced bytes: 0, duration: XXXXms) +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 3008 MB Max Memory Used: XXXX MB +START RequestId: XXXX Version: $LATEST +XXXX [INFO] (rapid) INVOKE START(requestId: XXXX) +{ + "e": XXXX, + "m": "aws.lambda.enhanced.invocations", + "t": [ + "region:us-east-1", + "account_id:XXXX", + "functionname:integration-tests-js-local-container-esm", + "resource:integration-tests-js-local-container-esm", + "memorysize:3008", + "cold_start:false", + "datadog_lambda:vX.X.X", + "runtime:nodejsXX.x" + ], + "v": 1 +} +{ + "traces": [ + [ + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.sqs", + "resource": "my-queue", + "service": "remappedSqsServiceName", + "type": "web", + "error": 0, + "meta": { + "_dd.tags.process": "entrypoint.type:script,entrypoint.workdir:task,package.json.name:container-esm-test,svc.auto:integration-tests-js-local-container-esm", + "_dd.p.tid": "XXXX", + "_dd.p.dm": "-0", + "_dd.origin": "lambda", + "service": "remappedSqsServiceName", + "runtime-id":"XXXX", + "operation_name": "aws.sqs", + "resource_names": "my-queue", + "request_id":"XXXX", + "span.kind": "server", + "_inferred_span.tag_source": "self", + "_inferred_span.synchronicity": "async", + "queuename": "my-queue", + "event_source_arn": "arn:aws:sqs:us-east-2:123456789012:my-queue", + "receipt_handle": "AQEBwJnKyrHigUMZj6rYigCgxlaS3SLy0a...", + "sender_id": "AIDAIENQZJOLO23YVJ4VO", + "_dd.integration": "opentracing", + "_dd.svc_src": "m", + "_dd.base_service": "integration-tests-js-local-container-esm", + "language": "javascript" + }, + "metrics": { + "_dd.agent_psr": 1, + "_dd.top_level": 1, + "_dd.measured": 1, + "retry_count": 1, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + }, + { + "trace_id":"XXXX", + "span_id":"XXXX", + "parent_id":"XXXX", + "name": "aws.lambda", + "resource": "integration-tests-js-local-container-esm", + "service": "integration-tests-js-local-container-esm", + "type": "serverless", + "error": 0, + "meta": { + "_dd.origin": "lambda", + "version": "1.0.0", + "service": "integration-tests-js-local-container-esm", + "runtime-id":"XXXX", + "span.kind": "server", + "cold_start": "false", + "function_arn":"XXXX", + "function_version": "$LATEST", + "request_id":"XXXX", + "resource_names": "integration-tests-js-local-container-esm", + "functionname": "integration-tests-js-local-container-esm", + "datadog_lambda":"XXXX", + "dd_trace": "", + "function_trigger.event_source": "sqs", + "function_trigger.event_source_arn": "arn:aws:sqs:us-east-2:123456789012:my-queue", + "_dd.integration": "opentracing", + "language": "javascript" + }, + "metrics": { + "_dd.measured": 1, + "process_id":XXXX, + "_sampling_priority_v1": 1 + }, + "start":XXXX, + "duration":XXXX, + "links": [] + } + ] + ] +} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 3008 MB Max Memory Used: XXXX MB +XXXX [INFO] (rapid) INVOKE RTDONE(status: success, produced bytes: 0, duration: XXXXms) diff --git a/integration_tests_local/snapshots/return_values/default.json b/integration_tests_local/snapshots/return_values/default.json new file mode 100644 index 00000000..707244da --- /dev/null +++ b/integration_tests_local/snapshots/return_values/default.json @@ -0,0 +1 @@ +{"message":"hello, dog!"} diff --git a/migration_parity.md b/migration_parity.md index e18aef9c..1f637edc 100644 --- a/migration_parity.md +++ b/migration_parity.md @@ -234,7 +234,7 @@ conditional on the extension being present. | Row | Feature | Why unprotected | Plan | |---|---|---|---| | Handler lifecycle | `time_to_first_byte`, response streaming | RIE may not support streaming invocations | L3 `lambda-features`; re-check RIE support at lifecycle phase | -| Span tags | `proactive_initialization` | RIE cannot produce a proactively-initialized sandbox; normalization drops its markers | L3 `lambda-features` | +| Span tags | `proactive_initialization` | RIE *can* produce one via `SIMULATE_PROACTIVE_INIT` (verified: emits `"proactive_initialization":1`, `proactive_initialization:true`, `cold_start:false`), but normalization drops those markers and the goldens are captured from immediate-invoke runs, so nothing asserts them | L2 proactive fixture + `*_node18` override golden (now cheap via the override mechanism), else L3 `lambda-features` | | Span tags | `_dd.parent_source` | absent from current goldens | add fixture from old implementation, else L3 | | Config | `DD_TRACE_DISABLED_INSTRUMENTATIONS=lambda` alias | no fixture sets it | unit test | | Shim | ESM double-registration guard, init-error telemetry | no fixture | unit tests |