Skip to content

Node.js combined layer: sync to upstream 0.24.0, Logz.io hooks for route naming and async trace propagation - #24

Merged
amosd92 merged 7 commits into
mainfrom
feat/nodejs-upstream-sync-and-hooks
Nov 26, 2026
Merged

amosd92 merged 7 commits into
mainfrom
feat/nodejs-upstream-sync-and-hooks

Conversation

@amosd92

@amosd92 amosd92 commented Nov 25, 2026 •

Copy link
Copy Markdown

Why

The released Node.js combined layer (combined-layer-nodejs/v1.0.0, Sep 2025) has two problems that make it unusable for Lambda APM today:

  1. No AWS SDK spans. Calls to DynamoDB, SQS, S3 and EventBridge show up only as anonymous POST/GET/PUT HTTP spans, with no rpc.*, db.system or messaging.* attributes. Reproduced on nodejs22.x with ESM and CommonJS handlers, the runtime-provided SDK, and bundled @aws-sdk/client-* 3.699, 3.1045 and 3.1177. Current SDK releases moved smithy-client/middleware-stack into @smithy/core, which the bundled instrumentation does not hook. The upstream 0.24.0 Node.js layer handles both.
  2. Traces break across async hops. Context is lost at EventBridge, Kinesis and IoT, Node's built-in fetch is not instrumented by default, and API Gateway spans are named after the function instead of the route.

What changed

  • nodejs/ synced to upstream layer-nodejs/0.24.0 (first commit). Fork-specific files kept: nodejs/README.md, packages/layer/build-combined.sh, and the build-combined npm script. The collector is not synced (19 conflicts with our Logz.io exporter and Telemetry API receiver changes); it is left as is.
  • nodejs/packages/layer/logzio/logzio-otel-hooks.cjs:
    • API Gateway spans named METHOD /route, with http.route, http.request.method, faas.trigger and the status code (current and legacy names, since APM reads http_status_code today).
    • Sending side: adds a _logzio_trace field to JSON payloads on EventBridge PutEvents, Kinesis PutRecord(s) and IoT Publish. Non-JSON payloads are untouched. LOGZIO_PROPAGATION=off disables it.
    • Receiving side: continues the first record's trace and adds span links for every record in a Kinesis/SQS batch.
    • Cold starts: a cold start child span and faas.init_duration_ms on the first invocation of each instance (skipped for provisioned concurrency).
  • nodejs/packages/layer/logzio/otel-handler: loads the hooks before the SDK; defaults OTEL_NODE_ENABLED_INSTRUMENTATIONS (adds undici), OTEL_METRICS_EXPORTER=none, OTEL_LOGS_EXPORTER=none.
  • collector/config.gateway.yaml: gateway mode. Traces and logs go to a Logz.io gateway collector that computes APM span metrics (OPENTELEMETRY_COLLECTOR_CONFIG_URI=/opt/collector-config/config.gateway.yaml + LOGZIO_GATEWAY_ENDPOINT, LOGZIO_GATEWAY_TOKEN).
  • build-combined.sh: packages the hooks, @opentelemetry/api, the wrapper and the gateway config.
  • README.combined-layers.md: documents all of the above.

How it was tested

On a serverless test app (12 Node.js 22 functions: API Gateway, Aurora, DynamoDB, S3, SQS, EventBridge, Kinesis, IoT Core, plus a gateway collector), using a layer assembled from the published upstream 0.24.0 layers plus these exact hooks/wrapper/config files:

  • One order is one trace from the client through API Gateway, Aurora, EventBridge, DynamoDB, SQS and an ECS service (14 spans, 4 services), with no application code changes.
  • One IoT message is one trace through IoT Core, Kinesis and the consumer function (54 spans, batch of 50 with span links).
  • Every function gets an APM service page through the gateway; operations show POST /orders, GET /orders/{id}.
  • AWS SDK spans present with rpc.service, rpc.method, db.system.name, table names.

Notes for the reviewer

  • Most of the diff is nodejs/package-lock.json regenerated by upstream (about -14k lines). Without it the PR is about +550 / -320, and most of that is upstream code taken as-is.

