Skip to content

github-copilot-resources/copilot-metrics-viewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NOTE: For information on support and assistance, click here.

GitHub Copilot Metrics Viewer

image

This application displays a set of charts with various metrics related to GitHub Copilot for your GitHub Organization or Enterprise Account. These visualizations are designed to provide clear representations of the data, making it easy to understand and analyze the impact and adoption of GitHub Copilot. This app utilizes the GitHub Copilot Metrics API.

Video

copilot-metrics-viewer.mov

Charts

Key Metrics

Note

Metrics details are described in detail in GitHub API response schema

Here are the key metrics visualized in these charts:

image

  1. Acceptance Rate: This metric represents the ratio of accepted lines and suggestions to the total suggested by GitHub Copilot. This rate is an indicator of the relevance and usefulness of Copilot's suggestions. However, as with any metric, it should be used with caution as developers use Copilot in many different ways (research, confirm, verify, etc., not always "inject").

image

  1. Total Suggestions: This chart illustrates the total number of code suggestions made by GitHub Copilot. It offers a view of the tool's activity and its engagement with users over time.

  2. Total Acceptances: This visualization focuses on the total number of suggestions accepted by users.

image

  1. Total Lines Suggested: Showcases the total number of lines of code suggested by GitHub Copilot. This gives an idea of the volume of code generation and assistance provided.

  2. Total Lines Accepted: As the name suggests, the total lines of code accepted by users (full acceptances) offering insights into how much of the suggested code is actually being utilized and incorporated into the codebase.

image

  1. Total Active Users: Represents the number of active users engaging with GitHub Copilot. This helps in understanding the user base growth and adoption rate.

image

Languages Breakdown Analysis

Pie charts with the top 5 languages by accepted prompts and acceptance rate (by count/by lines) are displayed at the top.

image

The language breakdown analysis tab also displays a table showing the Accepted Prompts, Accepted Lines of Code, and Acceptance Rate (%) for each language over the past 28 days. The entries are sorted by the number of accepted lines of code descending.

image

Copilot Chat Metrics

image

  1. Cumulative Number of Turns: This metric represents the total number of turns (interactions) with the Copilot over the past 28 days. A 'turn' includes both user inputs and Copilot's responses.

  2. Cumulative Number of Acceptances: This metric shows the total number of lines of code suggested by Copilot that have been accepted by users over the past 28 days.

  3. Total Turns | Total Acceptances Count: This is a chart that displays the total number of turns and acceptances.

  4. Total Active Copilot Chat Users: A bar chart that illustrates the total number of users who have actively interacted with Copilot over the past 28 days.

Seat Analysis

image

  1. Total Assigned: This metric represents the total number of Copilot seats assigned within the current organization/enterprise.

  2. Assigned But Never Used: This metric shows seats that were assigned but never used within the current organization/enterprise. The assigned timestamp is also displayed in the chart.

  3. No Activity in the Last 7 Days: Never used seats or seats used, but with no activity in the past 7 days.

  4. No Activity in the Last 7 Days (including never used seats): A table to display seats that have had no activity in the past 7 days, ordered by the date of last activity. Seats that were used earlier are displayed at the top.

Setup Instructions

In the .env file, you can configure several environment variables that control the behavior of the application.

Public variables:

  • NUXT_PUBLIC_IS_DATA_MOCKED
  • NUXT_PUBLIC_SCOPE
  • NUXT_PUBLIC_GITHUB_ENT
  • NUXT_PUBLIC_GITHUB_ORG
  • NUXT_PUBLIC_GITHUB_TEAM

can be overriden by route parameters, e.g.

  • http://localhost:3000/enterprises/octo-demo-ent
  • http://localhost:3000/orgs/octo-demo-org
  • http://localhost:3000/orgs/octo-demo-org/teams/the-a-team
  • http://localhost:3000/orgs/mocked-org?mock=true

NUXT_PUBLIC_SCOPE

