Add Copilot metrics and billing collection guide#39
Merged
Conversation
… 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.
Contributor
There was a problem hiding this comment.
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
- 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Testing