Datadog Plugin for JetBrains IDEs

Cette page n'est pas encore disponible en français, sa traduction est en cours.
Si vous avez des questions ou des retours sur notre projet de traduction actuel, n'hésitez pas à nous contacter.

Overview

The Datadog plugin for JetBrains IDEs is available for IntelliJ IDEA, GoLand, PhpStorm, and PyCharm. It helps you improve software performance by providing meaningful code-level insights directly in the IDE based on real-time observability data.

The Datadog tool window open in IDEA

The Code Insights view keeps you informed about:

The Continuous Profiler helps you to reduce latency and lower cloud costs by highlighting code lines that:

  • Consume the most CPU
  • Allocate the most memory
  • Spend the most time on locks, disk I/O, and socket I/O

The Logs support shows observed logs in source code, as detected from Log patterns, and provides links to the Datadog Log Explorer to view logs generated by a specific line of code.

The CI Test Runs feature opens the Continuous Integration Visibility Explorer to show recent runs for a selected test.

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 plugin 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.
  • Continuous Profiler: To display profiling data and insights, the plugin requires the Continuous Profiler to be configured for your Services. For more information, see Getting Started with the Continuous Profiler.
  • JetBrains Toolbox: To use the View in IDE feature, the plugin requires the JetBrains Toolbox to be installed on the developer’s machine.

Setup

Install the Datadog plugin

  1. Click Plugins and search for Datadog.
  2. Click Install to download and install the plugin in your IDE.
  3. If you receive a prompt notifying you that Datadog is a third-party plugin, click Accept.
  4. Click Restart IDE.
The Datadog plugin

Alternatively, you can install the plugin from the JetBrains Marketplace.

Log in to Datadog

After installing the Datadog plugin and restarting the IDE, log in to Datadog:

  1. With a file or project open in the IDE, click the Datadog tool window.
  2. Click Log in….
  3. In the browser window that opens, select your site and organization, then authorize access to the platform.

Note: For most users, one login is all that is required. If you’re using a multi-org setup, check to ensure that the correct account is active. To find out which login your IDE is using, click Settings -> Tools -> Datadog, and check which account is active.

To provide relevant data from the Datadog platform, add related services to your project:

  1. With your project open in the IDE, open the Datadog tool window and select Manage Linked Services… from the Options menu.
  2. A settings dialog opens, click the plus icon (+).
  3. Search for and select the services that you want to add to the current project.

To remove a service, select it in the Services table and click the minus icon (-).

The names of linked services persist with the project when you close it.

Code Insights

The Code Insights tab displays insights generated by the Datadog platform that are relevant to your current project. The insights are grouped into three categories: performance, reliability, and security.

The Code Insights tab.

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 interested in.

Continuous Profiler

The Continuous Profiler tab shows profiling information for the service in a selected environment, aggregated over a specific time frame. Available views are:

  • Top list: Displays a list of the most resource intensive methods for the current profiling measure.
  • Flame graph: A flame graph representing stack traces in the profiles.

You can specify the following parameters for the profiling data:

  • The profile type to be displayed
  • The environment in which the service is running
  • The time frame for the profile samples to be aggregated

The available profiling types usually include options like CPU Time and Allocated Memory, but are determined by the platform and vary by language.

Top list

The Top List sub-tab shows the methods that consume the most resources based on the aggregated profile data loaded from the Datadog servers. These are the methods that are most likely candidates for optimization.

The Top-list view
  • Double-clicking an item in the list (or selecting Jump to Source from the context menu) opens a source code editor showing where the method is defined.
  • To see a flame graph visualization of a method, select Search in Flame Graph from the context menu.

Call tree

The call tree to the right of the Top List shows the paths that lead to (and from) the selected method.

The default Caller Hierarchy view shows the callers (or predecessors) of the target method and the frequency with which they appear in the call stack. To view the callees (or successors), click the Callee Hierarchy button on the toolbar.

Right-click on a method in the call tree to see options to navigate to the source editor or flame graph.

Flame graph

A flame graph is a visualization of profiling samples that shows stack traces and their relative frequency during the sample period. The Datadog plugin collects multiple individual profiles from the requested time frame, and aggregates them. Each individual profile covers a 60 second interval within the requested time frame.

A flame graph showing CPU Time over the past hour

Each time you change the profile type, the time frame, or the environment, the Datadog plugin generates a new flame graph.

You can navigate the flame graph in several ways:

  • Double-click on any frame to focus on that method and all the methods that it has called during the sampling period.
  • Use the minimap to pan around the graph.
  • Right-click on a method and select Jump to Source to go to the corresponding point in the source code.

Hovering over a method displays a tooltip with the following information:

  • The class name and method signature
  • The package name
  • The profiling metric value and percentage breakdown.

Profiling samples include stack trace and line number information. Use the Separate Flame Graph by button to switch between separating frames by method or line number.

Use the tooltip button to separate frames by method or line number

Source highlighting

When the Continuous Profiler tab is active, the plugin adds code highlights to the source code editor margin. For Top Methods, an icon appears in the editor margin, and line-level highlights appear in the code based on the active Profiling data.

  • Hover over the icon to see more information.
  • Click the icon to open the top list Profiling tab or open Profiling in Datadog.
    Click the Datadog icon to open the Profiling data in a tab or in Datadog

The active Profiling tab also affects the project tree view, which is annotated with the selected profile’s metrics:

The project tree annotated with profile metrics from a profile tab

Logs insights

Log patterns from Datadog are matched directly to lines of code in your editor for your Java, Go, and Python source files:

A log line showing log events from Datadog

A popup shows runtime values from the log entries:

A popup showing log patterns from Datadog

Click the log icon to open the Log Explorer on the Datadog platform with a pre-filled query that matches the logger name, log level, and log message as closely as possible:

A source file showing a View Logs icon and link.

CI Test Runs

You can view recent test runs in the Continuous Integration Visibility Explorer by navigating directly from your source files. Look for the View Test Runs links following test method declarations in your source code:

A source file showing a View Test Runs link.

Clicking the link opens the Test Runs tab showing the recent history for one test case.

View in IDE

The View in IDE feature provides a link from the Datadog platform directly to the source files in your IDE. Look for the button next to frames in stack traces displayed on the platform (for example, in Error Tracking):

A stack trace on the Datadog platform showing the View in IntelliJ button.
This feature has two prerequisites: (1) Source Code Integration is configured for your service and (2) the JetBrains Toolbox is installed on your development machine.

Static Analysis

The Datadog plugin 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 with the JetBrains inspection system, and suggested fixes can be applied directly:

A static analysis rule violation and recommended fix.

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 plugin checks for static-analysis.datadog.yml at your source repository’s root. It prompts you to create the file if necessary:

A banner for onboarding.

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

You can give feedback in the discussion forum, or send an e-mail to team-ide-integration@datadoghq.com.

Data and Telemetry

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 EULA.

If you don’t wish to send this data to Datadog, you can opt out at any time in the settings: Settings > Tools > Datadog > Data Sharing and disable the Send usage statistics option.

Further reading

PREVIEWING: rtrieu/product-analytics-ui-changes