While implementing the shallow mode for appmap-node agent I noticed this and it's been checked by @dividedmind:
I just checked and for example
require 'active_support/core_ext'
class Calc
def calc x
y = x.minutes.ago
z = 1.year.ago
y.to_i - z.to_i
end
end
indeed only records #minutes, ignoring #year and both invocations of #ago.
It seems that the problem is with this line return false if hook_package&.shallow? && AppMap.tracing.last_package_for_current_thread == hook_package that checks the last recorded package. Because no other package is recorded between the calls mentioned, the last package stays the same. This causes subsequent calls to be skipped from recording, even if they are also "shallow" calls. A stack based approach can be used to fix this.
While implementing the shallow mode for appmap-node agent I noticed this and it's been checked by @dividedmind:
It seems that the problem is with this line
return false if hook_package&.shallow? && AppMap.tracing.last_package_for_current_thread == hook_package
that checks the last recorded package. Because no other package is recorded between the calls mentioned, the last package stays the same. This causes subsequent calls to be skipped from recording, even if they are also "shallow" calls. A stack based approach can be used to fix this.