In this video
We generate AppMaps with a remote recording of our application. You can remote record your application if your app doesn’t have complete test cases, or when you want to dive into a specific user interaction such as an API call or specific product functionality in your app.
In this tutorial we are going to generate AppMaps with a remote recording of our application. You can remote record your application if your app doesn’t have complete test cases, or when you want to dive into a specific user interaction such as an API call or specific product functionality in your app.
We are going to be using a sample ruby on rails application, which is a basic Twitter clone. If you have followed the previous tutorials, you’lll have AppMap installed, and have already generated AppMaps for your test cases.
We’re going to open the AppMap VS Code extension and install the AppMap agent. Our installer will confirm that the project meets all the requirements necessary to create maps. Because we are going to remote record the application, it’s OK if the AppMap installer doesn’t locate a test framework, since our AppMaps will come from the recording.
We’ll run the AppMap installer, select
bundler, since this is a Ruby on Rails project.
You’ll see that the only changes thus far to our repository are the addition of an AppMap configuration file and the AppMap gem being added as a development dependency.
Next, we’ll run a simplified version of the record command, since we’ll be remote recording, and not recording via test cases.
npx @appland/appmap record
Before I run that command, I’m going to want to start my application locally and make sure I can connect to it. I’m going to open another terminal window, and because this is a Ruby on Rails project, I’ll pass the
set APPMAP=true on Windows) environment variable to start the AppMap agent.
APPMAP=true bundle exec rails server
If you are remote recording a Java application or other language, please refer to the AppMap documentation for the relevant tutorials for those languages. With my app now running you can see that I can login to my app, navigate around, post a tweet, see users.
We’ll now return to our console and run the
record command. If I omit passing any options, I’ll be prompted to choose how to record the app. I’ll choose remote recording. AppMap will try to locate your running application locally, if your app is running in a container or elsewhere you may get an error. Simply follow the instructions to walk through the available configuration options to connect to your service.
Now that the agent is connected, we can hit enter to begin recording. Now, I can interact with my application, kick off a specific functional or integration test, or make any specific API calls to your application. I’m going to login and reset my password. It’s important to keep remote recordings focused on a specific function, and not include too many interactions in one single recording as AppMaps can grow large as recordings progress.
When I am done interacting, I return back to the terminal and hit enter again to stop the recording. We’ll give this recording a name and then this AppMap will be opened within VS Code.
We’ll also receive a runtime analysis scan of this code path as well, which has identified a performance issue with an N+1 SQL query generating the main list of tweets. For early access to our AppMap runtime analysis reach out to us.
Finally, you’ll see AppMaps actually exist inside your temp directory in the AppMap folder. We don’t recommend committing these to your project. They can grow your git repositories unnecessarily. But you can commit changes to your Gemfile and the appmap configuration file which will make the project available to other developers.
Next step: Navigating AppMaps