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.

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

      bind the action to a specific agent or tag from the available options in this dropdown list

    • File

      this is the source code file into which you're inserting the action; default is to the source code file from which you're already working

    • Expression

      variables or method results to be displayed in the stack trace of the snapshot; click + to enter additional expressions

    • Condition

      an expression that limits the action; this is the condition of an if statement used to limit the execution of the action

      !!! example myVar % 7 == 0 limits the log so 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 in the agent configuration file. Ignore Quotas defaults to off. Only users assigned the IGNORE-QUOTA role can perform this configuration; the checkbox is disabled for other users.

    • Expiry

      the time after which the action ceases to track code behavior and is automatically disabled; defaults to 1 hour

  6. Click OK to add the log. 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

    The Snapshot view is further detailed here

  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 exising actions

Once you create snapshot or 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 the similar to the following:

Plugin gutter -quarter

  1. Hover over the relevant icon to read summary information from its tooltip.

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

    Edit actions -quarter

View snapshots

Data output is sent to your IDE, the CLI, the web interface, or your integrated logging tools depending on how you've configured piping.

By default, all output is piped to the web interface in the web interface. To view data from the IDE, you must first configure the piping accordingly.

There are three levels of log piping:

  • App - the dynamic logs appear only in the Lightrun web interface, as they do by default.
  • Plugin - that dynamic logs won't appear in the web interface. Instead they appear in the Lightrun Console of your IDE, the CLI, or your integrated logging tools.
  • Both - that dynamic logs wll appear both in the web interface and in any integrations you're using.
To configure piping
  1. Navigate to the Lightrun right-hand sidebar:

    Sidebar -quarter

  2. From the relevant agent, click Sidebar -icon to open the Piping menu:

    Log Piping -ten

  3. Set the Plugin or the Both option to view dynamic logs from the IDE.

Note

In order to pipe the dynamic logs they need to go from the agent to the Management server and to the plugin. This process is batched so dynamic logs appear in batches and with some delay.

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.


Last update: May 5, 2021