Not verified / follow-ups

  • build-combined.sh was not run locally. Please run the release workflow on a test tag first (e.g. publish to one region) and smoke-test before a production release.
  • The collector is still the fork's version. A full sync with upstream collector 0.24 is a separate piece of work.
  • config.combined.yaml still hard-codes the US metrics listener (listener.logz.io:8053).
  • Cold starts: verified. The first invocation of each new instance gets a cold start child span (process start to handler call, 1.2 s on the test app) and faas.init_duration_ms, inside the request's own trace. Telemetry API platform events are no longer exported as separate traces.
  • arm64 is built by the existing workflow matrix but was only tested on x86_64.

https://claude.ai/code/session_01QdKvbfTtH9eMeMyYNq5Nht

Brings the Node.js instrumentation layer in line with open-telemetry/opentelemetry-lambda
layer-nodejs/0.24.0. Fork-specific nodejs files kept: README.md, packages/layer/build-combined.sh,
and the build-combined script in packages/layer/package.json.

Claude-Session: https://claude.ai/code/session_01QdKvbfTtH9eMeMyYNq5Nht
- logzio-otel-hooks.cjs: API Gateway route naming and HTTP attributes; trace propagation
  through EventBridge, Kinesis and IoT JSON payloads; batch span links for Kinesis/SQS.
- otel-handler: loads the hooks before the SDK; defaults OTEL_NODE_ENABLED_INSTRUMENTATIONS
  (adds undici), OTEL_METRICS_EXPORTER=none, OTEL_LOGS_EXPORTER=none.
- collector/config.gateway.yaml: traces and logs to a Logz.io gateway collector (APM).
- build-combined.sh: packages the hooks, @opentelemetry/api, the wrapper and the gateway config.
- README.combined-layers.md: documents the above.

Claude-Session: https://claude.ai/code/session_01QdKvbfTtH9eMeMyYNq5Nht

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

Comment thread nodejs/package-lock.json

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❗Cycode: Security vulnerability found in newly introduced dependency.

Risk Score 64 (MEDIUM)
Severity High
Issue brace-expansion: DoS via uncontrolled recursion on nested brace groups causing stack exhaustion: CVE-2026-102278
Ecosystem NPM
Dependency brace-expansion
Dependency Paths aws-cdk-lib 2.272.0 -> minimatch 10.2.5 -> brace-expansion 5.0.9
Direct Dependency No
Development Dependency Yes
Upgrade 5.0.11

Summary

expand_() recurses once per level of brace nesting. Deeply nested input exhausts the native stack and crashes the process.

This is distinct from CVE-2026-14257 / GHSA-mh99-v99m-4gvg, which made the tail iterative (recursion on m.post, driven by how many groups are chained). Nesting depth drives a different recursion that the tail fix never touched, so the documented constant-stack-depth guarantee only ever covered chained input, not nested input.

It is also distinct from GHSA-6j4f-fj2g-mc7p, which fixed recursion in parseCommaParts(). Both payloads below still crash with that fix applied.

Two recursion sites

Comma members. Each alternative of a brace set is expanded by a recursive call, so nesting a set inside every alternative recurses once per level:

expand('{a,'.repeat(4000) + 'z' + '}'.repeat(4000))
// RangeError: Maximum call stack size exceeded

Crashes at depth 3,907 - about 15.6 KB of input.

Single set. A brace set whose body parses to a single part is expanded by a recursive call before being re-wrapped (x{{a,b}}y -> x{a}y x{b}y), which recurses once per nesting level:

expand('{'.repeat(3200) + 'a,b' + '}'.repeat(3200))
// RangeError: Maximum call stack size exceeded

Crashes at depth 3,125 - about 6.25 KB of input. This is the cheapest stack-exhaustion payload known against this package: roughly a quarter the input of GHSA-6j4f-fj2g-mc7p (29 KB), and about a tenth of minimatch's MAX_PATTERN_LENGTH (65,536).

Why max and maxLength do not help

Both crashes happen while recursing into sub-expansions, before the result set grows. The payloads produce almost no output - the single-set case yields 2 results - so neither bound is ever the limiter. expand(payload, { max: 1, maxLength: 1 }) still overflows.

