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.
Once you've added the snapshot, view the output directly from the IDE.
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:
Complete the fields in the dialog as follows:
From the available options in the dropdown list, bind the action to a specific agent or tag.
The source code file into which you're inserting the action. The default path is to the source code file from which you're currently working.
Variables or method results to be displayed in the snapshot stack trace. Click + to enter additional expressions.
The condition of an
ifstatement, used to limit the execution of the action.
myVar % 7 == 0limits the action (log, snapshot, metric) output so that it only prints for variables that are divisible by 7.
Click Advanced to configure the following additional fields:
Max Hit Count
the maximum number of times the snapshot should be taken during the lifetime of the action; default == 1.
The quota (rate limit) is configured by the agent configurations. Only users with
IGNORE_QUOTArole can override the agent's quota limitation, the checkbox in the Lightrun plugin is disabled for other users.
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 marker is also added to the area above the line:
The snapshot is added and displayed in the bottom sidebar:
An icon is added to the margins of the code on the line where it was added:
Right-click from the gutter marker to delete or edit the configuration.
Update, edit, and delete actions¶
Once you've added an action, you can manipulate it by:
- Viewing its details
- Editing its configuration
- Removing it
To work with existing actions¶
Once you create a snapshot or a metric, the relevant icon appears in the gutter of your code. When you enter a log, it is represented in line with your code. Icons for all of these options appear similar to those in the figure below.
Hover over the relevant icon to view summary information from its tooltip.
Click the log icon or right-click any icon in the gutter to edit, delete, and view details.
Snapshot data - view the stacktrace¶
Every time you add a snapshot to the code, it appears in the bottom sidebar of IntelliJ in the Lightrun Snapshots tab. The layout of the data that prints out is similar to the debugger interface, designed to be familiar to you.
Find these details in the Lightrun Snapshots view:
The name that was assigned to the snapshot when it was added appears at the top of the sidebar. The left column lists all of the stack trace frames from the relevant snapshot. Click the row of a specific frame to view the variables related to the exception that was thrown.
Viewing snapshot data in the Management Portal is further detailed here