Skip to content

Commit

Permalink
Merge pull request #2158 from newrelic/roda_instrumentation
Browse files Browse the repository at this point in the history
Roda instrumentation: Ruby 3.1.4 fix
  • Loading branch information
hannahramadan authored Aug 11, 2023
2 parents b6acbfd + 1bfaa37 commit b719d12
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/multiverse/suites/roda/roda_instrumentation_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def test_transaction_name_error
result = NewRelic::Agent::Instrumentation::Roda::TransactionNamer.transaction_name({})

assert_equal NewRelic::Agent::UNKNOWN_METRIC, result
assert_logged(/NoMethodError.*Error encountered trying to identify Roda transaction name/)
assert_logged(/NoMethodError.*Error encountered trying to identify Roda transaction name/m)
end
end

Expand All @@ -128,7 +128,10 @@ def test_rack_request_params_error
end

def assert_logged(expected)
found = NewRelic::Agent.logger.messages.flatten.any? { |m| m.match?(expected) }
# Example logger array:
# [[:debug, ["NoMethodError : undefined method `path' for \
# {}:Hash - Error encountered trying to identify Roda transaction name"], nil]]
found = NewRelic::Agent.logger.messages.any? { |m| m[1][0].match?(expected) }

assert(found, "Didn't see log message: '#{expected}'")
end
Expand Down

0 comments on commit b719d12

Please sign in to comment.