Quick tour of the VSCode Lightrun plugin¶
The majority of the work you do with Lightrun, such as troubleshooting, debugging, and performance testing, is performed directly from your integrated development environment (IDE) or the Lightrun CLI.
Using the Lightrun plugin, provided for a variety of popular IDEs (such as VSCode, IntelliJ, and PyCharm), you can insert Lightrun actions (Logs, Metrics, and Snapshots) anywhere within the source code of your running applications. Also, from within the Lightrun plugin for your IDE, you can view, in real time, the output of Lightrun actions.
And, thanks to Lightrun's comprehensive range of integrations with third-party logging tools, from the plugin, you also can route output from Lightrun Logs and Metrics to your usual logging framework (such as Logz.io and DataDog).
Scope of the quick tour¶
This quick tour article provides an overview of the main features and functionalities of the Lightrun Plugin for Visual Studio Code (VSCode). For detailed information on procedures for running Lightrun actions and managing configurations within VSCode, see:
To follow this quick tour on your workstation, if not previously done:
- Authenticate it
- Attach at least one agent to your application
- Open the source code folder for your running the application in the IDE
The Lightrun sidebar layout¶
Upon clicking, in the VSCode activity bar, the Lightrun plugin icon , the Lightrun sidebar opens. Follow the on-screen instructions to authenticate.
If no agents are available in your organization, follow the on-screen instructions.
Once your application is running with the Lightrun agent attached, the VSCode plugin user interface appears similar to the annotated figure shown below.
Selecting any of the three view tabs exposes additional menus and options, respectively for managing Agents, Tags, and Snapshots.
The Agents view tab¶
The Agents tab lists the live Lightrun agents and the respective tags associated with each agent. Under each agent there is a list of actions that are assigned for it.
In the example below, there is a Log and Snapshot actions running under the agent with "Prime App" name.
When clicked, the expand icon reveals a list of actions for the agent.
Clicking the Agent Options menu icon displays the AGENT OPTIONS and LOG ROUTING menus.
The LOG ROUTING menu lets you select where your Logs are routed to. There are three options:
- The application's standard output (Stdout)
- The Lightrun plugin console, which also include Lightrun portal and configured integrations.
- Both of the above
When the Plugin option is selected while the application is running with the Lightrun agent, output for Logs, Snapshots, and Metrics, is displayed in the VS Code Console panel, inside the LIGHTRUN tab. Output also can be viewed in the Lightrun Management Portal.
The Tags view tab¶
The Tags tab list available tags with associated agents and actions.
Use the tags tab to see what actions are associated with each tag and add new actions to a multiple agents at once or to agents that are running serverless.
When clicked, the expand icon reveals two categories Actions and Agents for the associated actions and agents respectively. Click the expand icon again to drill into those.
The Snapshots view tab¶
The Snapshots tab list all available snapshots data that was captured.
Learn more about Snapshots in VSCode.
Dynamic search filter¶
From the dynamic search field, you can search for Logs, Snapshots, and Metrics attached to specific agents. As you begin typing, the list of relevant agents updates dynamically.
Dynamic search is particularly useful for finding specific dynamic Logs, when working with multiple agents.
To view Agent details, in the Agents tab, under AGENT OPTIONS, select the Details option.
The Agent details table appears, similar to the following:
The following table summarizes the information displayed in the Agent details window.
|Name||The agent's display name or host name if not specified|
|Host||The name of the machine where the agent is running|
|Environment||The runtime environment of the application with which the agent is running|
|ID||A unique identifier, automatically generated for the agent|
|PID||The process ID (on the machine where the agent is running)|
|Start Time||The time at which the agent started running|
|API Version||The version number of the server the agent is connected to|
|Agent Version||The version number of the agent|
|Log Routing||The configured routing method|
|Tags||Next to Agent details, the names of tags that have been applied to the agent. If there are more than one tag, additional tags are displayed by clicking the icon.|
From the VSCode IDE, you can:
- configure output routing for Logs and Metrics to view Logs and Metrics output directly from the IDE console, the Lightrun plugin, or the Lightrun Management Portal.
- view the stack trace, based on the Snapshots you have added.
The data available in these views include all of the Lightrun instrumentation added by you and others in your team.
To view Lightrun Logs and Metrics data from VSCode, you must configure the routing accordingly.
There are three levels of routing for output from Lightrun dynamic logs and metrics:
- Stdout - Output appears only in the application's standard output.
- Plugin - Output appears in the Lightrun Management Portal, Lightrun Console, and integrations.
- Both - Output appears in the Lightrun Management Portal, Lightrun Console, integrations, and standard output.
To configure routing:
- From the Lightrun sidebar, choose either of the following methods.
- Under the Agents tab, for the relevant agent, click the icon.
The AGENT OPTIONS menu opens.
Choose either of the following two methods:
From the Agent Options menu, under LOG ROUTING, select an options from Stdout, Plugin, or Both.
1. From the Agent Options menu, under AGENT OPTIONS, select Details.
The Agent Details window opens, with the LOG ROUTING options menu.
2. From LOG ROUTING, select an option from Both, App only, or Plugin only.
Dynamic Logs and Metrics are sent from the agent to the plugin via the Lightrun server. As this process is batched, output may appear with a slight delay.
Deleting Lightrun actions¶
Lightrun actions can be deleted using the UI or the Lightrun Command Palette.
To delete a Lightrun action from the UI:
- Under the Agents or Tags view, next to the relevant action identifier, click the More options icon. The ACTION OPTIONS menu opens.
- Select Delete.
To delete a Lightrun action from the Lightrun Command Palette:
- Place your cursor at the code line where the Lightrun action is inserted.
- Right-click to open the VSCode context menu and select Lightrun....
The Lightrun plugin Command Palette opens.
- Select Delete Current Line Action
Clicking the More Options icon at the top of the plugin, opens the PLUGIN OPTIONS menu.
From here you can:
- Open, within VSCode, the Lightrun plugin extension settings window.
- Open the Lightrun documentation web page
- Open the Lightrun user feedback web page
- Refresh the user interface
- Navigate to Lightrun management portal
- Sign out from the current user