Create a custom GitHub query

As an analyst, you can use the GitHub query to pull GitHub Copilot developer-activity usage data on your own. You can access the results as a .csv download, through a direct connection to Power BI, or through Azure Data Lake.

Use this query to report on GitHub Copilot adoption across your organization. You can add HR attributes, filter the population you measure, and schedule the query to refresh automatically.

The query output has one row per person per day, based on GitHub Copilot activity data.

Coverage, prerequisites, and eligibility

The query covers licensed GitHub Copilot users. GitHub Copilot usage isn't tied to a Microsoft 365 Copilot license, so the employees you measure can include people who don't have a Microsoft 365 Copilot license.

To run the query and populate the report, you'll need to be assigned the role of Insights Analyst in Viva Insights, with access to the global partition.

Note

When a metric isn't applicable or data is unavailable, the output is blank instead of showing a zero.

Use the steps below to set up and run the query.

1. Set up your query

In the Viva Insights web app, on the left, select Create analysis.

  1. Select Custom query, then select GitHub query.

  2. Under Basic query information, enter the following details:

    • Name your query. The default name uses the query type, your user ID, and the date and time. Make sure the name is unique.

    • Type a description.

    • Select a time period.

    • Set Auto refresh. When auto refresh is on, the query runs automatically and refreshes whenever a new, complete set of data becomes available, based on your Group by setting.

    • Set Group by to Days or Weeks or Months.

2. Select your metrics

Select Add metrics, then choose the GitHub Copilot metrics you want to include in your query. The following metrics are available.

Metric Type
Agent adoption Boolean
Total GitHub AI Credits used Number
Code completions suggested Number
Code completions accepted Number
User-initiated chat requests Number

3. Add conditions and condition groups

Use conditions to filter the people included in your query by HR attributes, such as Organization, Function, or Level.

  1. To add a single filter, select Add condition, and then choose an attribute, an operator, and a value.

  2. To combine several conditions, select Add condition group.

Note

By default, conditions are joined with "and." To use "or" instead, select it from the dropdown menu.

4. Select HR attributes

Choose the HR attributes you want to include in your output.

  1. Select Select attributes.

  2. Use the checklist to choose your attributes.

  3. Select Add to query.

Each attribute you select becomes a column in the people metadata file. Selecting fewer attributes keeps the file smaller.

5. Run the query

In the upper right of the screen, select Run.

Your results appear on the Analysis results page. From there, you can:

  • Download the output.

  • Copy the connection link for Power BI or Azure Data Lake.

  • Edit or clone the query.

Output files

The query output is a .zip file that contains three .csv files: an activity file; a people metadata file; and a policy metadata file. Use PeopleHistoricalId to join the activity file to the people metadata file.

1. Person GitHub Activity Metrics file

The activity file has one row per person per day.

Column Type Description
PersonId String Unique identifier for the user
MetricDate Date Day of activity
<Metric 1...N> Number One column per metric you selected
PeopleHistoricalId String Join key to the people metadata file

2. GitHub Activity by feature file

The feature activity file has one row per feature per person per day.

Column Type Description
PersonId String Unique identifier for the user
MetricDate Date Day of activity
Feature String GitHub Copilot feature, such as agent edit, chat panel modes, Copilot app, and Copilot CLI
Feature Usage Count Number Request action count
PeopleHistoricalId String Join key to the people metadata file

Breakdown dimension values

The breakdown objects above use dimension fields whose values come from fixed sets. These are field values, not separate fields. For example, "agent_edit" and the "chat_panel_*_mode" values are values of the feature field.

The feature dimension identifies the Copilot feature or mode an activity is attributed to:

Value Description
code_completion Inline code completions
chat_inline Inline chat in the editor
chat_panel_ask_mode Chat panel interactions with ask mode selected
chat_panel_edit_mode Chat panel interactions with edit mode selected
chat_panel_agent_mode Chat panel interactions with agent mode selected
chat_panel_plan_mode Chat panel interactions with plan mode selected
chat_panel_custom_mode Chat panel interactions with a custom agent selected
chat_panel_unknown_mode Chat panel interactions where the mode is unknown
agent_edit Lines added and deleted when Copilot (in agent and edit mode) writes changes directly into your files in the IDE. Counts edits from custom agents as well. "agent_edit" is not included in suggestion-based metrics and may not populate suggestion-style fields, such as "user_initiated_interaction_count."
copilot_cli Activity attributed to Copilot CLI
copilot_app Activity attributed to the Copilot app
others Any feature not covered by the values above

3. GitHub Activity by model and feature file

The activity file has one row per feature per model per person per day. The breakdown combines model and feature, for chat activity (not completions).

Column Type Description
PersonId String Unique identifier for the user
MetricDate Date Day of activity
Feature String GitHub Copilot feature, such as agent edit, chat panel modes, Copilot app, and Copilot CLI
Model String AI models used for chat
Usage Count by model and feature Number Request action count
PeopleHistoricalId String Join key to the people metadata file

4. GitHub Activity by feature and language file

The feature activity file has one row per language per feature per person per day. The breakdown combines language and feature.

Column Type Description
PersonId String Unique identifier for the user
MetricDate Date Day of activity
Language String Programming languages used with GitHub Copilot
Feature String GitHub Copilot feature, such as agent edit, chat panel modes, code completion, Copilot app, and Copilot CLI
Usage count by language and feature Number Request action count
PeopleHistoricalId String Join key to the people metadata file

5. GitHub Activity by model and language file

The activity file has one row per feature per model per person per day. The breakdown combines language and model, for chat activity (not completions).

Column Type Description
PersonId String Unique identifier for the user
MetricDate Date Day of activity
Language String Programming languages used with GitHub Copilot
Model String AI models used for chat
Usage Count by model and feature Number Request action count
PeopleHistoricalId String Join key to the people metadata file

6. People Metadata file

The people metadata file contains the HR attributes you selected. Its columns vary by query.

Column Type Description
PeopleHistoricalId String Join key to the activity file
<HR attribute 1...N> Varies One column per HR attribute you selected. Selecting fewer attributes keeps the file smaller.

Example query for GitHub Copilot adoption by team

In this example, you want to see weekly GitHub Copilot adoption for the Engineering organization. You also want Organization and Level in your output.

  1. Set up the query. For Query name, type "GHCP_Engineering_Weekly." For Time period, select [available range]. Turn on Auto refresh. For Group by, select Weeks.

  2. Select your metrics. Add Active GitHub Copilot users and Accepted code completions.

  3. Add a condition. Select Add condition > Organizational data > Organization > = > Engineering.

  4. Select HR attributes. Select Organization and Level, and then select Add to query.

  5. Run the query. Select Run. When the query finishes, download the results from the Downloads column on the Analysis results page.