DEV Community

Cover image for Mastering GitHub Copilot Metrics: Adapting to the New API for Enhanced Software Project Tracking
Oleg
Oleg

Posted on

Mastering GitHub Copilot Metrics: Adapting to the New API for Enhanced Software Project Tracking

In the fast-paced world of software development, understanding developer activity and the return on investment (ROI) from powerful AI-driven tools like GitHub Copilot is no longer a luxury—it's a necessity for effective software project tracking. For many organizations, this means integrating usage metrics into internal dashboards, often powered by tools like Power BI. A recent discussion on the GitHub Community forum highlighted a significant upcoming change to how these metrics are accessed, causing understandable concern among users relying on the existing API structure.

The core of the issue, as raised by sftong2000, is the impending sunset of the old GitHub Enterprise Copilot usage metrics API (https://api.github.com/enterprises/<enterprise>/copilot/metrics) on April 2, 2026. This API previously returned direct JSON data, making integration relatively straightforward. The new API, documented at GitHub Docs, introduces a fundamentally different approach.

The Impending Shift: Navigating the New GitHub Copilot Metrics API

The transition isn't just a URL change; it's a fundamental shift in how data is delivered. Key differences include:

  • Usage Window: The reporting period has shifted from the last 90 days to a more focused 28-day window. This means more granular, recent data, but also requires adjusting historical trend analysis.

  • Data Delivery: Instead of direct JSON data within the API response, the new API (https://api.github.com//enterprises/{enterprise}/copilot/metrics/reports/enterprise-28-day/latest) returns an object containing download_links to separate report files.

The original poster shared an example of the new API response, illustrating the change:

{
"download_links": [
"https://example.com/copilot-usage-report-1.json",
"https://example.com/copilot-usage-report-2.json"
],
"report_start_day": "2025-07-01",
"report_end_day": "2025-07-28"
}
The primary pain point identified was the lack of clarity on the schema of these linked reports and the effort required to re-engineer existing git reporting solutions. Fortunately, fellow community members quickly stepped in with crucial insights and solutions.

Diagram showing the new GitHub Copilot API workflow: API call returns download links, NDJSON files are downloaded and processed line by line.Diagram showing the new GitHub Copilot API workflow: API call returns download links, NDJSON files are downloaded and processed line by line.

Unpacking the New Reality: NDJSON and Your Action Plan

The key insight, provided by midiakiasat and Yigtwxx, is that the files behind the download_links are not standard JSON arrays or objects, but rather NDJSON (Newline-Delimited JSON). This means each line in the downloaded file is an independent JSON object. The schema for these individual objects is consistently documented in GitHub's "Data available in Copilot usage metrics" → "API and export fields" section.

For dev teams, product managers, and CTOs looking to maintain robust software project tracking, here's a confident, step-by-step action plan to adapt your Copilot usage reports:

Step 1: Call the New API Endpoint

Initiate a GET request to /enterprises/{enterprise}/copilot/metrics/reports/enterprise-28-day/latest. This will provide you with an object containing download_links, report_start_day, and report_end_day. Remember that these download links are signed URLs and will expire, so plan to use them promptly after retrieval.

Step 2: Download the NDJSON Report Files

Iterate through each URL provided in the download_links array. Download these files. Be aware that standard JSON parsers will likely fail if you try to parse the entire file as a single JSON entity.

Step 3: Process the NDJSON Data

This is where the format change requires a new approach:

  • In Power Query (Power BI): When importing these files, you'll need to split the data line by line using a newline delimiter. Each line can then be parsed as a separate JSON record. Power Query's flexible data transformation capabilities are well-suited for this.

  • Using Scripts (Python/Pandas): For more programmatic control, Python with the Pandas library offers a streamlined solution. The command pandas.read_json('filename.json', lines=True) can directly convert an NDJSON file into a structured DataFrame, making subsequent data manipulation straightforward.

Step 4: Understand the Data Schema

The schema for the data within each NDJSON line is explicitly defined in the GitHub documentation under "API and export fields." Do not assume a "report-1" versus "report-2" schema difference; both are NDJSON exports using the same documented fields. This ensures consistency as you append data from multiple files.

Step 5: Rebuild and Refine Your Power BI Model

Once you've parsed and appended all the records from the downloaded NDJSON files, you'll have a consolidated dataset for the 28-day period. You can then integrate this into your existing Power BI data model, adjusting for the new 28-day window and any changes in field availability or interpretation. This is an opportunity to optimize your git reporting for better performance and accuracy.

Power BI Power Query interface transforming NDJSON data into a structured table for reporting.Power BI Power Query interface transforming NDJSON data into a structured table for reporting.

Why This Matters: Strategic Insights for Technical Leadership

For CTOs, delivery managers, and product leaders, this API change isn't just a technical hurdle; it's a reminder of the dynamic nature of developer tooling and the critical need for agile data infrastructure. Accurate and timely Copilot usage metrics are invaluable for:

  • Quantifying ROI: Justifying the investment in AI-assisted coding tools by demonstrating tangible productivity gains and code quality improvements.

  • Optimizing Resource Allocation: Understanding where Copilot is most effective can inform training strategies and resource deployment, aligning with broader software development OKRs.

  • Enhancing Developer Experience: Identifying patterns of Copilot adoption and usage helps tailor support and maximize its benefits across the team.

  • Proactive Delivery Management: Integrating these metrics into your overall software project tracking dashboards provides a holistic view of project health and team velocity, enabling more informed decision-making.

Embracing these changes quickly ensures that your organization maintains continuous visibility into developer productivity and the impact of your tooling investments. It reinforces the importance of robust data pipelines that can adapt to evolving API standards, safeguarding your ability to make data-driven decisions.

Conclusion

While the transition to GitHub Copilot's new usage metrics API presents a re-engineering challenge, the community has provided clear guidance for a smooth migration. By understanding NDJSON and adjusting your data ingestion workflows, your organization can continue to leverage these vital metrics for enhanced software project tracking, informed technical leadership, and optimized developer productivity. Don't let an API change disrupt your insights; adapt, overcome, and continue to build smarter.

Top comments (0)