Skip to content

Build the Ruby layer for both x86_64 and arm64 - #2665

Merged
wpessers merged 4 commits into
open-telemetry:mainfrom
wpessers:feat/ruby-arm-support
Oct 13, 2026
Merged

wpessers merged 4 commits into
open-telemetry:mainfrom
wpessers:feat/ruby-arm-support

Conversation

@wpessers

@wpessers wpessers commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Fixes #2340.

The Ruby layer was built on x86_64 only, so its native gems (google-protobuf, bigdecimal) crashed on arm64.

What changes

  • ruby/src/otel/Dockerfile now builds the gems for Ruby 3.3, 3.4 and 4.0 on both linux/amd64 and linux/arm64 using the aws sam images, in six parallel stages. A final stage merges both architecture trees into one ruby/gems/<X.Y.0> and zips. RubyGems only activates specs whose platform matches the running machine, so both architectures' gems can live side by side.
  • ruby/src/otel/install-gems.sh installs with the lockfile frozen and sets install_extension_in_lib: false, so compiled extensions exist only under extensions/<arch>-linux/ and never in the arch-agnostic gems/<name>/lib/. The build fails if any path differs between the two architecture trees, guarding against future clashes.
  • The build action sets up QEMU for the arm64 stages and reads the SDK version from Gemfile.lock instead of running Ruby on the runner. The Ruby CI workflow now calls that action.
  • The integration test asserts FunctionError is unset before parsing the payload, so an init crash surfaces as the real error.
  • Ruby 4.0 is added as a supported runtime.

The layer keeps its same name as today.

Perf Test Results

The layer no longer bundles rbenv's default gems, the gem download cache or generated docs, so it shrinks despite the added architecture and Ruby version:

layer-ruby/0.13.0 this PR
zipped 38.7 MB 12.1 MB
unzipped 100 MB 24.8 MB

Verified locally with the Lambda emulator images (public.ecr.aws/lambda/ruby:3.3, :3.4 and :4.0, amd64 and arm64) through AWS_LAMBDA_EXEC_WRAPPER=/opt/otel-handler: all six combinations load the matching native libraries and start the SDK tracer provider.

@wpessers
wpessers marked this pull request as ready for review October 13, 2026 03:43
@wpessers
wpessers requested a review from a team as a code owner October 13, 2026 03:43
@github-actions github-actions Bot added ruby Pull requests that update Ruby code docker ci labels Oct 13, 2026
Comment thread ruby/src/otel/Dockerfile Outdated
Comment thread ruby/src/otel/Dockerfile Outdated
Comment thread ruby/src/otel/Dockerfile Outdated
Comment thread ruby/src/otel/Dockerfile Outdated
Comment thread ruby/src/otel/Dockerfile
@wpessers
wpessers requested review from a team and thompson-tomo October 13, 2026 06:33
@github-project-automation github-project-automation Bot moved this from Todo to Need more Approval in Lambda Triage Oct 13, 2026
@wpessers
wpessers merged commit 00e9737 into open-telemetry:main Oct 13, 2026
13 checks passed
@github-project-automation github-project-automation Bot moved this from Need more Approval to Done in Lambda Triage Oct 13, 2026
@wpessers
wpessers deleted the feat/ruby-arm-support branch October 13, 2026 20:08
thompson-tomo pushed a commit to thompson-tomo/opentelemetry-lambda that referenced this pull request Oct 14, 2026
…emetry#2665)

* Build the Ruby layer for both x86_64 and arm64

* docs: cleanup comments in the Ruby layer build

* Add Ruby 4.0 to the Ruby layer

* Pin the SAM build images to 1.168.0
thompson-tomo added a commit that referenced this pull request Oct 14, 2026
…2669)

* Build the Ruby layer for both x86_64 and arm64

* docs: cleanup comments in the Ruby layer build

* Add Ruby 4.0 to the Ruby layer

* Pin the SAM build images to 1.168.0

Co-authored-by: Warre Pessers <45464718+wpessers@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci docker ruby Pull requests that update Ruby code

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

ruby: layer doesn't work on arm arch

2 participants