Support frontend recording
@lachrist is already working on this.
Since Apr 18, 2023.
- Dominant language
- No language data
- Stars
- 81
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Description
Problem
This specification needs to be adapted to enable the js agent to record browser applications. That is because sources can no longer be assumed to be static files. Indeed, on browser, code comes from http responses and not static files. For instance, when the man-in-the-middle proxy intercepts the http response of GET http://localhost:8080/script.js, it has no idea to which static file this source should be linked. This static file might not even exist if the source has been dynamically generated.
Solution
Currently, the agent is breaking the spec in two places:
- The root packages of classmaps can be url origins. For instance, when the source is associated to
http://localhost:8080/directory/script.jsthe root package will behttp://localhost:8080. - The location of functions can be urls -- eg:
http://localhost:8080/directory/script.js. Note that the visualizer should not attempt to fetch these. This code can only be retrieved if it was inlined in the appmap.
classMap:
- type: package
name: "http://localhost:8080"
children:
- type: package
name: directory
children:
- type: class
name: script
children:
- type: function
location: "http://localhost:8080/directory/script.js"
File URLs
It may be worthwhile to support file urls. That way, function locations could consistently be provided as (absolute) urls. File urls would represent static sources that can be fetched while other urls would represent dynamic sources that cannot be fetched. That would simplify the js agent and probably the visualizer as well as it helps avoiding shenanigans related to windows path.
Relative URLs
Absolute urls are not great to visualize. In some projects it makes express absolute urls relatively to a reference absolute url. There is two ways we can go about this:
- The appmap contains only absolute urls. The reference url could be provided in
appmap.ymlor using a heuristic such as: if more then half of the urls start withhttp://localhost:8080:/publicthen use it as reference url. In any case, it becomes the job of the visualizer to decide how these absolute urls should be displayed and this specification remains not impacted by this consideration. - The appmap may contains relative urls. We should then provide the reference url inside the appmap itself. Maybe something like:
metadata.home = "http://localhost:8080/public". If this field is missing we can assume that it is the directory containing theappmap.ymlfile.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.