Skip to content

feat: upgrade to OpenTelemetry v2.x with cross-platform build support (Nodejs)#50

Merged
rnishtala-sumo merged 15 commits into
mainfrom
feat-upgrade-opentelemetry-v2-cross-platform
Aug 25, 2025
Merged

feat: upgrade to OpenTelemetry v2.x with cross-platform build support (Nodejs)#50
rnishtala-sumo merged 15 commits into
mainfrom
feat-upgrade-opentelemetry-v2-cross-platform

Conversation

@rnishtala-sumo

@rnishtala-sumo rnishtala-sumo commented Aug 8, 2025

Copy link
Copy Markdown
Contributor

🚀 OpenTelemetry v2.x Upgrade (Nodejs)

Summary

This PR upgrades the Node.js Lambda layer from OpenTelemetry v1.x to v2.x with cross-platform build support and CI compatibility. Related upstream PR - https://github.com/open-telemetry/opentelemetry-lambda/pull/1789/files

🔧 Key Changes

Dependencies & Compatibility

  • Updated package.json to OpenTelemetry v2.x (47+ packages upgraded)
  • Fixed import paths for v2.x compatibility
  • Added TypeScript declarations () to resolve compilation errors
  • Updated submodule to commit 1fca858 (v2.x compatible)

Build System Enhancements

  • Cross-platform architecture detection (auto-detects arm64/amd64)

  • CI environment compatibility (respects env var)

  • External package installer for runtime dependencies

- Update package.json to OpenTelemetry v2.x dependencies (47+ packages)
- Fix TypeScript compilation errors with global.d.ts declarations
- Add automatic architecture detection for arm64/amd64 builds
- Update import paths for v2.x compatibility (otlp-proto → otlp-http)
- Add webpack TypeScript configuration with test file exclusions
- Add install-externals.sh for import-in-the-middle ESM instrumentation
- Update opentelemetry-lambda submodule to commit 1fca858 (v2.x)

Resolves build failures and enables cross-platform Lambda layer generation.
Tested: make build-nodejs now builds successfully on arm64/amd64.
- Fix architecture detection to prioritize ARCHITECTURE env var from CI
- Update collector build to use GOARCH from CI environment
- Fix global.d.ts to avoid test conflicts
- Support both auto-detection (local) and explicit setting (CI)

Resolves 'No files were found' CI error by generating correctly named
opentelemetry-nodejs-{amd64,arm64}.zip files.
@rnishtala-sumo rnishtala-sumo requested a review from a team as a code owner August 8, 2025 19:41
- Add npm run build to execute lerna build for all packages
- Ensure sample apps like aws-sdk generate function.zip artifacts
- Fix CI pipeline artifact generation issues
- Remove redundant individual layer build step
- Replace branch name in bucket name with static prefix
- Bucket name 'feat-upgrade-opentelemetry-v2-cross-platform-nodejs-arm64-16839545560'
  was too long and contained uppercase letters
- New format: 'sumologic-otel-lambda-dev-{run_id}-{architecture}'
- Also clean up layer naming for consistency
- Replace deprecated 'vpc = true' with 'domain = "vpc"'
- Fixes compatibility with newer Terraform AWS provider versions
- Resolves 'An argument named "vpc" is not expected here' error
@rnishtala-sumo rnishtala-sumo changed the title feat: upgrade to OpenTelemetry v2.x with cross-platform build support feat: upgrade to OpenTelemetry v2.x with cross-platform build support (Nodejs) Aug 8, 2025
Comment thread nodejs/packages/layer/src/wrapper.ts
- Update telemetry.sdk.version from '1.17.1' to '2.0.0'
- Aligns test expectations with OpenTelemetry v2.x upgrade
- Ensures integration tests validate correct SDK version reporting
@rnishtala-sumo rnishtala-sumo force-pushed the feat-upgrade-opentelemetry-v2-cross-platform branch from 65c08f3 to ea3a1b6 Compare August 12, 2025 20:43
Comment thread collector/build.sh Outdated
- Create detect-arch.sh to handle architecture detection logic
- Update build.sh to use the new script instead of inline logic
- Improves maintainability and reusability of architecture detection
- Replace deprecated v1.x wrapper with v2.0.0 compatible implementation
- Fix tsconfig.webpack.json to work without broken extends reference
- Add missing otel-handler script for proper Lambda initialization
- Resolves Runtime.ExitError during wrapper initialization
- Replace getEnv() with getStringFromEnv() for OTEL_LOG_LEVEL
- Replace detectResourcesSync() with async detectResources()
- Update build scripts for cross-platform architecture support
- Use ${env:SUMO_OTLP_HTTP_ENDPOINT_URL} in collector config
- Add getExportersFromEnv() following OTel 2.0 patterns
- Remove debug traces and sensitive URL logging
@rnishtala-sumo rnishtala-sumo requested a review from a team August 18, 2025 20:34
Comment thread nodejs/packages/layer/src/wrapper.ts Outdated
@rnishtala-sumo rnishtala-sumo requested review from a team and chan-tim-sumo August 19, 2025 20:20
@rnishtala-sumo rnishtala-sumo force-pushed the feat-upgrade-opentelemetry-v2-cross-platform branch from be33d4a to f67dcbc Compare August 20, 2025 18:41
@rnishtala-sumo rnishtala-sumo merged commit 08f0157 into main Aug 25, 2025
21 checks passed
@rnishtala-sumo rnishtala-sumo deleted the feat-upgrade-opentelemetry-v2-cross-platform branch August 25, 2025 15:38
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.

4 participants