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.

From your JetBrains IDE, you can:

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 -half

    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 if statement, used to limit the execution of the action. For 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.
    Max Hit Count the maximum number of times the snapshot should be taken during the lifetime of the action; default == 1.
  4. 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.
  5. Click OK to add the snapshot.

    A snapshot marker Snapshot icon -icon 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.

Snapshot icon -ten

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

Snapshot -half

Click on a snapshot to populate the Captured Hits, Frames, and Variables section with its data.

Snapshot -half

See JetBrains plugin quick tour to learn more about the Lightrun Snapshot tool window.

To edit and delete a snapshot
  1. Right-click on the snapshot marker Snapshot icon -icon on the snapshot code line.
  2. Click Delete to delete the snapshot.
  3. Click Edit to edit the snapshot configuration.

Last update: June 19, 2022