Impact

Any application passing an untrusted string to expand(), directly or through minimatch / glob as a user-supplied glob pattern, can be crashed. In Node a RangeError the application does not catch terminates the process, so a server globbing user input is exposed to remote unauthenticated denial of service.

Availability only. No code execution, no data exposure.

Affected versions

Verified affected on 1.1.18, 2.1.4, 3.0.6 and 5.0.9, at near-identical depths on every line (single set: 3,125 on all four; comma members: 3,907-4,102). Not a regression from any recent fix - the gap predates them.

Patch

A maxDepth bound (default EXPANSION_MAX_DEPTH) is threaded through expand_(). Past the cap a group is treated as non-expanding and returned literally, which is how the parser already handles a group that cannot expand. This matches the existing max / maxLength caps, which truncate rather than throw, so expand() continues never to throw on any input.

The default sits far above any realistic nesting depth and well below the crash threshold.

Description

Detects when new vulnerabilities affect your dependencies.

Tell us how you wish to proceed using one of the following commands:

Tag Short Description
#cycode_ignore_manifest_here <reason> Applies to this manifest in this request only
#cycode_ignore_package_here <reason> Applies to this manifest for this package in this request only

⚠️ When commenting on Github, you may need to refresh the page to see the latest updates.

⚠️ Due to API limitations, we can not comment on the exact line (2869)

Comment thread nodejs/package-lock.json

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❗Cycode: Security vulnerability found in newly introduced dependency.

Risk Score 64 (MEDIUM)
Severity High
Issue brace-expansion: DoS via uncontrolled recursion in parseCommaParts causing stack exhaustion: CVE-2026-102276
Ecosystem NPM
Dependency brace-expansion
Dependency Paths aws-cdk-lib 2.272.0 -> minimatch 10.2.5 -> brace-expansion 5.0.9
Direct Dependency No
Development Dependency Yes
Upgrade 5.0.10

Summary

parseCommaParts() can exhaust the native stack and crash the process. There are two distinct ways to trigger it, both reachable from a single untrusted pattern string.

This is the parsing-side counterpart to CVE-2026-14257 / GHSA-mh99-v99m-4gvg. That fix made expand_() iterative and documented a constant-stack-depth guarantee, but parseCommaParts() was left recursive, so the guarantee only held for one of the two parsing paths.

Vector 1 - unbounded recursion on post

parseCommaParts() recursed on the remainder of the string once per brace group:

const postParts = parseCommaParts(post)   // unbounded

A brace group containing many comma-separated groups drives one recursion level per group:

expand('{' + '{a},'.repeat(7000) + 'b}')
// RangeError: Maximum call stack size exceeded

About 7,300 repetitions - roughly 29 KB of input - is enough on Node 24; roughly 6,300 (25 KB) on Node 18. The threshold is identical on every affected release line.

Vector 2 - push.apply with an unbounded array

Even with the recursion removed, parseCommaParts() spread whole arrays into an argument list:

p.push.apply(p, postParts)
parts.push.apply(parts, p)

Function.prototype.apply places one argument per element on the stack, so a single large array overflows it. This needs no recursion depth at all - the following reaches a recursion depth of exactly 1:

expand('{{x},' + 'a,'.repeat(125000) + 'b}')
// RangeError: Maximum call stack size exceeded

Threshold is about 124,300 repetitions (~249 KB). This vector was not part of the original report; it was found while verifying the fix. A patch that only de-recurses but keeps push.apply leaves a working denial of service behind.

Why max and maxLength do not help

Both crashes happen during parsing, before any expansion. The payloads produce one result per group, so output size grows linearly with input and is never the limiter. expand(payload, { max: 1, maxLength: 1 }) still overflows.

Impact

Any application that passes an untrusted string to expand() - directly, or through minimatch / glob where it is a user-supplied glob pattern - can be crashed. In Node, a RangeError that the application does not catch terminates the process, so a server that globs user input is exposed to remote unauthenticated denial of service.

