Visibility into the production performance of code iterations helps developers verify that application releases and updates are working as intended. However, when variables such as large-scale user requests and increased server load create issues that were absent during testing, developers will often need to pivot from investigating production data back to their coding environment to address errors and vulnerabilities. As a result, troubleshooting issues between development, testing, and production can feel cumbersome and slow developer velocity.
That’s why Datadog offers plugins for VS Code, Visual Studio, and IntelliJ IDEA, GoLand, and PyCharm, enabling you to gain visibility into live production data directly within your IDE. Using Datadog’s plugins, you can correlate security issues, high resource consumption, and degraded performance directly to the methods and lines of code responsible without leaving your coding environment. This lets you reduce context switching while troubleshooting to create a more streamlined investigative workflow.
In this post, we’ll cover how to use our IDE plugins to:
- Highlight performance, error, and reliability issues
- Identify resource intensive methods
- Fix noncompliant code prior to execution
Highlight performance, reliability, and security issues
Using the Datadog plugin, our Code Insights will automatically highlight issues found within your service to give you relevant starting points for either troubleshooting your application or optimizing its performance. Code Insights will show you backend service errors, flaky tests detected by Datadog CI Visibility, vulnerability reports from Application Security Management, and more. The code insight shown below in IDEA identifies a high rate of lock contention that is overconsuming CPU and degrading the performance of our product-recommendation
service .
By selecting a code insight, Datadog will direct you to the location of the source code so you can begin troubleshooting. Datadog will also provide recommendations to help you resolve issues if you need help getting started. To help address the previous lock contention issue, Code Insights suggests implementing a solution to help reduce the time your requests take to acquire locks on shared resources.
Identify and troubleshoot resource-intensive methods
Datadog Continuous Profiler measures the work done by the functions across your service using metrics such as CPU time, allocated memory, wall time, and other profile types, so you can precisely identify the areas of code most in need of optimization.
With Datadog’s IDE plugins, you can view profiles within your IntelliJ IDEs and Visual Studio. Selecting a service within the Continuous Profiler tab will automatically sort your functions to display the top consumers of a given profile type. You can filter the profiler to cover only your code to gain insights into how your code changes directly impact service performance. In the example below, we want to optimize our model training function for our product-recommendation
service. Using the profiler’s top list, we identify that too much time is being spent syncing our model coefficients; from here, we can conduct a deeper investigation into the function and make code changes to reduce overall runtime.
If you already use the Datadog platform, it’s likely that you’ve used flame graphs to debug errors or performance issues. You can now view flame graphs of profiling samples directly in your IDE, each showing stack traces and their relative durations within a minute interval. Datadog will automatically aggregate all of the profiling samples into a comprehensive view across your entire request path, enabling you to follow familiar workflows without leaving your IDE so you can solve issues as you write and update code. Following our previous example, when investigating our model training function as it executes in a profile, we notice that it returns an UnsupportedOperationException
at a high frequency. We can then trace the exception to where it’s thrown in our code to troubleshoot the exact reason our model training is failing.
To learn more about how to use Continuous Profiler, check out our our blog post and our getting started guide.
Proactively fix noncompliant code prior to execution
After enabling our IDE plugins for VS Code and IntelliJ IDEA or PyCharm, Datadog will detect your project’s programming language and create a static-analysis.datadog.yml file where you can designate performance, reliability, and security rulesets. Static Analysis supports Python, Java, C#, and other programming languages along with frameworks such as Flask, Django, and pandas to help you identify cases of noncompliant code across your entire stack.
Our analyzer will dynamically evaluate rules prior to runtime so you can secure your code before it reaches production environments. For example, Datadog’s security rules for Java will automatically detect insecure HTTP connections, as well as unsanitized user inputs that leave your application vulnerable to SQL injections. Datadog will also recommend suggested fixes, so you can resolve issues—such as missing HTTP request timeout parameters—with a single click. You can learn more about Datadog Static Analysis in our blog post.
Getting started
Datadog’s IDE plugins help you reduce context switching so you can streamline your troubleshooting workflow while maintaining visibility into your production telemetry. To get started, you’ll need to first install the Datadog plugin for the supported IDE of your choice. For VS Code and Visual Studio, you can install the extension from the Visual Studio Marketplace. Similarly, IntelliJ users can find and install it from the Plugins tab within their IDE settings. You can learn more in our documentation for our IntelliJ, Visual Studio, and VS Code IDE plugins.
If you don’t already have a Datadog account, sign up for a free 14-day trial today.