Amazon CodeGuru Documentation

Find your most expensive lines of code with Amazon CodeGuru

Amazon CodeGuru is a developer tool that uses the power of machine learning to help you improve your code maintainability and find your most expensive lines of code. It performs code reviews and provides application performance recommendations.

Amazon CodeGuru Reviewer

Amazon CodeGuru Reviewer helps you find issues in your Java and Python code and recommends how to remediate them. To begin reviewing code, you can associate your existing code repositories with CodeGuru.

Automated Recommendations for Pull Requests

CodeGuru Reviewer identifies code maintainability issues and security risks by analyzing source code pull requests to find critical issues. It then provides recommendations for helping you resolve code defects directly within the pull request. CodeGuru Reviewer identifies code maintainability issues in categories listed below and helps to equip your development team to maintain a high bar of coding standards in the software development process.

Security Detection

CodeGuru Reviewer helps you improve code security and provides recommendations for best practices. It uses automated reasoning to analyze data flow from source to sink and across multiple functions to detect hard-to-find security vulnerabilities. The Security Detector supports Java, through Java 11 and identifies several categories of issues.

You can go to the CodeGuru console and trigger a security analysis on your entire repository or codebase by uploading your source and build artifacts. You can view code reviews in the “Code reviews” console page (Reviewer section). The page lists code review information such as, the status of the code review, the repository, the number of recommendations, and more. You can click on a successfully completed code review to view recommendation details, search for recommendations and see the number of lines analyzed. You may also give feedback on CodeGuru recommendations.

Full Repository Analysis

With CodeGuru, you can get ML-powered code review recommendations for lines of code in the associated repositories (not just incremental changes through pull requests), under a specified code branch. You can run repository scans to get code review recommendations during code migration, code due diligence and periodic code maintainability initiatives. In the CodeGuru console, you can trigger a new analysis on a full repository. 

With pull request and full repository analysis available, onboarding onto CodeGuru Reviewer can help you 1) associate your repository, 2) initiate a full repository analysis, 3) analyze pull requests for incremental code changes and 4) do a periodic re-scan of the repository to help you ensure code maintainability.

CI/CD Integration

CodeGuru Reviewer can be integrated into your CI/CD pipeline without you having to leave your source code management or CI/CD tool. You can configure it to run and provide recommendations on a pull, push, or scheduled run of your pipeline. After you trigger a CodeGuru Reviewer scan via CI/CD, you can view your code quality and security recommendations within the CodeGuru Reviewer Console or within your CI/CD provider’s user interface. 

Security Reviews via GitHub Action

You can use CodeGuru Reviewer's GitHub Action to run security reviews and receive recommendations directly within the GitHub user interface. 

Recommendations are also provided within the pull request and within the AWS Console. If you click into a recommendation within GitHub, you can get more in depth information on the finding.

Amazon CodeGuru Profiler

Amazon CodeGuru Profiler searches for application performance optimizations, helping to identify your most “expensive” lines of code and recommending ways to fix them to reduce CPU utilization, cut compute costs, and improve application performance. 

Always-on profiling of applications in production

CodeGuru Profiler is designed to run on production with low overhead. It enables you to profile and troubleshoot your application using real customer traffic patterns and discover performance issues. With the profiler data and ML-powered recommendations, you can identify and fix performance issues for your applications in production. CodeGuru Profiler also provides a heap summary, which can help you identify what objects are using up memory at any given time.

Understand the runtime behavior of applications

CodeGuru Profiler analyzes application CPU utilization, heap usage, and latency characteristics to show you where you are spending the most cycles or time in your application. The CPU and latency analysis is presented in a manner that helps you understand which code paths consume the most resources, verify that your application is performing as expected, and uncover areas that can be optimized further.

Heap summary

The heap usage analysis is presented on a heap summary visualization which shows you what objects are allocated on your heap.

Intelligent recommendations

CodeGuru Profiler identifies performance issues in your application and provides ML-powered recommendations on how to remediate them. These recommendations help you identify and optimize the most expensive or resource-intensive methods within your code. These optimizations can help you reduce the cost of your infrastructure, reduce latency, and can improve your overall end user experience.

Anomaly detection

Amazon CodeGuru Profiler analyzes your application profiles in real-time and helps detect anomalies in the behavior of your application and its methods. Anomalies are tracked in the Recommendation report of the CodeGuru Profiler console and you can see time series of how the method’s latency behaves over time with anomalies highlighted. If you configure it, an Amazon SNS notification will also be sent when a new anomaly is detected.

Additional Information

For additional information about service controls, security features and functionalities, including, as applicable, information about storing, retrieving, modifying, restricting, and deleting data, please see https://docs.aws.amazon.com/index.html. This additional information does not form part of the Documentation for purposes of the AWS Customer Agreement available at http://aws.amazon.com/agreement, or other agreement between you and AWS governing your use of AWS’s services.