# GitHub Copilot Usage integration with Coralogix

The GitHub Copilot Usage integration is a Coralogix-managed integration that collects your organizations' GitHub Copilot usage and billing data once a day and writes it to Coralogix as metrics. You authorize Coralogix once through GitHub and install the Coralogix GitHub App on the organizations you want to track; Coralogix then pulls the Copilot reports on a daily schedule from every organization the authorization can access — no agent, collector, or code to run on your side.

Once connected, you get organization-wide adoption and activity totals, per-user activity, team membership, and month-to-date billing as Prometheus-style gauges that you can chart, alert on, and join by user, team, model, IDE, feature, and language.

## How it works

Each day, for every organization your authorization can access, Coralogix reads the following from GitHub for the **previous** day:

| Source                                    | What it provides                                                                                                                                                                        |
| ----------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `organization-1-day` report               | Org-wide active-user counts, activity totals, command-line interface (CLI) totals, pull-request metrics, AI-adoption-phase distribution, and per-IDE/feature/language/model breakdowns. |
| `users-1-day` report                      | Per-user activity totals, CLI sub-metrics, and per-IDE/feature/language/model breakdowns.                                                                                               |
| `user-teams-1-day` report                 | The user↔team memberships used to join per-user metrics to teams.                                                                                                                       |
| Billing usage summary (`product=copilot`) | Month-to-date quantities and amounts per SKU, model, and unit type.                                                                                                                     |
| Organization members (GraphQL)            | Adds `user_email` and `user_name` labels to per-user metrics.                                                                                                                           |

Key behaviors to keep in mind when querying:

- **All authorized organizations.** Coralogix collects from every organization where the Coralogix GitHub App is installed and your authorization can reach it. Every metric carries an `organization` label, so you filter or break down by org.
- **Daily cadence.** GitHub publishes a day's report during the following day, so the most recent data point trails the current time by up to a day plus the daily poll time.
- **One sample per day.** Every metric is stamped at `23:59:59 UTC` of the report day. A daily aggregate describes the whole day, so it sits at the period close.
- **Daily totals, not cumulative.** Activity counts (lines of code, interactions, active users, and so on) are the total *for that report day*. The `github_copilot_billing_*` metrics are the exception — they are **month-to-date** values, re-published each day.
- **Absent values are skipped.** A field that GitHub omits is never emitted as `0`; the series does not exist for that day. A query that finds no series means "not reported," not "zero."
- **Breakdowns carry a `_by_<dimension>` suffix** (for example, `..._by_ide`) so they never collide with — or double-count against — the matching base totals.

## What you need

