Skip to content

Add Copilot metrics and billing collection guide#39

Merged
samqbush merged 2 commits into
mainfrom
billing-usage-metrics
Jun 23, 2026
Merged

Add Copilot metrics and billing collection guide#39
samqbush merged 2 commits into
mainfrom
billing-usage-metrics

Conversation

@samqbush

Copy link
Copy Markdown
Owner

Summary

  • add a new Copilot metrics and billing guide for admins
  • add example scripts to pull usage metrics and billing exports daily into a data lake
  • document GitHub App and billing PAT setup for the required auth flows

Testing

  • bash -n on the new shell scripts
  • verified the new guide links and docs URLs

… data

- Created `copilot-metrics-billing.md` to document the process of pulling usage metrics and billing data into a data lake.
- Added `README.md` in the `copilot-metrics-billing` directory to describe the provided scripts for collecting metrics.
- Introduced `enterprise-setup.md` for one-time setup instructions for the GitHub App and billing PAT.
- Implemented `collect-daily.sh` to orchestrate daily data collection for usage and billing metrics.
- Developed `copilot-billing-export.sh` for exporting billing data via the bulk CSV report.
- Created `copilot-usage-metrics.sh` to pull daily usage metrics and output them as JSON.
- Added `generate-installation-token.sh` to generate a GitHub App installation token from a private key.
Copilot AI review requested due to automatic review settings June 22, 2026 23:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new admin-facing guide and companion shell scripts to collect Copilot usage metrics and billing exports on a daily schedule, aimed at landing both datasets into a customer-managed data lake for longer retention and reporting.

Changes:

  • Adds a new “Copilot metrics & billing into your data lake” documentation page and links it from the site index.
  • Introduces example scripts to (1) pull Copilot usage metrics reports, (2) export billing CSV reports, and (3) orchestrate both as a daily job.
  • Documents one-time setup for the required auth flows (Enterprise GitHub App for metrics + classic PAT for billing).
Show a summary per file
File Description
index.md Adds navigation entry for the new metrics/billing guide page.
copilot-metrics-billing.md New end-to-end guide describing the two domains (usage vs billing), required credentials, endpoints, and daily run model.
copilot-metrics-billing/README.md Documents the scripts, tradeoffs, and usage examples for metrics + billing collection.
copilot-metrics-billing/enterprise-setup.md Step-by-step setup for the Enterprise GitHub App and billing PAT needed by the scripts.
copilot-metrics-billing/scripts/generate-installation-token.sh Helper script to mint GitHub App installation tokens for metrics API access.
copilot-metrics-billing/scripts/copilot-usage-metrics.sh Fetches usage metrics report metadata + downloads NDJSON report output as JSON.
copilot-metrics-billing/scripts/copilot-billing-export.sh Creates/polls/downloads Copilot billing usage report exports as CSV.
copilot-metrics-billing/scripts/collect-daily.sh Orchestrates daily usage + billing pulls and writes files into an output directory for downstream sync.

Copilot's findings

  • Files reviewed: 8/8 changed files
  • Comments generated: 2

Comment thread copilot-metrics-billing/scripts/copilot-usage-metrics.sh Outdated
Comment thread copilot-metrics-billing/scripts/copilot-billing-export.sh
- Stream the usage-metrics report download directly into jq instead of
  buffering it in a shell variable and re-emitting via echo
- Build the billing report POST payload with jq and send Content-Type:
  application/json to avoid broken JSON / body injection

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@samqbush samqbush merged commit 62af5f3 into main Jun 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants