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.
Links mentioned
Rails Sample Application
Early Access to AppMap Analysis
Detailed Remote Recording instructions for Rails
Detailed Remote Recording instructions for Java
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’ll have AppMap installed, and have already generated AppMaps for your test cases.
NOTE: If you’re using JetBrains IntelliJ IDEA with Java, follow these instructions to create AppMaps using remote recording.
We’re going to open the AppMap for Visual Studio Code extension and install the AppMap agent. Our installer will confirm that the project meets all the requirements necessary to create maps.
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, follow the on-screen instructions for recording AppMaps. You’ll receive one of the two following options.
First, you may be instructed to run your application as you normally would. In this scenario, AppMap will automatically be enabled and each web request will generate a new AppMap.
If you see this screen, follow along with streaming AppMaps.
Otherwise, you’ll be given a command to copy and paste into the terminal which will guide you through running your application with AppMap enabled.
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 run:
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: Streaming AppMaps with Request Recording