You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently when updating newrelic_rpm from version 8.8.0 to 9.2.0 in our Rails 7 project, we encountered errors for all of our custom method traces that were applied to class methods. These were set up in an initializer and had been working for all previous versions.
WARN : Unable to determine source code info for '#<Class:Foo(id: integer, created_at: datetime, updated_at: datetime, name: string)>', method 'drive' - NameError: wrong constant name Foo(id: integer, created_at: datetime, updated_at: datetime, name: string)
Object.const_get(klass_name(object))
^^^^^^^^^^
Expected Behavior
Class methods should support custom method tracing as per the documentation.
Troubleshooting results
After some digging, we determined that what was shown in the logs was the output of the ActiveRecord override of inspect, which was not in the format expected by the klass_name method:
Class methods for classes that don't inherit from ActiveRecord did not generate any errors or warnings; disabling code_level_metrics eliminated the problem. While this was encountered in a Rails app, we believe it will affect any class that overrides inspect.
Thank you for bringing this to our attention @abigail-rolling
We'll take a look at this issue and see if we can reproduce this issue and look into preventing this from occurring in the future.
Description
Recently when updating
newrelic_rpm
from version 8.8.0 to 9.2.0 in our Rails 7 project, we encountered errors for all of our custom method traces that were applied to class methods. These were set up in an initializer and had been working for all previous versions.Expected Behavior
Class methods should support custom method tracing as per the documentation.
Troubleshooting results
After some digging, we determined that what was shown in the logs was the output of the
ActiveRecord
override ofinspect
, which was not in the format expected by theklass_name
method:newrelic-ruby-agent/lib/new_relic/agent/method_tracer_helpers.rb
Lines 68 to 76 in 85fcaa0
This method is only called when
code_level_metrics.enabled
istrue
and the default value was changed in the 8.10.0 release, introducing this bug.Steps to Reproduce
Add custom method tracing to a class method for a class that inherits from ActiveRecord:
Additional context
Class methods for classes that don't inherit from
ActiveRecord
did not generate any errors or warnings; disablingcode_level_metrics
eliminated the problem. While this was encountered in a Rails app, we believe it will affect any class that overridesinspect
.For Maintainers Only or Hero Triaging this bug
Suggested Priority (P1,P2,P3,P4,P5):
Suggested T-Shirt size (S, M, L, XL, Unknown):
The text was updated successfully, but these errors were encountered: