Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use double splat for Ruby >= 3.0 #2915

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ Version <dev> updates View Componment instrumentation to use a default metric na

In 9.14.0, we released a fix for calls to the deprecated `Bundler.rubygems.all_specs`, but the fix fell short for the agent's Grape instrumentation and deprecation warnings could still be raised. The condition has been simplified and deprecation warnings should no longer be raised. Thank you, [@excelsior](https://github.com/excelsior) for bringing this to our attention. [Issue#](https://github.com/newrelic/newrelic-ruby-agent/issues/2885) [PR#2906](https://github.com/newrelic/newrelic-ruby-agent/pull/2906)

- **Bufix: Instrumentation errors when using the ruby-kafka gem**

Kafka::Consumer#each_message takes keyword arguments, while the prepended method is defined with a single splat positional argument. In Ruby >= 3.0, this signature mismatch raises an ArgumentError. [PR#2915](https://github.com/newrelic/newrelic-ruby-agent/pull/2915)

## v9.14.0

Version 9.14.0 adds Apache Kafka instrumentation for the rdkafka and ruby-kafka gems, introduces a configuration-based, automatic way to add custom instrumentation method tracers, correctly captures MIME type for ActionDispatch 7.0+ requests, properly handles Boolean coercion for `newrelic.yml` configuration, fixes a JRuby bug in the configuration manager, fixes a bug related to `Bundler.rubygems.installed_specs`, and fixes a bug to make the agent compatible with ViewComponent v3.15.0+.
Expand Down
18 changes: 14 additions & 4 deletions lib/new_relic/agent/instrumentation/ruby_kafka/prepend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,20 @@ module RubyKafkaConsumer
module Prepend
include NewRelic::Agent::Instrumentation::RubyKafka

def each_message(*args)
super do |message|
each_message_with_new_relic(message) do
yield(message)
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3')
def each_message(**args)
super do |message|
each_message_with_new_relic(message) do
yield(message)
end
end
end
else
def each_message(*args)
super do |message|
each_message_with_new_relic(message) do
yield(message)
end
end
end
end
Expand Down
Loading