getappmap / appmap-agent-js

This project is deprecated. Please use https://github.com/getappmap/appmap-node/ to record Node.js applications.
Other
27 stars 8 forks source link

JS agent should accurately report loops #212

Closed ahtrotta closed 1 year ago

ahtrotta commented 1 year ago

Currently, the JS agent does not accurately report loops sometimes.

Example from this test:

Image

Another example from this test.

Image

lachrist commented 1 year ago

@ahtrotta What should have been displayed? Loop 3 times because there is 3 calls to verbose?

Is this happening wherever there is an async jump?

ahtrotta commented 1 year ago

In both of the examples above, there was not a loop in the source code but the appmap reported that there was a loop. Is there any way to differentiate between sequential calls to a function and a loop? How do our other agents handle this situation?

kgilpin commented 1 year ago

There’s really no way. Anyway how is sequential calls to the same function actually different than a loop? :-)

On Fri, Apr 28, 2023 at 11:07 AM Adam Trotta @.***> wrote:

In both of the examples above, there was not a loop in the source code but the appmap reported that there was a loop. Is there any way to differentiate between sequential calls to a function and a loop? How do our other agents handle this situation?

— Reply to this email directly, view it on GitHub https://github.com/getappmap/appmap-agent-js/issues/212#issuecomment-1527710647, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAVC62JL33CU3NBCS2LOJ3XDPMMPANCNFSM6AAAAAAWR2PDZQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

ahtrotta commented 1 year ago

Yeah, that makes sense that there's no way. It's just semantically different in the source file.

lachrist commented 1 year ago

Yeah the agent records function applications without context. It has no idea whether it is called inside a loop or not.

ahtrotta commented 1 year ago

Okay, we can close this issue then.