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

Only the first shallow call of a sequence of calls is recorded on shallow mode #355

Open
zermelo-wisen opened this issue Mar 30, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@zermelo-wisen
Copy link

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.

@kgilpin kgilpin added the bug Something isn't working label Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants