feat: support Ruby 4.0#148
Merged
Merged
Conversation
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
duncanista
approved these changes
May 13, 2026
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.
jcstorms1
approved these changes
May 13, 2026
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.0managed runtime in April 2026 (announcement). Ruby 4.0 is the latest LTS release (supported through March 2029) and the base imagepublic.ecr.aws/lambda/ruby:4.0is available for bothamd64andarm64.Adds two new published layers per architecture:
Datadog-Ruby4-0Datadog-Ruby4-0-ARMMotivation
APMSVLS-512
Testing Guidelines
Unit tests and integration tests run against the new
ruby4.0matrix entry. Layers were built and verified locally with Colima for all four supported Ruby versions × both architectures, andcheck_layer_size.shpasses 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
Dockerfileonly defines a single globaldatadoggem 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:datadoggem2.12→2.30in the layerDockerfile. 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}.logupdates 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 removedostructfrom the default gems;rake 12.xrequires it at load time. Rake 13.x doesn't and is compatible with 3.2/3.3/3.4.datadog ~> 2.12→~> 2.30to 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.shpreviously omitted theDatadog-Ruby3-4andDatadog-Ruby4-0layer names, and every-ARMvariant for all Ruby versions. Both gaps are now closed (8 entries in the parallel arrays: 4 versions × amd64+arm64).scripts/list_layers.shwas similarly missingDatadog-Ruby3-4,Datadog-Ruby4-0, and their-ARMsiblings — added..gitlab/Dockerfilehad a misleading# Install Ruby X.Ycomment overapt-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>inscripts/run_integration_tests.sh. On Ruby 4.0 the dd-trace AWS contrib reportsAvailable?: trueand emits the concreteaws-sdk-coreversion (e.g.aws@3.246.0) in theintegrations_loadedlog line, where Ruby 3.x snapshots showaws@empty. Without the filter, the ruby40 snapshots would drift any time AWS bumpsaws-sdk-corein the runtime base image. The four ruby40 snapshots are refreshed accordingly.Types of changes
Check all that apply