minimatch's own MAX_PATTERN_LENGTH cap (65,536) does not help against vector 1: the overflow threshold sits well below it. Confirmed on minimatch 10.2.6 - a 64,003-byte pattern passes the length check and overflows both minimatch.braceExpand() and new minimatch.Minimatch().

This is an availability-only issue. No code execution and no data exposure.

Not a regression

5.0.8 and 5.0.9 overflow at the same repetition count, so the gap predates the recent advisories; those fixes simply did not reach it. Verified affected on 1.1.18, 2.1.4, 3.0.6, 5.0.8 and 5.0.9, all at an identical threshold.

Patch

parseCommaParts() is rewritten as a loop that carries the partial part across chunks, and every array append uses an element-by-element loop rather than push.apply. The redundant if (!str) return [''] guard is dropped - the loop returns [''] for the empty string on its own.

Equivalence of the old and new implementations was checked by differential testing: exhaustive over every string of {, }, ,, a up to length 7 plus 300,000 random inputs - 322,000 cases, zero mismatches.

Severity note

Scored 7.5 High under CVSS 3.1 for consistency with the other availability advisories on this package (GHSA-mh99-v99m-4gvg, GHSA-rgw5-rvv9-x895), which use the same vector. The reporter self-assessed 6.9 Medium under CVSS 4.0 (CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N).

Credit

Reported by baeseungwon1010, with a working proof of concept and a proposed patch. Vector 2 was identified during maintainer verification.

Description

Detects when new vulnerabilities affect your dependencies.

Tell us how you wish to proceed using one of the following commands:

Tag Short Description
#cycode_ignore_manifest_here <reason> Applies to this manifest in this request only
#cycode_ignore_package_here <reason> Applies to this manifest for this package in this request only

⚠️ When commenting on Github, you may need to refresh the page to see the latest updates.

⚠️ Due to API limitations, we can not comment on the exact line (2869)

@amosd92
amosd92 marked this pull request as draft November 25, 2026 17:11
@amosd92 amosd92 changed the title Node.js combined layer: sync to upstream 0.24.0, Logz.io hooks for route naming and async trace propagation [WIP] Node.js combined layer: sync to upstream 0.24.0, Logz.io hooks for route naming and async trace propagation Nov 25, 2026
@amosd92 amosd92 changed the title [WIP] Node.js combined layer: sync to upstream 0.24.0, Logz.io hooks for route naming and async trace propagation Node.js combined layer: sync to upstream 0.24.0, Logz.io hooks for route naming and async trace propagation Nov 25, 2026
@amosd92
amosd92 marked this pull request as ready for review November 25, 2026 18:11
Comment thread nodejs/package-lock.json

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❗Cycode: Security vulnerability found in newly introduced dependency.

Risk Score 64 (MEDIUM)
Severity High
Issue brace-expansion: DoS via uncontrolled recursion on nested brace groups causing stack exhaustion: CVE-2026-102278
Ecosystem NPM
Dependency brace-expansion
Dependency Paths aws-cdk-lib 2.272.0 -> minimatch 10.2.5 -> brace-expansion 5.0.9
Direct Dependency No
Development Dependency Yes
Upgrade 5.0.11

Summary

expand_() recurses once per level of brace nesting. Deeply nested input exhausts the native stack and crashes the process.

This is distinct from CVE-2026-14257 / GHSA-mh99-v99m-4gvg, which made the tail iterative (recursion on m.post, driven by how many groups are chained). Nesting depth drives a different recursion that the tail fix never touched, so the documented constant-stack-depth guarantee only ever covered chained input, not nested input.

It is also distinct from GHSA-6j4f-fj2g-mc7p, which fixed recursion in parseCommaParts(). Both payloads below still crash with that fix applied.

Two recursion sites

Comma members. Each alternative of a brace set is expanded by a recursive call, so nesting a set inside every alternative recurses once per level:

expand('{a,'.repeat(4000) + 'z' + '}'.repeat(4000))
// RangeError: Maximum call stack size exceeded

Crashes at depth 3,907 - about 15.6 KB of input.

Single set. A brace set whose body parses to a single part is expanded by a recursive call before being re-wrapped (x{{a,b}}y -> x{a}y x{b}y), which recurses once per nesting level:

expand('{'.repeat(3200) + 'a,b' + '}'.repeat(3200))
// RangeError: Maximum call stack size exceeded

Crashes at depth 3,125 - about 6.25 KB of input. This is the cheapest stack-exhaustion payload known against this package: roughly a quarter the input of GHSA-6j4f-fj2g-mc7p (29 KB), and about a tenth of minimatch's MAX_PATTERN_LENGTH (65,536).

Why max and maxLength do not help

Both crashes happen while recursing into sub-expansions, before the result set grows. The payloads produce almost no output - the single-set case yields 2 results - so neither bound is ever the limiter. expand(payload, { max: 1, maxLength: 1 }) still overflows.

Impact

Any application passing an untrusted string to expand(), directly or through minimatch / glob as a user-supplied glob pattern, can be crashed. In Node a RangeError the application does not catch terminates the process, so a server globbing user input is exposed to remote unauthenticated denial of service.

Availability only. No code execution, no data exposure.

Affected versions

Verified affected on 1.1.18, 2.1.4, 3.0.6 and 5.0.9, at near-identical depths on every line (single set: 3,125 on all four; comma members: 3,907-4,102). Not a regression from any recent fix - the gap predates them.

Patch

A maxDepth bound (default EXPANSION_MAX_DEPTH) is threaded through expand_(). Past the cap a group is treated as non-expanding and returned literally, which is how the parser already handles a group that cannot expand. This matches the existing max / maxLength caps, which truncate rather than throw, so expand() continues never to throw on any input.

The default sits far above any realistic nesting depth and well below the crash threshold.

Description

Detects when new vulnerabilities affect your dependencies.

Tell us how you wish to proceed using one of the following commands:

Tag Short Description
#cycode_ignore_manifest_here <reason> Applies to this manifest in this request only
#cycode_ignore_package_here <reason> Applies to this manifest for this package in this request only

⚠️ When commenting on Github, you may need to refresh the page to see the latest updates.

⚠️ Due to API limitations, we can not comment on the exact line (2869)

Comment thread nodejs/package-lock.json

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❗Cycode: Security vulnerability found in newly introduced dependency.

Risk Score 64 (MEDIUM)
Severity High
Issue brace-expansion: DoS via uncontrolled recursion in parseCommaParts causing stack exhaustion: CVE-2026-102276
Ecosystem NPM
Dependency brace-expansion
Dependency Paths aws-cdk-lib 2.272.0 -> minimatch 10.2.5 -> brace-expansion 5.0.9
Direct Dependency No
Development Dependency Yes
Upgrade 5.0.10

Summary

parseCommaParts() can exhaust the native stack and crash the process. There are two distinct ways to trigger it, both reachable from a single untrusted pattern string.

This is the parsing-side counterpart to CVE-2026-14257 / GHSA-mh99-v99m-4gvg. That fix made expand_() iterative and documented a constant-stack-depth guarantee, but parseCommaParts() was left recursive, so the guarantee only held for one of the two parsing paths.

Vector 1 - unbounded recursion on post

parseCommaParts() recursed on the remainder of the string once per brace group:

const postParts = parseCommaParts(post)   // unbounded

A brace group containing many comma-separated groups drives one recursion level per group:

expand('{' + '{a},'.repeat(7000) + 'b}')
// RangeError: Maximum call stack size exceeded

About 7,300 repetitions - roughly 29 KB of input - is enough on Node 24; roughly 6,300 (25 KB) on Node 18. The threshold is identical on every affected release line.

Vector 2 - push.apply with an unbounded array

Even with the recursion removed, parseCommaParts() spread whole arrays into an argument list:

p.push.apply(p, postParts)
parts.push.apply(parts, p)

Function.prototype.apply places one argument per element on the stack, so a single large array overflows it. This needs no recursion depth at all - the following reaches a recursion depth of exactly 1:

expand('{{x},' + 'a,'.repeat(125000) + 'b}')
// RangeError: Maximum call stack size exceeded

Threshold is about 124,300 repetitions (~249 KB). This vector was not part of the original report; it was found while verifying the fix. A patch that only de-recurses but keeps push.apply leaves a working denial of service behind.

