Skip to content

Snapshots

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.

Prerequisites

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
  1. Go to the line of your source code at which you'd like to insert the snapshot.

  2. Right-click to open the context menu:

    Context Menu -half

  3. Select Snapshot:

    The Create Snapshot dialog opens:

    Adding a Snapshot

  4. Complete the fields in the dialog as follows:

    • Agent

      From the available options in the dropdown list, bind the action to a specific agent or tag.

    • File

      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.

    • Expression

      Variables or method results to be displayed in the snapshot stack trace. Click + to enter additional expressions.

    • Condition

      The condition of an if statement, used to limit the execution of the action.

      Example

      The condition myVar % 7 == 0 limits the action (log, snapshot, metric) output so that it only prints for variables that are divisible by 7.

  5. 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.

    • Ignore quotas

      The quota (rate limit) is configured by the agent configurations. Only users with IGNORE_QUOTA role can override the agent's quota limitation, the checkbox in the Lightrun plugin is disabled for other users.

    • Expiry

      The time after which the action ceases to track code behavior and is automatically disabled; default = 1 hour.

  6. 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:

    Snapshot Result

    An icon is added to the margins of the code on the line where it was added:

    Snapshot Inserted

  7. Right-click Snapshot icon -icon 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.

Operation Icons
  1. Hover over the relevant icon to view summary information from its tooltip.

  2. Click the log icon or right-click any icon in the gutter to edit, delete, and view details.

    Editing an Action

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.

Stacktrace in plugin -three

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


Last update: September 20, 2022