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

Allow set_transaction_name to change name and category of current transaction. #1797

Merged
merged 3 commits into from
Feb 6, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## v9.0.0

Version 9.0.0 of the agent enables thread tracing, removes several deprecated configuration options, and removes support for Ruby versions 2.2 and 2.3.
Version 9.0.0 of the agent enables thread tracing, removes several deprecated configuration options, removes support for Ruby versions 2.2 and 2.3, and changes how the API method `set_transaction_name` works..


- **Remove Deprecated Configuration Options**
Expand Down Expand Up @@ -70,6 +70,12 @@
- Rainbows
- Sunspot


- **Changes how the API method `set_transaction_name` works**

When the method `NewRelic::Agent.set_transaction_name` is called, it will now always change the name and category of the currently running transaction to what is passed in to the method. This is a change from how it functioned in previous agent versions. Previously, if set_transaction_name was called with a new transaction name and a new category that did not match the category that was already assignd to a transaction, neither the new name nor category would be saved to the transaction.
tannalynn marked this conversation as resolved.
Show resolved Hide resolved


- **Dropped method: `NewRelic::Agent.disable_transaction_tracing`**

The previously deprecated `NewRelic::Agent.disable_transaction_tracing` method has been removed. Users are encouraged to use `NewRelic::Agent.disable_all_tracing` or `NewRelic::Agent.ignore_transaction`.
Expand Down
6 changes: 2 additions & 4 deletions lib/new_relic/agent/transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,8 @@ def set_default_transaction_name(name, category)
def set_overriding_transaction_name(name, category)
return log_frozen_name(name) if name_frozen?

if influences_transaction_name?(category)
self.overridden_name = name
@category = category if category
end
self.overridden_name = name
@category = category if category
end

def log_frozen_name(name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ def ignored_txn
def test_metric_names_when_child_has_different_category
TestTransactor.new.parent_txn(:task)

# background task does not record apdex
assert_metrics_recorded([
'Controller/TestTransactor/parent',
'OtherTransaction/Background/TestTransactor/child',
'Nested/Controller/SetTransactionNameTest::TestTransactor/child_txn',
['Nested/Controller/SetTransactionNameTest::TestTransactor/child_txn', 'Controller/TestTransactor/parent'],
'Apdex/TestTransactor/parent'
['Nested/Controller/SetTransactionNameTest::TestTransactor/child_txn', 'OtherTransaction/Background/TestTransactor/child'], # check child method segment metric still exists
['Nested/Controller/SetTransactionNameTest::TestTransactor/parent_txn', 'OtherTransaction/Background/TestTransactor/child'] # check parent segment metric still exists
])
end

Expand Down