Why max and maxLength do not help

Both crashes happen during parsing, before any expansion. The payloads produce one result per group, so output size grows linearly with input and is never the limiter. expand(payload, { max: 1, maxLength: 1 }) still overflows.

Impact

Any application that passes an untrusted string to expand() - directly, or through minimatch / glob where it is a user-supplied glob pattern - can be crashed. In Node, a RangeError that the application does not catch terminates the process, so a server that globs user input is exposed to remote unauthenticated denial of service.

minimatch's own MAX_PATTERN_LENGTH cap (65,536) does not help against vector 1: the overflow threshold sits well below it. Confirmed on minimatch 10.2.6 - a 64,003-byte pattern passes the length check and overflows both minimatch.braceExpand() and new minimatch.Minimatch().

This is an availability-only issue. No code execution and no data exposure.

Not a regression

5.0.8 and 5.0.9 overflow at the same repetition count, so the gap predates the recent advisories; those fixes simply did not reach it. Verified affected on 1.1.18, 2.1.4, 3.0.6, 5.0.8 and 5.0.9, all at an identical threshold.

Patch

parseCommaParts() is rewritten as a loop that carries the partial part across chunks, and every array append uses an element-by-element loop rather than push.apply. The redundant if (!str) return [''] guard is dropped - the loop returns [''] for the empty string on its own.

Equivalence of the old and new implementations was checked by differential testing: exhaustive over every string of {, }, ,, a up to length 7 plus 300,000 random inputs - 322,000 cases, zero mismatches.

Severity note

Scored 7.5 High under CVSS 3.1 for consistency with the other availability advisories on this package (GHSA-mh99-v99m-4gvg, GHSA-rgw5-rvv9-x895), which use the same vector. The reporter self-assessed 6.9 Medium under CVSS 4.0 (CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N).

Credit

Reported by baeseungwon1010, with a working proof of concept and a proposed patch. Vector 2 was identified during maintainer verification.

Description

Detects when new vulnerabilities affect your dependencies.

Tell us how you wish to proceed using one of the following commands:

Tag Short Description
#cycode_ignore_manifest_here <reason> Applies to this manifest in this request only
#cycode_ignore_package_here <reason> Applies to this manifest for this package in this request only

⚠️ When commenting on Github, you may need to refresh the page to see the latest updates.

⚠️ Due to API limitations, we can not comment on the exact line (2869)

The hooks add a 'cold start' child span (Node process start to handler call) and
faas.init_duration_ms to the first invocation of each Lambda instance, so a slow first
request shows its init time in the same trace. Provisioned-concurrency instances are skipped.
The gateway config no longer turns Telemetry API platform events into separate traces.

Claude-Session: https://claude.ai/code/session_01QdKvbfTtH9eMeMyYNq5Nht
Node 18 lacks util.styleText, which the ESLint version from upstream 0.24.0 needs.

Claude-Session: https://claude.ai/code/session_01QdKvbfTtH9eMeMyYNq5Nht
…settings

Stale nodejs/ files from before the sync (lerna.json, .eslintrc.js, .eslintignore,
sample-app package-lock.json) are gone upstream and broke the flat ESLint config.

Claude-Session: https://claude.ai/code/session_01QdKvbfTtH9eMeMyYNq5Nht

@8naama 8naama left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!! 💪🏼 Left some comments

Comment thread collector/config.gateway.yaml Resolved
Comment thread nodejs/packages/layer/build-combined.sh Resolved
Comment thread .github/workflows/ci-nodejs.yml Resolved
Comment thread collector/config.gateway.yaml Resolved
- config.gateway.yaml: use the fork's receiver type `telemetryapireceiver`;
  send console logs over OTLP and drop Telemetry API copies of lines
  written inside an invocation.
- collector/config_test.go: load shipped configs with this collector's
  components so unknown component types fail in CI.
- hooks: send console output as OpenTelemetry logs with trace and span IDs,
  flushed with spans at the end of each invocation; tag Kinesis, SQS, SNS
  and DynamoDB Streams invocations with messaging.system and
  messaging.destination.name; stop setting faas.coldstart (the aws-lambda
  instrumentation owns it).
- test/logzio-otel-hooks.spec.mjs: unit tests for the hooks.
- otel-handler: user NODE_OPTIONS first, text aligned with upstream;
  traces and logs exporters default to otlp.
- build-combined.sh: copy @opentelemetry/api from node_modules.
- Workflows: read the Node version from nodejs/.nvmrc.
- Sample app: aws-cdk-lib 2.278.0 (bundles brace-expansion 5.0.13).

Claude-Session: https://claude.ai/code/session_01QdKvbfTtH9eMeMyYNq5Nht
@amosd92

amosd92 commented Nov 26, 2026

Copy link
Copy Markdown
Author

Cycode brace-expansion findings: fixed by bumping the sample app's aws-cdk-lib to 2.278.0, which bundles brace-expansion 5.0.13. It's a sample-app dev dependency and isn't in the layer.

Comment thread collector/config_test.go Outdated
factories, err := lambdacomponents.Components("collector")
require.NoError(t, err)

for _, file := range []string{"config.gateway.yaml"} {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for _, file := range []string{"config.gateway.yaml"} {
for _, file := range []string{"config.gateway.yaml", "config.yaml", "config.combined.yaml", "config.e2e.yaml"} {

export OTEL_NODE_ENABLED_INSTRUMENTATIONS="${OTEL_NODE_ENABLED_INSTRUMENTATIONS:-http,undici,dns,net,pg,mysql,mysql2,redis,ioredis,mongodb,express,graphql}"
export OTEL_TRACES_EXPORTER="${OTEL_TRACES_EXPORTER:-otlp}"
export OTEL_LOGS_EXPORTER="${OTEL_LOGS_EXPORTER:-otlp}"
export OTEL_METRICS_EXPORTER="${OTEL_METRICS_EXPORTER:-none}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This turns off SDK application metrics, which is separate from the span metrics the gateway computes from traces; the config.combined.yaml has otlp in its metrics pipeline specifically to carry those; so perhaps worth to keep it as:

Suggested change
export OTEL_METRICS_EXPORTER="${OTEL_METRICS_EXPORTER:-none}"
export OTEL_METRICS_EXPORTER="${OTEL_METRICS_EXPORTER:-otlp}"

const r = event?.Records?.[0];
const src = SOURCES[r?.eventSource || r?.EventSource];
if (!src) return;
const arn = r.eventSourceARN || r.EventSubscriptionArn || '';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const arn = r.eventSourceARN || r.EventSubscriptionArn || '';
const arn = r.eventSourceARN || r.Sns?.TopicArn || r.EventSubscriptionArn || '';

Comment on lines +276 to +279
// Called by the layer with its logger provider (only when OTEL_LOGS_EXPORTER is not "none").
globalThis.configureLoggerProvider = provider => {
loggerProvider = provider;
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

per claude:

This takes the logger provider for our own use, and as a side effect the layer stops registering it globally (wrapper.ts:494-499 — it does one or the other). So a customer using the OpenTelemetry Logs API directly would lose their logs. Can we register it globally as well?

const loggerProvider = new LoggerProvider(loggerConfig as object);
if (typeof configureLoggerProvider === 'function') {
configureLoggerProvider(loggerProvider);
} else {
logs.setGlobalLoggerProvider(loggerProvider);
}

…D lines

- hooks: the invocation span carries faas.timeout_ms (configured timeout,
  from the remaining time at invocation start) and faas.memory_used_mb
  (peak resident memory of the instance so far). Configured memory is
  already the resource attribute faas.max_memory.
- config.gateway-traces.yaml: traces only, for functions whose logs reach
  Logz.io another way (use with OTEL_LOGS_EXPORTER=none); packaged by
  build-combined.sh and covered by config_test.go.
- config.gateway.yaml: drop Lambda's per-invocation START/END lines.

Claude-Session: https://claude.ai/code/session_01QdKvbfTtH9eMeMyYNq5Nht
@amosd92
amosd92 merged commit 9d244cb into main Nov 26, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants