From 4d74d5cbe60dd3afeb5fec900c5495ae55eebb55 Mon Sep 17 00:00:00 2001 From: Tanna McClure Date: Wed, 2 Nov 2022 16:35:29 -0700 Subject: [PATCH 1/4] category is a required kwarg for in_transaction --- lib/new_relic/agent/tracer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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( From 72d497ac58f184b1ac19b1a9703a0d8a5e94ed67 Mon Sep 17 00:00:00 2001 From: Tanna McClure Date: Wed, 2 Nov 2022 16:37:47 -0700 Subject: [PATCH 2/4] add changelog entry --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1991a1abb..86140676bd 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 in to Ruby, rather than manually raising `ArgumentError`'s. 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 From d7e741b24849c088b4ff7c2ff3e00cc466629dce Mon Sep 17 00:00:00 2001 From: Tanna McClure Date: Wed, 2 Nov 2022 17:03:00 -0700 Subject: [PATCH 3/4] Update CHANGELOG.md Co-authored-by: Kayla Reopelle (she/her) <87386821+kaylareopelle@users.noreply.github.com> --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86140676bd..56539bf02a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ * **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 in to Ruby, rather than manually raising `ArgumentError`'s. 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) + 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 From 15c375aa1f3291711dcdf3f5dc2c30cf170cc838 Mon Sep 17 00:00:00 2001 From: Tanna McClure Date: Wed, 2 Nov 2022 17:08:47 -0700 Subject: [PATCH 4/4] add test for missing category in NewRelic::Agent::Tracer.in_transaction --- test/new_relic/agent/tracer_test.rb | 8 ++++++++ 1 file changed, 8 insertions(+) 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")