Datadog Extension for VS Code & Cursor

이 페이지는 아직 영어로 제공되지 않습니다. 번역 작업 중입니다.
현재 번역 프로젝트에 대한 질문이나 피드백이 있으신 경우 언제든지 연락주시기 바랍니다.

The Datadog extension for Visual Studio Code is not supported for your selected Datadog site ().

Overview

The Datadog extension for Visual Studio Code (VS Code) integrates with Datadog to accelerate your development. It is also available for Cursor and other forks of VS Code. To install in your preferred integrated development environment (IDE):

The Datadog for VS Code extension

The extension includes these features:

Unless stated otherwise, all extension features are available for both VS Code and any other IDEs based on VS Code forks, such as Cursor.

Requirements

  • Datadog account: Most features require a Datadog account.

    • New to Datadog? Learn more about Datadog’s monitoring and security tools and sign up for a free trial.
    • If your organization uses a custom sub-domain such as myorg.datadoghq.com, you must indicate it using the datadog.connection.oauth.setup.domain setting.
  • Git: The extension works better when Git is enabled in the IDE. Ensure this is enabled by checking the git.enabled setting.

Log annotations

Use Log Annotations to gauge the volume of logs generated by a given log line in your code. The extension adds annotations above your code to detected logging patterns that match log records in Datadog. Click an annotation to open the Log Explorer in Datadog and view the matching logs.

You can also search Datadog logs from within VS Code. Select any text in the code editor, then right-click and select Datadog > Search Logs With Selected Text.

Using the Datadog Log explorer feature

Code insights

Code insights keep you informed with Datadog-generated insights that are relevant to your code base:

The extension identifies errors and vulnerabilities in the code with colored squiggles; hover over the line for more details.

The Code Insights view in the Datadog sidebar lists all the issues found in the repository. Select an item to view the full insight, and use the links to jump to the related source code location or open the code insight in Datadog.

You can group code insights by kind, file, priority, or service. You can also ignore individual code insights and set filters to view the ones you’re most interested in.

The Code Insights view.

For specific insights about the file currently open in the active editor, check the File Insights view in the IDE’s file explorer. This view also lists issues discovered by Static Code Analysis within the file.

View in IDE

This feature is only available for VS Code and Cursor. Other forks of VS Code are not supported.

The View in VS Code or View in Cursor 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):

A stack trace in Datadog showing the View in VS Code button

You can also use this feature to open your source files from an insight (such as an error from Error Tracking):

An Error Tracking issue in the Datadog showing the View in VS Code button
To use this feature, first configure source code integration for your service.

Static Code Analysis

Static Code Analysis analyzes your code (locally) against predefined rules to detect and fix problems.

The extension runs Static Code Analysis rules on the source files you have open in your workspace. This allows you to detect and fix problems such as maintainability issues, bugs, or security vulnerabilities in the code before you commit your changes.

Static Code Analysis supports scanning for many programming languages. For a complete list, see Static Code Analysis Rules. For file types belonging to supported languages, issues are shown in the source code editor, and you can directly apply suggested fixes.

Get started with Static Code Analysis

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.

Onboarding banner for setting up Static Code Analysis with Python files

After you create the configuration file, the analyzer runs automatically in the background whenever you open a file. If you need to enable Static Code Analysis for a particular language, search for the command Datadog: Configure Static Analysis Languages in the command palette (Shift + Cmd + P in macOS; Ctrl + Shift + P in Windows).

You can also run a batch analysis for individual folders and even the entire workspace. In the IDE’s file explorer view, right-click a folder and select Datadog Static Analysis > Analyze Folder or Analyze Workspace.

Static Code Analysis does not require a Datadog account, as source files are analyzed locally.

Exception Replay

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.

To access this feature, you must 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:

  • Access all the information Datadog has about the different frames.
  • Navigate through the production code.
  • Review the value of the different variables involved.

Select an Error Tracking code insight from the Code Insights view. Go to the stack trace and click the Exception Replay button. The IDE shows a new activity with two new views:

  • Variables: Displays the variables related to a particular stack trace frame.
  • Stack Trace: Lists the stack frames for navigation.

Select a stack trace frame and inspect the values of all the variables that Datadog captured from your production code.

License

Read the End-User License Agreement carefully before downloading or using the Datadog Visual Studio Code extension.

Data and telemetry

Datadog collects certain information about your usage of this IDE, including how you interact with it, whether errors occurred while using it, what caused those errors, and user identifiers in accordance with the Datadog Privacy Policy and Datadog’s VS Code extension EULA. This data is used to help improve the extension’s performance and features, including transitions to and from the extension and the applicable Datadog login page for accessing the Services.

If you don’t wish to send this data to Datadog, you can disable this at any time in the extension’s settings: Datadog > Telemetry > Setup > Enable Telemetry and select disabled.

The Datadog extension also honors the VS Code telemetry setting.

Help and feedback

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.

Do you use Cursor, or another fork of VS Code? Find the extension on the Open VSX Registry.

Further Reading

PREVIEWING: joepeeples/10227-vscode-revamp