A snapshot is a one-time "breakpoint" that doesn't block your code from running. As opposed to a traditional breakpoint, snapshots collect the stack trace and variables without interrupting the application at all.
From your JetBrains IDE, you can:
To use the plugin, make sure you have:
- Installed the plugin in your local IntelliJ instance
- Authenticated IntelliJ with your Lightrun account
- Attached at least one agent to your app
- Opened the source code file for the running application from the IDE
To add a snapshot¶
Go to the line of your source code at which you'd like to insert the snapshot.
Right-click to open the context menu:
The Create Snapshot dialog opens:
The following table describes the present fields.
Field Description Target Bind the snapshot to a specific tag or agent from the available options in the dropdown list. File The source code file and line of code into which you're inserting the snapshot. The default path is to the source code file from which you're currently working. Expression Variables or method results to be displayed in the snapshot stack trace. Click + to enter additional expressions. Condition The condition of an
ifstatement, used to limit the execution of the action. For example, The condition
myVar % 7 == 0limits the action (log, snapshot, metric) output so that it only prints for variables that are divisible by 7.
Max Hit Count the maximum number of times the snapshot should be taken during the lifetime of the action; default == 1.
Click Advanced to configure the following additional fields:
Field Description Ignore quotas The maximum number of times the snapshot should be taken during the lifetime of the action; default == 1. Expiry The time after which the action ceases to track code behavior and is automatically disabled; default = 1 hour.
Click OK to add the snapshot.
A snapshot marker should appear next to the selected code line in your Jetbrains code editor.
Once a snapshot hit has been captured, you will be notified directly in your IDE.
To view snapshot data¶
Once a snapshot hit has been captured, you can view the snapshot data directly in your IDE or in the Lightrun management portal in your browser. Click here for more information on how to view your snapshot data in the Lightrun management portal.
To view snapshot data in your IDE, click on the snapshot marker to open the Lightrun Snapshot window or click on Lightrun Snapshots in the bottom part of your IDE.
The Lightrun Snapshot tool window should appear similar to the following image.
Click on a snapshot to populate the Captured Hits, Frames, and Variables section with its data.
See JetBrains plugin quick tour to learn more about the Lightrun Snapshot tool window.
To edit and delete a snapshot¶
- Right-click on the snapshot marker on the snapshot code line.
- Click Delete to delete the snapshot.
- Click Edit to edit the snapshot configuration.