copilot_metrics
Creates, updates, deletes, gets or lists a copilot_metrics resource.
Overview
| Name | copilot_metrics |
| Type | Resource |
| Id | github.copilot.copilot_metrics |
Fields
The following fields are returned by SELECT queries:
- copilot_metrics_for_team
Response
| Name | Datatype | Description |
|---|---|---|
copilot_dotcom_chat | object | Usage metrics for Copilot Chat in GitHub.com |
copilot_dotcom_pull_requests | object | Usage metrics for Copilot for pull requests. |
copilot_ide_chat | object | Usage metrics for Copilot Chat in the IDE. |
copilot_ide_code_completions | object | Usage metrics for Copilot editor code completions in the IDE. |
date | string (date) | The date for which the usage metrics are aggregated, in YYYY-MM-DD format. |
total_active_users | integer | The total number of Copilot users with activity belonging to any Copilot feature, globally, for the given day. Includes passive activity such as receiving a code suggestion, as well as engagement activity such as accepting a code suggestion or prompting chat. Does not include authentication events. Is not limited to the individual features detailed on the endpoint. |
total_engaged_users | integer | The total number of Copilot users who engaged with any Copilot feature, for the given day. Examples include but are not limited to accepting a code suggestion, prompting Copilot chat, or triggering a PR Summary. Does not include authentication events. Is not limited to the individual features detailed on the endpoint. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
copilot_metrics_for_team | select | org, team_slug | since, until, page, per_page | Use this endpoint to see a breakdown of aggregated metrics for various GitHub Copilot features. See the response schema tab for detailed metrics definitions. > [!NOTE] > This endpoint will only return results for a given day if the team had five or more members with active Copilot licenses on that day, as evaluated at the end of that day. The response contains metrics for up to 100 days prior. Metrics are processed once per day for the previous day, and the response will only include data up until yesterday. In order for an end user to be counted towards these metrics, they must have telemetry enabled in their IDE. To access this endpoint, the Copilot Metrics API access policy must be enabled for the organization containing the team within GitHub settings. Only organization owners for the organization that contains this team and owners and billing managers of the parent enterprise can view Copilot metrics for a team. OAuth app tokens and personal access tokens (classic) need either the manage_billing:copilot, read:org, or read:enterprise scopes to use this endpoint. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
org | string | The organization name. The name is not case sensitive. |
team_slug | string | The slug of the team name. |
page | integer | The page number of the results to fetch. For more information, see "Using pagination in the REST API." |
per_page | integer | The number of days of metrics to display per page (max 100). For more information, see "Using pagination in the REST API." |
since | string | Show usage metrics since this date. This is a timestamp in ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ). Maximum value is 100 days ago. |
until | string | Show usage metrics until this date. This is a timestamp in ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ) and should not preceed the since date if it is passed. |
SELECT examples
- copilot_metrics_for_team
Use this endpoint to see a breakdown of aggregated metrics for various GitHub Copilot features. See the response schema tab for detailed metrics definitions.
> [!NOTE]
> This endpoint will only return results for a given day if the team had five or more members with active Copilot licenses on that day, as evaluated at the end of that day.
The response contains metrics for up to 100 days prior. Metrics are processed once per day for the previous day,
and the response will only include data up until yesterday. In order for an end user to be counted towards these metrics,
they must have telemetry enabled in their IDE.
To access this endpoint, the Copilot Metrics API access policy must be enabled for the organization containing the team within GitHub settings.
Only organization owners for the organization that contains this team and owners and billing managers of the parent enterprise can view Copilot metrics for a team.
OAuth app tokens and personal access tokens (classic) need either the manage_billing:copilot, read:org, or read:enterprise scopes to use this endpoint.
SELECT
copilot_dotcom_chat,
copilot_dotcom_pull_requests,
copilot_ide_chat,
copilot_ide_code_completions,
date,
total_active_users,
total_engaged_users
FROM github.copilot.copilot_metrics
WHERE org = '{{ org }}' -- required
AND team_slug = '{{ team_slug }}' -- required
AND since = '{{ since }}'
AND until = '{{ until }}'
AND page = '{{ page }}'
AND per_page = '{{ per_page }}'
;