Skip to content

feat: support Ruby 4.0#148

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 14 commits into
mainfrom
feat/ruby-4.0
May 13, 2026
Merged

feat: support Ruby 4.0#148
gh-worker-dd-mergequeue-cf854d[bot] merged 14 commits into
mainfrom
feat/ruby-4.0

Conversation

@zarirhamza
Copy link
Copy Markdown
Contributor

@zarirhamza zarirhamza commented May 13, 2026

What does this PR do?

Adds support for Ruby 4.0, following the same pattern as #118 (Ruby 3.4).

AWS Lambda added the ruby4.0 managed runtime in April 2026 (announcement). Ruby 4.0 is the latest LTS release (supported through March 2029) and the base image public.ecr.aws/lambda/ruby:4.0 is available for both amd64 and arm64.

Adds two new published layers per architecture:

  • Datadog-Ruby4-0
  • Datadog-Ruby4-0-ARM

Motivation

APMSVLS-512

Testing Guidelines

Unit tests and integration tests run against the new ruby4.0 matrix entry. Layers were built and verified locally with Colima for all four supported Ruby versions × both architectures, and check_layer_size.sh passes on each (~34 MB uncompressed, well under the 100 MB cap).

Additional Notes

Dependency bumps — heads-up: these affect ALL Ruby versions, not just 4.0

The Dockerfile only defines a single global datadog gem version that every Ruby layer (3.2, 3.3, 3.4, AND 4.0) inherits. Because dd-trace-rb 2.12 cannot install on Ruby 4.0, the gem version had to advance globally:

  • datadog gem 2.122.30 in the layer Dockerfile. dd-trace-rb only gained Ruby 4.0 install support in 2.24.0 (Jan 2026); 2.30 is the latest stable 2.x as of this PR. The integration test snapshot diffs show the customer-visible churn: every existing *_ruby{32,33,34}.log updates the "version":"2.12.0""2.30.0" line and gains the new "meta_struct":{} field that the 2.x serializer emits. This means Ruby 3.2/3.3/3.4 customers will also receive dd-trace-rb 2.30 once these layers publish — worth mentioning in the release notes.
  • rake ~> 12.3~> 13.0 (gemspec dev dependency). Ruby 4.0 removed ostruct from the default gems; rake 12.x requires it at load time. Rake 13.x doesn't and is compatible with 3.2/3.3/3.4.
  • gemspec datadog ~> 2.12~> 2.30 to match the Dockerfile pin, so fresh dev boxes on Ruby 4.0 can't resolve an unworkable 2.12.x candidate.

Cleanup folded in

  • scripts/add_new_region.sh previously omitted the Datadog-Ruby3-4 and Datadog-Ruby4-0 layer names, and every -ARM variant for all Ruby versions. Both gaps are now closed (8 entries in the parallel arrays: 4 versions × amd64+arm64).
  • scripts/list_layers.sh was similarly missing Datadog-Ruby3-4, Datadog-Ruby4-0, and their -ARM siblings — added.
  • .gitlab/Dockerfile had a misleading # Install Ruby X.Y comment over apt-get install ruby-full. Replaced with an accurate comment explaining the version doesn't matter for this build-tooling image.

Snapshot scrubbing

Added a perl filter for aws@<version> in scripts/run_integration_tests.sh. On Ruby 4.0 the dd-trace AWS contrib reports Available?: true and emits the concrete aws-sdk-core version (e.g. aws@3.246.0) in the integrations_loaded log line, where Ruby 3.x snapshots show aws@ empty. Without the filter, the ruby40 snapshots would drift any time AWS bumps aws-sdk-core in the runtime base image. The four ruby40 snapshots are refreshed accordingly.

Types of changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog

zarirhamza added 10 commits May 13, 2026 13:50
Ruby 4.0 removed ostruct from the default gems, which rake 12.x requires at
load time. Bumping the gemspec dev dep to rake ~> 13.0 fixes this while
remaining compatible with Ruby 3.2/3.3/3.4.

dd-trace-rb gained Ruby 4.0.x install support in 2.24.0 (Jan 2026); the
Dockerfile pinned datadog gem 2.12 won't install on Ruby 4.0. Bump to 2.30
(latest stable 2.x).
Captures four new ruby40 log snapshots and refreshes ruby32/33/34 snapshots
against the bumped datadog gem (2.12 → 2.30):

- version string bump
- new meta_struct field on spans (added in dd-trace 2.x serializer)
- WARN line now reports AWS integration as Available?/Compatible? true on
  ruby40 (vs false on older Ruby versions) — captured as observed

Generated via:
  UPDATE_SNAPSHOTS=true DD_API_KEY=… ARCH=amd64 \
    aws-vault exec sso-serverless-sandbox-account-admin-8h -- \
    ./scripts/run_integration_tests.sh
@zarirhamza zarirhamza marked this pull request as ready for review May 13, 2026 18:28
@zarirhamza zarirhamza requested review from a team as code owners May 13, 2026 18:28
2.12 fails to install on Ruby 4.0 (dd-trace-rb only added 4.0.x install
support in 2.24.0). Bumping the floor to ~> 2.30 to match the Dockerfile
pin and prevent fresh dev boxes on Ruby 4.0 from resolving an
unworkable 2.12.x candidate.
The script was previously missing every -ARM layer name, so a freshly
added region would only receive amd64 Ruby layers. Extend both parallel
arrays so 3.2/3.3/3.4/4.0 × amd64+arm64 are all copied.
On Ruby 4 the dd-trace AWS contrib detects as Available, so the
integrations_loaded log line embeds a concrete aws-sdk-core version
(e.g. aws@3.246.0) where the older Ruby snapshots show aws@ with no
version. Add a perl scrub for aws@<version> and refresh the four
ruby40 snapshots to match, so future aws-sdk-core updates in the
runtime base image don't drift the snapshots.
The previous '# Install Ruby X.Y' comments were misleading because the
apt-get install ruby-full underneath resolves to whatever Debian ships
(not the named version). The image only runs build/publish tooling
anyway; lint/unit/integration tests use per-runtime images defined in
runtimes.yaml.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants