diff --git a/CHANGELOG.md b/CHANGELOG.md index d1991a1abb..56539bf02a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ Unicorn, Rainbows, or FastCGI web applications using Rack v3.0.0 may previously have had the "dispatcher" value incorrectly reported as "Webrick" instead of "Unicorn", "Rainbows", or "FastCGI". This issue has now been addressed. [PR#1585](https://github.com/newrelic/newrelic-ruby-agent/pull/1585) + * **Bugfix: Category is a required keyword arg for NewRelic::Agent::Tracer.in_transaction** + + When support for Ruby 2.0 was dropped in version 8.0.0 of the agent, the agent API methods were updated to use the required keyword argument feature built into Ruby, rather than manually raising ArgumentErrors. The API method `NewRelic::Agent::Tracer.in_transaction` removed the ArgumentError raised by the agent, but did not update the method arguments to identify category as a required keyword argument. This is now resolved. Thank you to @tatzsuzuki for bringing this to our attention. [PR#](https://github.com/newrelic/newrelic-ruby-agent/pull/1587) + ## v8.12.0 diff --git a/lib/new_relic/agent/tracer.rb b/lib/new_relic/agent/tracer.rb index f93846a416..06ecf42748 100644 --- a/lib/new_relic/agent/tracer.rb +++ b/lib/new_relic/agent/tracer.rb @@ -87,7 +87,7 @@ def transaction_sampled? # @api public def in_transaction(name: nil, partial_name: nil, - category: nil, + category:, options: {}) finishable = start_transaction_or_segment( diff --git a/test/new_relic/agent/tracer_test.rb b/test/new_relic/agent/tracer_test.rb index 4ef06580bc..23dd78f07f 100644 --- a/test/new_relic/agent/tracer_test.rb +++ b/test/new_relic/agent/tracer_test.rb @@ -101,6 +101,14 @@ def test_in_transaction assert_metrics_recorded(['test']) end + def test_in_transaction_missing_category + assert_raises ArgumentError do + NewRelic::Agent::Tracer.in_transaction(name: 'test') do + # No-op + end + end + end + def test_in_transaction_with_early_failure yielded = false NewRelic::Agent::Transaction.any_instance.stubs(:start).raises("Boom")