Skip to main content

Check out Port for yourself ➜ 

GitHub Copilot

Loading version...
Deprecation Notice: Team Metrics

GitHub is sunsetting the legacy Copilot Metrics API on April 2, 2026.

  • The copilot-team-metrics resource will stop functioning after this date.
  • Team-level metrics are not supported in the new GitHub API. Users are advised to migrate to Organization-level metrics using the instructions below.

Port's Github Copilot integration allows you to ingest your Github Copilot usage metrics into your software catalog.

Supported aggregation hierarchies

Some aggregation hierarchies of Github Copilot usage metrics can be ingested into Port, they are listed below.
It is possible to reference any field that appears in the API responses linked below in the mapping configuration.

Setup

Choose one of the following installation methods:
Not sure which method is right for your use case? Check the available installation methods.

  1. Go to the Github Copilot data source page in your portal.

  2. Under Select your installation method, choose Hosted by Port.

  3. Configure the Installation parameters and Advanced configuration as you wish (see below for details).

Installation parameters

Each integration requires specific parameters (such as an API token, a URL, etc.), as seen in Port's UI when installing it. Hover over the ⓘ icon next to each parameter to see more details about it.

Advanced configuration

  • During the installation process each integration may have additional settings under the Advanced configuration section in Port's UI.
    Additionally, each integration has one or more settings that can be configured after installation. To do so, click on the integration's name in the Data sources page and navigate to the Setting tab.
    Hover over the ⓘ icon next to each setting to see more details about it.

  • If the integration supports live events, the option to enable/disable them will be available in this section.

    Currently, live events are not supported for this integration.
    Resyncs will be performed periodically (with a configurable interval), or manually triggered by you via Port's UI.

    Therefore, real-time events (including GitOps) will not be ingested into Port immediately.
    Live events support for this integration is WIP and will be supported in the near future.

Port secrets

Some integration settings require sensitive pieces of data, such as tokens. For these settings, Port secrets will be used, ensuring that your sensitive data is encrypted and secure.

When filling in such a setting, its value will be obscured (shown as ••••••••). For each such setting, Port will automatically create a secret in your organization.

To see all secrets in your organization, follow these steps.

Limitations

  • The maximum time for a full sync to run is based on the configured resync interval. For very large amounts of data where a resync operation is expected to take longer, please use a longer interval.

Port source IP addresses

When using this installation method, Port will make outbound calls to your 3rd-party applications from static IP addresses. You may need to add these addresses to your allowlist, in order to allow Port to interact with the integrated service:

  • Europe (EU): 54.73.167.226, 63.33.143.237, 54.76.185.219
  • United States (US): 3.234.37.33, 54.225.172.136, 3.225.234.99

Configuration

Port integrations use a YAML mapping block to ingest data from the third-party api into Port.

The mapping makes use of the JQ JSON processor to select, modify, concatenate, transform and perform other operations on existing fields and values from the integration API.

Default mapping configuration

This is the default mapping configuration for this integration:

Default mapping configuration (Click to expand)
entityDeletionThreshold: 0
resources:
- kind: copilot-team-metrics
selector:
query: 'true'
port:
entity:
mappings:
identifier: (.__team.slug + "@" + .date)
title: (.__team.slug + " copilot-metrics " + .date)
blueprint: '"github_copilot_usage"'
properties:
record_date: .date + "T00:00:00Z"
breakdown: .
total_suggestions_count: '[.copilot_ide_code_completions.editors[]?.models[]?.languages[]?.total_code_suggestions] | map(select(. != null) ) | add'
total_acceptances_count: '[.copilot_ide_code_completions.editors[]?.models[]?.languages[]?.total_code_acceptances] | map(select(. != null)) | add'
total_lines_suggested: '[.copilot_ide_code_completions.editors[]?.models[]?.languages[]?.total_code_lines_suggested] | map(select(. != null)) | add'
total_lines_accepted: '[.copilot_ide_code_completions.editors[]?.models[]?.languages[]?.total_code_lines_accepted] | map(select(. != null)) | add'
total_active_users: .total_active_users
total_chat_acceptances: |-
[
(.copilot_ide_chat.editors[]?.models[]?.total_chat_copy_events // 0),
(.copilot_ide_chat.editors[]?.models[]?.total_chat_insertion_events // 0)
] | map(select(. != null)) | add
total_chat_turns: '[.copilot_ide_chat.editors[]?.models[]?.total_chats // 0] | map(select(. != null)) | add'
total_active_chat_users: '[.copilot_ide_chat.editors[]?.total_engaged_users // 0] | map(select(. != null)) | add'
git_hub_org: .__organization.login
git_hub_team: .__team.slug
- kind: copilot-organization-metrics
selector:
query: 'true'
port:
entity:
mappings:
identifier: (.__organization.login + "@" + .date)
title: (.__organization.login + " copilot-metrics " + .date)
blueprint: '"github_copilot_usage"'
properties:
record_date: .date + "T00:00:00Z"
breakdown: .
total_suggestions_count: '[.copilot_ide_code_completions.editors[]?.models[]?.languages[]?.total_code_suggestions] | map(select(. != null) ) | add'
total_acceptances_count: '[.copilot_ide_code_completions.editors[]?.models[]?.languages[]?.total_code_acceptances] | map(select(. != null)) | add'
total_lines_suggested: '[.copilot_ide_code_completions.editors[]?.models[]?.languages[]?.total_code_lines_suggested] | map(select(. != null)) | add'
total_lines_accepted: '[.copilot_ide_code_completions.editors[]?.models[]?.languages[]?.total_code_lines_accepted] | map(select(. != null)) | add'
total_active_users: .total_active_users
total_chat_acceptances: |-
[
(.copilot_ide_chat.editors[]?.models[]?.total_chat_copy_events // 0),
(.copilot_ide_chat.editors[]?.models[]?.total_chat_insertion_events // 0)
] | map(select(. != null)) | add
total_chat_turns: '[.copilot_ide_chat.editors[]?.models[]?.total_chats // 0] | map(select(. != null)) | add'
total_active_chat_users: '[.copilot_ide_chat.editors[]?.total_engaged_users // 0] | map(select(. != null)) | add'
git_hub_org: .__organization.login
- kind: organization-usage-metrics
selector:
query: 'true'
port:
entity:
mappings:
identifier: (.__organization.login + "@" + .day)
title: (.__organization.login + " copilot-metrics " + .day)
blueprint: '"githubCopilotOrganizationUsage"'
properties:
record_date: .day + "T00:00:00Z"
daily_active_users: .daily_active_users
code_generation_activity_count: .code_generation_activity_count
code_acceptance_activity_count: .code_acceptance_activity_count
loc_suggested_to_add_sum: .loc_suggested_to_add_sum
loc_added_sum: .loc_added_sum
user_initiated_interaction_count: .user_initiated_interaction_count
git_hub_org: .__organization.login

Permissions

Port's Github Copilot integration requires a classic Github token generated by organization owners or parent enterprise owners and billing managers with at least one of the following scopes to be enabled:

  • manage_billing:copilot.
  • read:org.
  • read:enterprise.

In addition, the Copilot Metrics API access policy must be enabled for the organization within GitHub settings.

Monitoring and sync status

To learn more about how to monitor and check the sync status of your integration, see the relevant documentation.

Examples

To view and test the integration's mapping against examples of the third-party API responses, use the jq playground in your data sources page.
Find the integration in the list of data sources and click on it to open the playground.

GitHub Copilot Usage Blueprint (Sunset) (click to expand)
{
"identifier": "github_copilot_usage",
"title": "GitHub Copilot Usage",
"icon": "Github",
"schema": {
"properties": {
"record_date": {
"type": "string",
"title": "Record Date",
"format": "date-time"
},
"breakdown": {
"type": "object",
"title": "Breakdown"
},
"total_suggestions_count": {
"type": "number",
"title": "Total Suggestions Count"
},
"total_acceptances_count": {
"type": "number",
"title": "Total Acceptances Count"
},
"total_lines_suggested": {
"type": "number",
"title": "Total Lines Suggested"
},
"total_lines_accepted": {
"type": "number",
"title": "Total Lines Accepted"
},
"total_active_users": {
"type": "number",
"title": "Total Active Users"
},
"total_chat_acceptances": {
"type": "number",
"title": "Total Chat Acceptances"
},
"total_chat_turns": {
"type": "number",
"title": "Total Chat Turns"
},
"total_active_chat_users": {
"type": "number",
"title": "Total Active Chat Users"
},
"git_hub_org": {
"type": "string",
"title": "GitHub Org"
},
"git_hub_team": {
"type": "string",
"title": "GitHub Team"
}
},
"required": []
},
"calculationProperties": {
"acceptance_rate": {
"title": "Acceptance Rate",
"icon": "DefaultProperty",
"calculation": "if (.properties.total_suggestions_count == 0) then 0 else ((.properties.total_acceptances_count / .properties.total_suggestions_count) * 100 | round) end",
"type": "number"
}
},
"relations": {}
}

Team hierarchy metrics (sunset - April 2026)

Integration configuration (click to expand)
entityDeletionThreshold: 0
resources:
- kind: copilot-team-metrics
selector:
query: 'true'
port:
entity:
mappings:
identifier: (.__team.slug + "@" + .date)
title: (.__team.slug + " copilot-metrics " + .date)
blueprint: '"github_copilot_usage"'
properties:
record_date: .date + "T00:00:00Z"
breakdown: .
total_suggestions_count: >-
[.copilot_ide_code_completions.editors[]?.models[]?.languages[]?.total_code_suggestions]
| map(select(. != null) ) | add
total_acceptances_count: >-
[.copilot_ide_code_completions.editors[]?.models[]?.languages[]?.total_code_acceptances]
| map(select(. != null)) | add
total_lines_suggested: >-
[.copilot_ide_code_completions.editors[]?.models[]?.languages[]?.total_code_lines_suggested]
| map(select(. != null)) | add
total_lines_accepted: >-
[.copilot_ide_code_completions.editors[]?.models[]?.languages[]?.total_code_lines_accepted]
| map(select(. != null)) | add
total_active_users: .total_active_users
total_chat_acceptances: >-
[
(.copilot_ide_chat.editors[]?.models[]?.total_chat_copy_events // 0),
(.copilot_ide_chat.editors[]?.models[]?.total_chat_insertion_events // 0)
]
| map(select(. != null)) | add
total_chat_turns: >-
[.copilot_ide_chat.editors[]?.models[]?.total_chats // 0]
| map(select(. != null)) | add
total_active_chat_users: >-
[.copilot_ide_chat.editors[]?.total_engaged_users // 0]
| map(select(. != null)) | add
git_hub_org: .__organization.login
git_hub_team: .__team.slug

Organization hierarchy metrics (deprecated)

Integration configuration (click to expand)
entityDeletionThreshold: 0
resources:
- kind: copilot-organization-metrics
selector:
query: 'true'
port:
entity:
mappings:
identifier: (.__organization.login + "@" + .date)
title: (.__organization.login + " copilot-metrics " + .date)
blueprint: '"github_copilot_usage"'
properties:
record_date: .date + "T00:00:00Z"
breakdown: .
total_suggestions_count: >-
[.copilot_ide_code_completions.editors[]?.models[]?.languages[]?.total_code_suggestions]
| map(select(. != null) ) | add
total_acceptances_count: >-
[.copilot_ide_code_completions.editors[]?.models[]?.languages[]?.total_code_acceptances]
| map(select(. != null)) | add
total_lines_suggested: >-
[.copilot_ide_code_completions.editors[]?.models[]?.languages[]?.total_code_lines_suggested]
| map(select(. != null)) | add
total_lines_accepted: >-
[.copilot_ide_code_completions.editors[]?.models[]?.languages[]?.total_code_lines_accepted]
| map(select(. != null)) | add
total_active_users: .total_active_users
total_chat_acceptances: >-
[
(.copilot_ide_chat.editors[]?.models[]?.total_chat_copy_events // 0),
(.copilot_ide_chat.editors[]?.models[]?.total_chat_insertion_events // 0)
]
| map(select(. != null)) | add
total_chat_turns: >-
[.copilot_ide_chat.editors[]?.models[]?.total_chats // 0]
| map(select(. != null)) | add
total_active_chat_users: >-
[.copilot_ide_chat.editors[]?.total_engaged_users // 0]
| map(select(. != null)) | add
git_hub_org: .__organization.login

Organization usage metrics

GitHub Copilot Organization Usage Blueprint
  {
"identifier": "githubCopilotOrganizationUsage",
"title": "GitHub Copilot Organization Usage",
"icon": "Github",
"schema": {
"properties": {
"record_date": {
"type": "string",
"title": "Record Date",
"format": "date-time"
},
"daily_active_users": {
"type": "number",
"title": "Daily Active Users"
},
"code_generation_activity_count": {
"type": "number",
"title": "Code Generation Activity Count"
},
"code_acceptance_activity_count": {
"type": "number",
"title": "Code Acceptance Activity Count"
},
"loc_suggested_to_add_sum": {
"type": "number",
"title": "LOC Suggested To Add"
},
"loc_added_sum": {
"type": "number",
"title": "LOC Added"
},
"user_initiated_interaction_count": {
"type": "number",
"title": "User Initiated Interaction Count"
},
"git_hub_org": {
"type": "string",
"title": "GitHub Org"
}
},
"required": []
},
"calculationProperties": {
"acceptance_rate": {
"title": "Acceptance Rate",
"icon": "DefaultProperty",
"calculation": "if (.properties.code_generation_activity_count == 0) then 0 else ((.properties.code_acceptance_activity_count / .properties.code_generation_activity_count) * 100 | round) end",
"type": "number"
}
}
}

Integration configuration (click to expand)
entityDeletionThreshold: 0
resources:
- kind: organization-usage-metrics
selector:
query: 'true'
port:
entity:
mappings:
identifier: (.__organization.login + "@" + .day)
title: (.__organization.login + " copilot-metrics " + .day)
blueprint: '"githubCopilotOrganizationUsage"'
properties:
record_date: .day + "T00:00:00Z"
daily_active_users: .daily_active_users
code_generation_activity_count: .code_generation_activity_count
code_acceptance_activity_count: .code_acceptance_activity_count
loc_suggested_to_add_sum: .loc_suggested_to_add_sum
loc_added_sum: .loc_added_sum
user_initiated_interaction_count: .user_initiated_interaction_count
git_hub_org: .__organization.login

Visualize GitHub Copilot metrics