Edit

Share via


Assign Code Optimizations insights work items to GitHub Copilot (preview)

Get code-level suggestions based on Code Optimizations recommendations with the GitHub Copilot coding agent. In this article, you learn how to:

  • Assign a GitHub issue from Code Optimizations to GitHub Copilot.
  • Iterate with GitHub Copilot through pull request reviews.

Note

Using the GitHub Copilot coding agent requires transferring your data to other countries in which Microsoft operates, including the United States. By using this functionality, you agree to the transfer of your data outside your country. Read the Microsoft Privacy Statement.

Prerequisites

Verify Code Optimizations for your application

  1. In the Azure portal, navigate to your Application Insights resource.

  2. Select Investigate > Performance.

  3. In the Performance blade, select the Code Optimizations button in the top menu.

    Screenshot of Code Optimizations located in the Performance blade.

Create a GitHub issue

  1. From the Code Optimizations page, select the insight for which you'd like to create a GitHub issue.

  2. In the insights details pane, select Create Work Item

    Screenshot of Code Optimizations details pane and selecting the create work item button.

  3. In the Create Work Item pane, from the Work Item Service dropdown, select GitHub.

  4. From the Project dropdown, select the GitHub repo with GitHub Copilot coding agent (Preview) enabled.

  5. Toggle on the Assign to GitHub Copilot (Preview) option.

    Screenshot of the checked Assign to GitHub Copilot option.

  6. Click Create Work Item.

  7. When prompted with a warning about leaving the Azure portal, select Continue to finish creating the GitHub issue.

Track the pull request opened by GitHub Copilot

Once the issue is created in GitHub, GitHub Copilot:

  1. Responds to the issue with the eyes emoji (👀).
  2. Opens a pull request as assignee.

The GitHub issue includes special instructions for the Copilot coding agent to fix and validate your specific performance issue. Copilot:

  • Benchmarks your code before and after the performance code suggestion.
  • Considers and evaluates multiple alternative solutions.

This process takes a couple minutes to finish. When the process finishes, the Copilot agent updates the pull request details and the title.

To review Copilot's changes, you can:

  • Ask Copilot to make changes using pull request comments.
  • Check out Copilot's branch and commit changes yourself.

Next steps