- One or more GitHub organizations on a Copilot plan that exposes the Copilot metrics and billing APIs.
- The **Coralogix GitHub App** ([`coralogix-copilot-observability`](https://github.com/apps/coralogix-copilot-observability)) installed on each organization you want to track. At install time, the app requests read access to Copilot metrics, organization members, and billing.
- Permission to authorize the app on your behalf — completing the GitHub authorization requires an organization owner/admin.

## Set up

1. In Coralogix, create the **GitHub Copilot Usage** integration and fill in the basic fields:

   | Setting          | Required | Purpose                                                                             |
   | ---------------- | -------- | ----------------------------------------------------------------------------------- |
   | Integration name | Yes      | A name for this integration in Coralogix. Defaults to *GitHub Copilot Usage*.       |
   | Application name | Yes      | Coralogix `application` tag applied to the ingested metrics. Defaults to *copilot*. |
   | Subsystem name   | No       | Optional Coralogix `subsystem` tag for the ingested metrics.                        |

1. Click **Authorize**. Coralogix redirects you to GitHub to authorize the Coralogix GitHub App. You must be an organization owner/admin to complete this step.

1. Approve the authorization, and install (or confirm) the **[`coralogix-copilot-observability`](https://github.com/apps/coralogix-copilot-observability)** app on every organization whose Copilot usage you want to collect. You can add more organizations at any time.

1. GitHub returns you to Coralogix and the integration finishes provisioning.

Once authorized, Coralogix discovers every organization the authorization can access and collects from all of them. After the first daily collection runs, search Metrics Explorer for the `github_copilot_` prefix to confirm data is flowing.

Created, but no organizations yet

If you authorize before the Coralogix GitHub App is installed on any organization, the integration is created but has nothing to collect. Install the app from <https://github.com/apps/coralogix-copilot-observability> on at least one organization on a Copilot plan; collection starts on the next daily run. You can install it now or later.

## Metrics reference

All metrics are gauges and appear in Metrics Explorer under the `github_copilot_` prefix. Every series carries an `organization` label. Per-user series additionally carry `user_login` (always), `user_id` (when GitHub reports it), and `user_email` / `user_name` (when resolvable from organization members).

### Billing (month-to-date)

One set per billing row, keyed by `sku`, `unit_type`, and — on premium-request rows — `model`.

| Metric                                     | What it tracks                                        |
| ------------------------------------------ | ----------------------------------------------------- |
| `github_copilot_billing_gross_quantity`    | Gross usage quantity for the SKU.                     |
| `github_copilot_billing_discount_quantity` | Quantity covered by included allowances or discounts. |
| `github_copilot_billing_net_quantity`      | Billable quantity after discounts.                    |
| `github_copilot_billing_gross_amount`      | Gross monetary amount.                                |
| `github_copilot_billing_discount_amount`   | Discounted monetary amount.                           |
| `github_copilot_billing_net_amount`        | Net monetary amount charged.                          |
| `github_copilot_billing_price_per_unit`    | Unit price for the SKU.                               |

### Organization activity

Org-wide totals from the `organization-1-day` report. Active-user counts and base activity totals carry only the `organization` label.

| Metric                                                       | What it tracks                                          |
| ------------------------------------------------------------ | ------------------------------------------------------- |
| `github_copilot_org_daily_active_users`                      | Daily active Copilot users.                             |
| `github_copilot_org_weekly_active_users`                     | Weekly active Copilot users.                            |
| `github_copilot_org_monthly_active_users`                    | Monthly active Copilot users.                           |
| `github_copilot_org_daily_active_cli_users`                  | Daily active Copilot CLI users.                         |
| `github_copilot_org_daily_active_copilot_cloud_agent_users`  | Daily active Copilot cloud-agent users.                 |
| `github_copilot_org_monthly_active_chat_users`               | Monthly active chat users.                              |
| `github_copilot_org_monthly_active_agent_users`              | Monthly active agent users.                             |
| `github_copilot_org_daily_active_copilot_code_review_users`  | Daily users who actively used Copilot code review.      |
| `github_copilot_org_daily_passive_copilot_code_review_users` | Daily users who received Copilot code review passively. |
| `github_copilot_org_code_generation_activity_count`          | Code-generation activities.                             |
| `github_copilot_org_code_acceptance_activity_count`          | Code-acceptance activities.                             |
| `github_copilot_org_user_initiated_interaction_count`        | User-initiated interactions.                            |
| `github_copilot_org_loc_suggested_to_add_sum`                | Lines of code suggested for addition.                   |
| `github_copilot_org_loc_suggested_to_delete_sum`             | Lines of code suggested for deletion.                   |
| `github_copilot_org_loc_added_sum`                           | Lines of code added.                                    |
| `github_copilot_org_loc_deleted_sum`                         | Lines of code deleted.                                  |

CLI totals (emitted only when the org used the CLI that day):

| Metric                                          | What it tracks                  |
| ----------------------------------------------- | ------------------------------- |
| `github_copilot_org_cli_session_count`          | CLI sessions.                   |
| `github_copilot_org_cli_request_count`          | CLI requests.                   |
| `github_copilot_org_cli_prompt_count`           | CLI prompts.                    |
| `github_copilot_org_cli_output_tokens_sum`      | CLI output tokens.              |
| `github_copilot_org_cli_prompt_tokens_sum`      | CLI prompt tokens.              |
| `github_copilot_org_cli_avg_tokens_per_request` | Average tokens per CLI request. |

Pull-request metrics (emitted only when the report includes a pull-request section). The two `..._by_comment_type` metrics carry an additional `comment_type` label.

| Metric                                                                         | What it tracks                                              |
| ------------------------------------------------------------------------------ | ----------------------------------------------------------- |
| `github_copilot_org_pull_requests_created`                                     | Pull requests created.                                      |
| `github_copilot_org_pull_requests_reviewed`                                    | Pull requests reviewed.                                     |
| `github_copilot_org_pull_requests_merged`                                      | Pull requests merged.                                       |
| `github_copilot_org_pull_requests_reviewed_by_copilot`                         | Pull requests reviewed by Copilot.                          |
| `github_copilot_org_pull_requests_created_by_copilot`                          | Pull requests created by Copilot.                           |
| `github_copilot_org_pull_requests_copilot_suggestions`                         | Copilot review suggestions.                                 |
| `github_copilot_org_pull_requests_copilot_applied_suggestions`                 | Copilot review suggestions applied.                         |
| `github_copilot_org_pull_requests_suggestions`                                 | All review suggestions.                                     |
| `github_copilot_org_pull_requests_applied_suggestions`                         | All review suggestions applied.                             |
| `github_copilot_org_pull_requests_merged_created_by_copilot`                   | Merged pull requests created by Copilot.                    |
| `github_copilot_org_pull_requests_merged_reviewed_by_copilot`                  | Merged pull requests reviewed by Copilot.                   |
| `github_copilot_org_pull_requests_median_minutes_to_merge`                     | Median minutes to merge.                                    |
| `github_copilot_org_pull_requests_median_minutes_to_merge_copilot_authored`    | Median minutes to merge for Copilot-authored pull requests. |
| `github_copilot_org_pull_requests_median_minutes_to_merge_copilot_reviewed`    | Median minutes to merge for Copilot-reviewed pull requests. |
| `github_copilot_org_pull_requests_copilot_suggestions_by_comment_type`         | Copilot suggestions, by `comment_type`.                     |
| `github_copilot_org_pull_requests_copilot_applied_suggestions_by_comment_type` | Applied Copilot suggestions, by `comment_type`.             |

AI-adoption-phase distribution (one series per `phase`):

| Metric                                                              | What it tracks                                             |
| ------------------------------------------------------------------- | ---------------------------------------------------------- |
| `github_copilot_org_adoption_phase_engaged_users`                   | Engaged users in the phase.                                |
| `github_copilot_org_adoption_phase_avg_user_initiated_interactions` | Average user-initiated interactions per user in the phase. |
| `github_copilot_org_adoption_phase_avg_code_generation_activities`  | Average code-generation activities per user in the phase.  |
| `github_copilot_org_adoption_phase_avg_code_acceptance_activities`  | Average code-acceptance activities per user in the phase.  |
| `github_copilot_org_adoption_phase_avg_loc_added`                   | Average lines of code added per user in the phase.         |

### Organization breakdowns

Org totals sliced by dimension. Each metric carries the dimension label(s) shown.

| Metric                                                                  | Extra labels          |
| ----------------------------------------------------------------------- | --------------------- |
| `github_copilot_org_code_generation_activity_count_by_ide`              | `ide`                 |
| `github_copilot_org_code_acceptance_activity_count_by_ide`              | `ide`                 |
| `github_copilot_org_user_initiated_interaction_count_by_ide`            | `ide`                 |
| `github_copilot_org_loc_suggested_to_add_sum_by_ide`                    | `ide`                 |
| `github_copilot_org_loc_suggested_to_delete_sum_by_ide`                 | `ide`                 |
| `github_copilot_org_loc_added_sum_by_ide`                               | `ide`                 |
| `github_copilot_org_loc_deleted_sum_by_ide`                             | `ide`                 |
| `github_copilot_org_code_generation_activity_count_by_feature`          | `feature`             |
| `github_copilot_org_code_acceptance_activity_count_by_feature`          | `feature`             |
| `github_copilot_org_user_initiated_interaction_count_by_feature`        | `feature`             |
| `github_copilot_org_loc_suggested_to_add_sum_by_feature`                | `feature`             |
| `github_copilot_org_loc_suggested_to_delete_sum_by_feature`             | `feature`             |
| `github_copilot_org_loc_added_sum_by_feature`                           | `feature`             |
| `github_copilot_org_loc_deleted_sum_by_feature`                         | `feature`             |
| `github_copilot_org_code_generation_activity_count_by_language_feature` | `language`, `feature` |
| `github_copilot_org_code_acceptance_activity_count_by_language_feature` | `language`, `feature` |
| `github_copilot_org_loc_suggested_to_add_sum_by_language_feature`       | `language`, `feature` |
| `github_copilot_org_loc_suggested_to_delete_sum_by_language_feature`    | `language`, `feature` |
| `github_copilot_org_loc_added_sum_by_language_feature`                  | `language`, `feature` |
| `github_copilot_org_loc_deleted_sum_by_language_feature`                | `language`, `feature` |
| `github_copilot_org_user_initiated_interaction_count_by_model_feature`  | `model`, `feature`    |
| `github_copilot_org_code_generation_activity_count_by_model_feature`    | `model`, `feature`    |
| `github_copilot_org_loc_added_sum_by_model_feature`                     | `model`, `feature`    |

### Per-user activity

Per-user totals from the `users-1-day` report. Each metric carries the user identity labels described above.

| Metric                                                 | What it tracks                        |
| ------------------------------------------------------ | ------------------------------------- |
| `github_copilot_user_loc_suggested_to_add_sum`         | Lines of code suggested for addition. |
| `github_copilot_user_loc_suggested_to_delete_sum`      | Lines of code suggested for deletion. |
| `github_copilot_user_loc_added_sum`                    | Lines of code added.                  |
| `github_copilot_user_loc_deleted_sum`                  | Lines of code deleted.                |
| `github_copilot_user_code_generation_activity_count`   | Code-generation activities.           |
| `github_copilot_user_code_acceptance_activity_count`   | Code-acceptance activities.           |
| `github_copilot_user_user_initiated_interaction_count` | User-initiated interactions.          |

CLI sub-metrics (emitted only for users who used the CLI that day):

| Metric                                           | What it tracks                  |
| ------------------------------------------------ | ------------------------------- |
| `github_copilot_user_cli_session_count`          | CLI sessions.                   |
| `github_copilot_user_cli_request_count`          | CLI requests.                   |
| `github_copilot_user_cli_prompt_count`           | CLI prompts.                    |
| `github_copilot_user_cli_output_tokens_sum`      | CLI output tokens.              |
| `github_copilot_user_cli_prompt_tokens_sum`      | CLI prompt tokens.              |
| `github_copilot_user_cli_avg_tokens_per_request` | Average tokens per CLI request. |

### Per-user breakdowns

Per-user totals sliced by dimension. Each metric carries the user identity labels plus the dimension label(s) shown.

| Metric                                                                   | Extra labels          |
| ------------------------------------------------------------------------ | --------------------- |
| `github_copilot_user_code_generation_activity_count_by_ide`              | `ide`                 |
| `github_copilot_user_code_acceptance_activity_count_by_ide`              | `ide`                 |
| `github_copilot_user_user_initiated_interaction_count_by_ide`            | `ide`                 |
| `github_copilot_user_loc_suggested_to_add_sum_by_ide`                    | `ide`                 |
| `github_copilot_user_loc_suggested_to_delete_sum_by_ide`                 | `ide`                 |
| `github_copilot_user_loc_added_sum_by_ide`                               | `ide`                 |
| `github_copilot_user_loc_deleted_sum_by_ide`                             | `ide`                 |
| `github_copilot_user_code_generation_activity_count_by_feature`          | `feature`             |
| `github_copilot_user_code_acceptance_activity_count_by_feature`          | `feature`             |
| `github_copilot_user_user_initiated_interaction_count_by_feature`        | `feature`             |
| `github_copilot_user_loc_suggested_to_add_sum_by_feature`                | `feature`             |
| `github_copilot_user_loc_suggested_to_delete_sum_by_feature`             | `feature`             |
| `github_copilot_user_loc_added_sum_by_feature`                           | `feature`             |
| `github_copilot_user_loc_deleted_sum_by_feature`                         | `feature`             |
| `github_copilot_user_code_generation_activity_count_by_language_feature` | `language`, `feature` |
| `github_copilot_user_code_acceptance_activity_count_by_language_feature` | `language`, `feature` |
| `github_copilot_user_loc_suggested_to_add_sum_by_language_feature`       | `language`, `feature` |
| `github_copilot_user_loc_suggested_to_delete_sum_by_language_feature`    | `language`, `feature` |
| `github_copilot_user_loc_added_sum_by_language_feature`                  | `language`, `feature` |
| `github_copilot_user_loc_deleted_sum_by_language_feature`                | `language`, `feature` |
| `github_copilot_user_user_initiated_interaction_count_by_model_feature`  | `model`, `feature`    |
| `github_copilot_user_code_generation_activity_count_by_model_feature`    | `model`, `feature`    |
| `github_copilot_user_loc_added_sum_by_model_feature`                     | `model`, `feature`    |

### Team membership

A join-table metric whose value is always `1`. It exists so you can attribute per-user metrics to teams in queries (a user can appear in several teams, so there is one series per user↔team edge).

| Metric                                | Labels                                                                          | Value |
| ------------------------------------- | ------------------------------------------------------------------------------- | ----- |
| `github_copilot_user_team_membership` | `organization`, `user_login`, `team_slug`, `team_id`, `user_id` (when reported) | `1`   |

Teams with fewer than 5 Copilot users are omitted

GitHub excludes teams with fewer than 5 seated Copilot users from the `user-teams-1-day` report, so `github_copilot_user_team_membership` has **no series for those teams**. Their members' per-user activity still arrives (via the `users-1-day` report), but any team join built on the membership metric will not attribute it to those small teams — team-level totals under-count rather than the activity going missing. See GitHub's [team-level metrics reference](https://docs.github.com/en/copilot/reference/copilot-usage-metrics/team-level-metrics).

## Labels

| Label                  | On                                                                  | Meaning                                             |
| ---------------------- | ------------------------------------------------------------------- | --------------------------------------------------- |
| `organization`         | All metrics                                                         | The GitHub organization slug.                       |
| `user_login`           | Per-user and membership metrics                                     | The GitHub login.                                   |
| `user_id`              | Per-user and membership metrics (when reported)                     | Stable GitHub user ID — the preferred join key.     |
| `user_email`           | Per-user metrics (when resolvable)                                  | Organization-verified email.                        |
| `user_name`            | Per-user metrics (when resolvable)                                  | Display name.                                       |
| `sku`                  | Billing metrics                                                     | Billing SKU.                                        |
| `unit_type`            | Billing metrics                                                     | Billing unit, for example `ai-units` or `requests`. |
| `model`                | Billing premium-request rows and `..._by_model_feature` metrics     | Model name.                                         |
| `ide`                  | `..._by_ide` metrics                                                | IDE, for example `vscode`.                          |
| `feature`              | `..._by_feature`, `..._by_language_feature`, `..._by_model_feature` | Copilot feature, for example `code_completion`.     |
| `language`             | `..._by_language_feature` metrics                                   | Programming language.                               |
| `comment_type`         | `..._by_comment_type` pull-request metrics                          | Pull-request comment category.                      |
| `phase`                | `..._adoption_phase_*` metrics                                      | AI adoption phase.                                  |
| `team_slug`, `team_id` | `github_copilot_user_team_membership`                               | Team identifiers.                                   |

## Query examples

These metrics are gauges. Query them in **Metrics Explorer**, **Custom Dashboards**, or alerts using PromQL. Because each metric carries one sample per day, range queries chart a daily series directly.

### Common queries

Lines of code Copilot added across the organization, per day:

```promql
github_copilot_org_loc_added_sum{organization="my-org"}
```

Month-to-date net spend, broken down by model (premium requests):

```promql
sum by (model) (github_copilot_billing_net_amount{sku="copilot_premium_request"})
```

Organization-wide code acceptance rate (accepted ÷ generated):

```promql
github_copilot_org_code_acceptance_activity_count{organization="my-org"}
/
github_copilot_org_code_generation_activity_count{organization="my-org"}
```

Top 10 users by interactions on the latest report day. Wrap the daily gauge in `last_over_time(...[2d])` so the ranking resolves to the most recent daily sample whenever you run it — a bare instant query returns nothing outside Prometheus's 5-minute lookback window, since each series has one sample per day:

```promql
topk(10, last_over_time(github_copilot_user_user_initiated_interaction_count{organization="my-org"}[2d]))
```

Interactions by model and feature across the organization:

```promql
sum by (model, feature) (github_copilot_org_user_initiated_interaction_count_by_model_feature{organization="my-org"})
```

Weekly lines added — sum the seven daily samples (use `sum_over_time` for activity counts, never for the month-to-date `billing` metrics):

```promql
sum_over_time(github_copilot_org_loc_added_sum{organization="my-org"}[7d])
```

### Join per-user metrics to teams

The per-user metrics do not carry a team label — attribute them to teams by joining against `github_copilot_user_team_membership`, whose value is always `1`. Put the membership metric (the higher-cardinality side, since a user can be in several teams) on the **left** and use `group_left`. Join on `user_id`, the stable per-user key, scoped by `organization`:

```promql
sum by (team_slug) (
    github_copilot_user_team_membership
  * on (organization, user_id) group_left ()
    github_copilot_user_loc_added_sum
)
```

The same pattern aggregates any per-user metric per team — for example, interactions:

```promql
sum by (team_slug) (
    github_copilot_user_team_membership
  * on (organization, user_id) group_left ()
    github_copilot_user_user_initiated_interaction_count
)
```

To keep the per-user breakdown alongside the team instead of aggregating, drop the `sum`. The membership series already carries `team_slug`, `team_id`, and `user_login`, so the result keeps them; list any right-side identity labels you also want in `group_left`:

```promql
  github_copilot_user_team_membership
* on (organization, user_id) group_left (user_email, user_name)
  github_copilot_user_code_acceptance_activity_count
```

Joining when `user_id` is absent

`user_id` is present whenever GitHub reports it, on both the per-user and the membership series, so the keys align. For the rare user without a `user_id`, join on `user_login` instead — `on (organization, user_login)`.

### Join across breakdowns

Per-user breakdown metrics already carry their dimension labels, so you can attribute, for example, per-team lines added by IDE without any extra source:

```promql
sum by (team_slug, ide) (
    github_copilot_user_team_membership
  * on (organization, user_id) group_left ()
    github_copilot_user_loc_added_sum_by_ide
)
```

## Troubleshoot

##### **The integration was created but no organizations are tracked**

This means the Coralogix GitHub App is not installed on any organization your authorization can access, so there is nothing to collect. Install [`coralogix-copilot-observability`](https://github.com/apps/coralogix-copilot-observability) on at least one organization on a Copilot plan, then wait for the next daily collection.

##### **No data appears after setup**

GitHub publishes a day's report during the following day. The first data point arrives only after the next daily collection runs and GitHub has published the previous day's report. Confirm the Coralogix GitHub App is installed on the organization and that the organization is on a Copilot plan that exposes the metrics API.

##### **Per-user metrics have no `user_email` or `user_name` labels**

These labels come from the organization members listing. If the GitHub App installation lacks read access to organization members, collection still succeeds but per-user series carry only `user_login` (and `user_id`). Grant members read access to the installation to restore the labels.

##### **A metric is missing for some days**

Absent values are skipped, never emitted as `0`. If GitHub did not report a field for a day, no series exists for it. Treat a missing series as "not reported," not zero.
