From e3553dc75f7f742e08da8c8c37252366dbc08307 Mon Sep 17 00:00:00 2001 From: Oskar Pearson Date: Fri, 10 Mar 2023 14:12:29 +0000 Subject: [PATCH] Add Ruby 3.1 support while keeping 2.7 compatibility Ruby 3.1 requires hashes to be splatted to methods requiring keyword-arguments. Ruby 2.7 supports double-splatting in this way, so this commit changes the code to use this structure. Context: While https://github.com/DataDog/datadog-lambda-rb/issues/70 makes it clear that this gem doesn't have official Ruby 3.1 support on the roadmap yet, this two-character change make the gem work for people that want to run 3.1 at their own risk. (Notably when using more recent docker images) Note that this doesn't change CI for datadog-lambda-rb to use 3.1, since that's a more significant task. The integration tests are tied to the officially-supported AWS ruby version, and at this point AWS only officially supports Ruby 2.7. So to get CI to test Ruby 3.1 we would need to transition the integration tests to docker-based lambdas. It's worth noting that https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html does indicate that Ruby 3.2 will probably be coming "fairly soon", with Ruby 2.7 being provisionally marked as end-of-life at Nov 15, 2023 --- lib/datadog/lambda/trace/ddtrace.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/datadog/lambda/trace/ddtrace.rb b/lib/datadog/lambda/trace/ddtrace.rb index fadd104..89697c6 100644 --- a/lib/datadog/lambda/trace/ddtrace.rb +++ b/lib/datadog/lambda/trace/ddtrace.rb @@ -33,7 +33,7 @@ def wrap_datadog(options, &block) return block.call end - Datadog::Tracing.trace('aws.lambda', options) do |_span| + Datadog::Tracing.trace('aws.lambda', **options) do |_span| block.call end end