The NUXT_PUBLIC_SCOPE environment variable in the .env file determines the default scope of the API calls made by the application. It can be set to 'enterprise', 'organization' or 'team'.

  • If set to 'enterprise', the application will target API calls to the GitHub Enterprise account defined in the NUXT_PUBLIC_GITHUB_ENT variable.
  • If set to 'organization', the application will target API calls to the GitHub Organization account defined in the NUXT_PUBLIC_GITHUB_ORG variable.
  • If set to 'team', the application will target API calls to GitHub Team defined in the NUXT_PUBLIC_GITHUB_TEAM variable under NUXT_PUBLIC_GITHUB_ORG GitHub Organization.

For example, if you want to target the API calls to an organization, you would set NUXT_PUBLIC_SCOPE=organization in the .env file.

[!INFO] Environment variables with NUXT_PUBLIC scope are available in the browser (are public). See Nuxt Runtime Config for details.

NUXT_PUBLIC_SCOPE=organization

NUXT_PUBLIC_GITHUB_ORG=<YOUR-ORGANIZATION>

NUXT_PUBLIC_GITHUB_ENT=

NUXT_PUBLIC_GITHUB_TEAM

The NUXT_PUBLIC_GITHUB_TEAM environment variable filters metrics for a specific GitHub team within an Enterprise or Organization account. ‼️ Important ‼️ When this variable is set, all displayed metrics will pertain exclusively to the specified team. To view metrics for the entire Organization or Enterprise, remove this environment variable.

NUXT_PUBLIC_GITHUB_TEAM=

NUXT_PUBLIC_IS_DATA_MOCKED

Variable is false by default. To view mocked data switch it to true or use query parameter ?mock=true.

NUXT_PUBLIC_IS_DATA_MOCKED=false

NUXT_GITHUB_TOKEN

Specifies the GitHub Personal Access Token utilized for API requests. Generate this token with the following scopes: copilot, manage_billing:copilot, manage_billing:enterprise, read:enterprise, read:org.

Token is not used in the frontend.

NUXT_GITHUB_TOKEN=

NUXT_SESSION_PASSWORD (Required!)

This variable is required to encrypt user sessions, it needs to be at least 32 characters long. For more information see Nuxt Sessions and Authentication.

Warning

This variable is required starting from version 2.0.0.

NUXT_PUBLIC_USING_GITHUB_AUTH

Default is false. When set to true, GitHub OAuth App Authentication will be performed to verify users' access to the dashboard.

Variables required for GitHub Auth are:

  1. NUXT_OAUTH_GITHUB_CLIENT_ID - client ID of the GitHub App registered and installed in the enterprise/org with permissions listed in NUXT_GITHUB_TOKEN.
  2. NUXT_OAUTH_GITHUB_CLIENT_SECRET - client secret of the GitHub App.
  3. [Optional] NUXT_OAUTH_GITHUB_CLIENT_SCOPE for scope requests when using OAuth App instead of GitHub App. See Github docs for details.

Warning

Only users with permissions (scopes listed in NUXT_GITHUB_TOKEN) can view copilot metrics, GitHub uses the authenticated users permissions to make API calls for data.

Install Dependencies

npm install

Compiles and Runs the Application

npm run dev

Docker Build

docker build -t copilot-metrics-viewer .

Docker Run

docker run -p 8080:80 --env-file ./.env copilot-metrics-viewer

The application will be accessible at http://localhost:8080

License

This project is licensed under the terms of the MIT open source license. Please refer to MIT for the full terms.

Maintainers

@martedesco & @karpikpl

Support

This project is independently developed and maintained, and is not an official GitHub product. It thrives through the dedicated efforts of (@martedesco), (@karpikpl) and our wonderful contributors. A heartfelt thanks to all our contributors! ✨

I aim to provide support through GitHub Issues. While I strive to stay responsive, I can't guarantee immediate responses. For critical issues, please include "CRITICAL" in the title for quicker attention. 🙏🏼