With the release of the latest GitHub Copilot Metrics API many teams are looking to leverage this data to help monitor usage against their KPIs. For some, the Copilot Metrics Viewer (github-copilot-resources/copilot-metrics-viewer) might be a great option.
However, many organizations that we work with already have established Power BI teams. If your organization is already using Power BI, please read on!
- New Metrics API Features
- Metrics Dashboard Setup
- KPI - Savings Dashboard
- Publishing
- Maintainers
- Support
- New metrics for Pull Request summaries and Copilot Chat on GitHub.com.
- Clarity on code completions and Copilot Chat usage in IDEs.
- User engagement summaries updated daily.
- Custom model slicing support, coming soon!
- Data can be aggregated by enterprise, organization or team.
Located in the ./samples
directory you'll find sample JSON and PBIX files used to create the dashboard below.
Note: The legacy GitHub Copilot Usage API is still available and can be used with the
GitHub Copilot - Telemetry Sample (Usage).pbix
file. For instructions, see Usage_API.md.
Notes: The REST API provides metrics for the previous 28 days and is refreshed daily with data from the previous day. Please ensure you are using the latest version of the REST API.
In order to connect we'll need to generate a token and link to your metrics data:
- Download and open the sample
GitHub Copilot - Telemetry Sample (Metrics with KPI).pbix
file. - Determine if you'll be using the
Enterprise
,Organization
orTeam
URL. - Follow the instructions below to generate a token with permissions to access the API: REST API endpoints for Copilot metrics - GitHub Enterprise Cloud Docs
IMPORTANT: Do not share this token and ensure you follow you organizations security policies.
-
The file contains the following data sources, descriptions are inlcuded below.
Name Description config Configuration used to display date of refresh and KPI dashboard source Base source used to connect to API or local JSON files. GH Copilot - dotcom chat Detailed metrics of code completions using chat on the web. GH Copilot - ide chat Detailed metrics of code completions using chat within the IDE. GH Copilot - ide code completions editors Detailed metrics of code completions within the IDE. GH Copilot - ide code completions languages Detailed metrics of engaged users by language within the IDE. GH Copilot - pull requests Detailed metrics of pull requests. GH Copilot - summary Daily summary of active and engaged users. -
Open the Power Query Editor by clicking Transform data in the top-menu and selecting Tranform data.
-
Click on source in the left-menu.
-
Replace the first 2 lines with following, ensure to replace
<YOUR-TOKEN>
along with the relevant<ENTERPRISE>
,<ORG>
and<TEAM_SLUG>
with the values from step 2.Enterprise
let // Replace <YOUR-TOKEN> and <ENTERPRISE> with your actual token and enterprise name. url = "https://api.github.com/enterprises/<ENTERPRISE>/copilot/metrics", headers = [ #"Accept" = "application/vnd.github+json", #"Authorization" = "Bearer <YOUR-TOKEN>", #"X-GitHub-Api-Version" = "2022-11-28" ], Source = Json.Document(Web.Contents(url, [Headers=headers])),
Enterprise Team
let // Replace <YOUR-TOKEN>, <ENTERPRISE> and <TEAM_SLUG> with your actual token and enterprise name. url = "https://api.github.com/enterprises/<ENTERPRISE>/team/<TEAM_SLUG>/copilot/metrics", headers = [ #"Accept" = "application/vnd.github+json", #"Authorization" = "Bearer <YOUR-TOKEN>", #"X-GitHub-Api-Version" = "2022-11-28" ], Source = Json.Document(Web.Contents(url, [Headers=headers])),
Organization
let // Replace <YOUR-TOKEN> and <ORG> with your actual token and org name. url = "https://api.github.com/orgs/<ORG>/copilot/metrics", headers = [ #"Accept" = "application/vnd.github+json", #"Authorization" = "Bearer <YOUR-TOKEN>", #"X-GitHub-Api-Version" = "2022-11-28" ], Source = Json.Document(Web.Contents(url, [Headers=headers])),
Team
let // Replace <YOUR-TOKEN>, <ORG> and <TEAM_SLUG> with your actual token and enterprise name. url = "https://api.github.com/orgs/<ORG>/team/<TEAM_SLUG>/copilot/metrics", headers = [ #"Accept" = "application/vnd.github+json", #"Authorization" = "Bearer <YOUR-TOKEN>", #"X-GitHub-Api-Version" = "2022-11-28" ], Source = Json.Document(Web.Contents(url, [Headers=headers])),
-
Click OK to close the editor and select
Anonymous
authentication if prompted. -
Click Close and Apply in the top-left of the Power Query Editor.
-
On the Report View page click Refresh to load the new data into your dashboard.
Note: This example provided a proof of concept for loading metrics data and requires an exported JSON file. If you have access to the REST API you can configure the Source accordingly.
- Download and open the sample
GitHub Copilot - Telemetry Sample (Metrics with KPIs).pbix
file. - Open the Power Query Editor by clicking Transform data in the top-menu and selecting Tranform data.
- Click on source query in the left-menu
- In the right-menu under APPLIED STEPS click the gear (settings) icon, selecting your JSON file and clicking OK.
- Click Close and Apply in the top-left of the Power Query Editor.
- On the Report View page click Refresh to load the new data into your dashboard.
- Happy Customizing!
A new KPI tab has been added to the dashboard to help you estimate savings. The KPI tab is configured to display the potential time and case savings. You can configure the KPI tab to display these details by modifying the following fields in the config
data sourcefrom the Tabel view:
Name | Description |
---|---|
total_devs | Total number of developers at your organization. |
avg_hourly_salary | Average hourly salary of developers. |
annual_work_weeks | Total number of work weeks in a year. |
average_weekly_hour_savings | Average number of hours developers saved per week. The default is 3.5 hours and assumed a 10% time saving, but this can be updated based on customer survey data or other measurements. |
These values can be modified in the config
data source below:
Once configured, the KPI dashboard will display this potential savings against current usage pulled from the Metrics API:
If you need help deploying or publishing this script, please see: Publish README
@jasonmoodie, @Eldrick19
These are just files for you to download and use as you see fit. If you have questions about how to use them, please reach out to the maintainers, but we cannot guarantee a response with SLAs.