The Datadog extension packs several features including:
Code Insights to keep you informed about
Synthetic Tests to provide quality assurance during development by allowing you to run existing Synthetic Tests against local servers.
Logs Navigation to allow you to search for logs from your code.
Static Analysis to detect and fix problems even before you commit changes.
Exception Replay to help you debug your production code.
Recent Commits to alert if one of your pushed commits has caused a CI problem and to help keep track of commits that affect your work.
File Insights to view the information that Datadog has for the file open on the active editor.
View in VS Code to directly go from file references on the Datadog platform to your source files.
Code Delta to more accurately map observability data to your files in VS Code.
myorg.datadoghq.com
, you must indicate it using the datadog.connection.oauth.setup.domain
setting.git.enabled
setting.The Code Insights tree displays insights generated by the Datadog platform that are relevant to your code-base. The Code Insights can be grouped by kind, file, priority, and service.
Code Insights include a detailed description for each issue, and links to:
You can dismiss individual Code Insights and set filters to view the ones you are most interested in.
The Datadog extension enables you to run Synthetic HTTP tests and browser tests on local environments directly in VS Code. You can identify and address potential issues resulting from code changes before they are deployed into production and impact your end users.
We support HTTP API tests and Browser tests.
localhost
URL on the Settings page.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.
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.
You can navigate to the Log Explorer on the Datadog platform directly from your source code files.
If you're using a supported logging library and VS Code is properly configured for the language, the extension is able to show you code lenses on the lines where it has detected log patterns that match the Datadog platform records:
The supported logging libraries are:
Alternatively, you can select some text in your source code, right click, and select Datadog > Search Logs With Selected Text option.
The Static Analysis integration analyzes your code (locally) against predefined rules to detect and fix problems.
The Datadog extension runs Static Analysis rules on your source files as you edit them. 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, and suggested fixes can be applied directly.
When you start editing a source file, the extension checks for static-analysis.datadog.yml at your source repository's root. It prompts you to create it if necessary.
Once the configuration file is created, the static analyzer runs automatically in the background whenever a file is opened. If you need to enable static analysis for a particular language you can use the following command from the Datadog Menu:
You can also run a batch analysis for individual folders and even the entire workspace:
The Static Analysis feature does not require a Datadog account, as source files are analyzed locally.
Exception Replay allows you to inspect the stack trace frames of any Error Tracking code insight and get information about the values of the variables of the code running in production.
In order to get access to this feature, you have to enable Error Tracking Exception Replay on Datadog.
After the feature has been enabled, you can see an Exception Replay
button next to the stack trace section of any instrumented Error Tracking code insight. Click the button to:
Select an Error Tracking code insight from the Code Insights view. Go to the stack trace and click the Exception Replay button. VS Code shows a new activity with two new views:
Select a stack trace frame and inspect the values of all the variables that Datadog captured from your production code.
The Recent Commits feature enhances your development workflow by leveraging information from Datadog's Software Delivery suite: CI Visibility, Test Visibility, and Code Analysis.
The Commit Alert monitors your recent commits and displays a notification on the status bar whenever a commit has triggered a CI issue, such as a test failure, a CI pipeline fail, or a new flaky test occurrence (see the setting datadog.recentCommits.alert.check.notPassedTest
as an example).
The Recent Commits view displays your recent commits pushed to any of the repositories currently open in VS Code. Use the "Set Additional Authors" and "Set Additional Repositories" buttons in the view's toolbar to include commits from other authors and repositories.
The Recent Commits feature aims to keep you informed and boost your productivity by highlighting commits that need your attention. It distinguishes your commits using the email configured in Git (git config user.email
) and any "email aliases" you set up with the datadog.recentCommits.setup.userAliases
setting. You can configure these aliases directly on your settings or by clicking the "Set User Aliases" button in the Recent Commits view toolbar.
The File Insights view provides comprehensive information from Datadog about the file currently open in the active editor. Use this view to explore, search, and organize insights, and to quickly navigate to the specific locations in your code where these insights apply.
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):
To use this feature, first configure source code integration for your service.
Code Delta matches the line numbers included in Datadog telemetry to the line numbers of the files you are currently working on in VS Code.
For example, all View in VS Code links on the Datadog platform encode runtime version info, and the extension uses that to compute the corresponding line of code in your editor, taking into account version changes.
You can tweak the Code Delta settings to change how the matching algorithm works. In particular, you can modify the Minimum Affinity
value, which determines the degree of confidence required to match lines.
Please read this End-User License Agreement carefully before downloading or using the Datadog Visual Studio Code Extension.
Datadog anonymously collects information about your usage of this IDE, including how you interact with it, whether errors occurred while using it, and what caused those errors, in accordance with the Datadog Privacy Policy and Datadog's VS Code extension EULA.
If you don't wish to send this data to Datadog, you can opt out at any time in the VS Code extension settings: Datadog > Telemetry > Setup > Enable Telemetry
and select disabled
.
The Datadog extension also honors the VS Code telemetry telemetry setting.
To share your feedback, email team-ide-integration@datadoghq.com or create an issue in the extension's public repository.
Check out the issues section to discover known issues.