Datadog Extension for Visual Studio Code
Overview
The Datadog extension for Visual Studio Code (VS Code) integrates with Datadog to accelerate your development.
The Code Insights view keeps you informed about:
The Synthetic Tests feature allows you to:
- Run Synthetic tests on your local environments
- Set custom parameters without altering the original test definition
- See test results locally in VS Code and in Datadog to access additional information
- Test only what matters by executing relevant tests at the same time
- Create a list of most frequently used Synthetic tests by linking them to your workspace
The View in VS Code feature provides a link from Datadog directly to your source files.
The Static Analysis integration analyzes your code (locally) against predefined rules to detect and fix problems before you commit changes.
Requirements
- A Datadog account: The extension requires a Datadog account (except when using Static Analysis features). If you’re new to Datadog, go to the Datadog website to learn more about Datadog’s observability tools and sign up for a free trial.
Setup
Install the Datadog Extension from the Visual Studio Marketplace.
Code Insights
The Code Insights tree displays insights generated by the Datadog platform that are relevant to your code-base. The insights are grouped into three categories: performance, reliability, and security.
Code Insights include a detailed description for each issue, and links to:
- The related source code location
- The Datadog platform for additional information
You can dismiss individual insights and set filters to view the categories of insights that you are most interested to see.
Synthetic Tests
The Datadog extension enables you to run Synthetic HTTP tests and browser tests on local environments directly in the IDE. You can identify and address potential issues resulting from code changes before they are deployed into production and impact your end users.
Run Synthetic tests locally
- Select a Synthetic test to execute. You can search for specific tests by clicking the Search icon.
- Change the test’s configuration to convert the start URL and specify a
localhost
URL on the Settings page. - Run the test.
If you haven’t set up Synthetic tests already, create a test in Datadog. For more information about running tests on a local environment, see Getting Started with API Tests, Getting Started with Browser Tests, and the Continuous Testing Tunnel documentation.
Permissions
By default, only users with the Datadog Admin and Datadog Standard roles can create, edit, and delete Synthetic HTTP and browser tests. To get create, edit, and delete access to Synthetic HTTP and browser tests, upgrade your user to one of those two default roles.
If you are using the custom role feature, add your user to any custom role that includes synthetics_read
and synthetics_write
permissions.
View in VS Code
The View in VS Code feature provides a link from Datadog directly to your source files. Look for the button next to frames in stack traces displayed in the UI (for example, in Error Tracking):
Static Analysis
The Datadog extension runs Static Analysis rules on the source files you have open in your Workspace. The goal is to detect and fix problems such as maintainability issues, bugs, or security vulnerabilities in your code before you commit your changes.
Static Analysis supports scanning for many programming languages. For a complete list, see Static Analysis Rules. For file types belonging to supported languages, issues are shown in the source code editor with the VS Code inspection system, and suggested fixes can be applied directly:
Additionally, all issues detected by this feature are listed in the standard Problems view.
Getting started
When you start editing a source file supported by Static Analysis, the extension checks for static-analysis.datadog.yml
at your source repository’s root. It prompts you to create the file if necessary:
Once the configuration file is created, the static analyzer runs automatically in the background.
The Static Analysis feature does not require a Datadog account, as source files are analyzed locally.
Feedback
To share your feedback, email team-ide-integration@datadoghq.com.
Further Reading
Additional helpful documentation, links, and articles: