Repository navigation
fix(gh-copilot): update Copilot metrics endpoints & schemas to latest… - #9002
bujjibabukatta wants to merge 5 commits into
Conversation
|
Hi @klesh could you please review and approve pull request? |
|
Hi @ewega could you please review and approve pull request. |
# Conflicts: # backend/plugins/gh-copilot/models/migrationscripts/register.go # backend/plugins/gh-copilot/models/models.go # backend/plugins/gh-copilot/models/user_metrics.go # backend/plugins/gh-copilot/tasks/register.go # backend/plugins/gh-copilot/tasks/report_download_helper.go # backend/plugins/gh-copilot/tasks/user_metrics_extractor.go
|
@klesh can you please merge pull request ? |
|
@bujjibabukatta Most tests are failing and the application does not compile when locally deployed. Can you please take a look? |
… migration, register AI-credit-usage tables, fix table count test
63e6a66 to
814cfe2
Compare
|
@ewega Thanks for flagging this. I've pushed changes that fix the failing tests and the compile issue. The QC checks don't seem to have triggered yet on the latest push — could you help re-trigger them (or approve the workflow run) when you get a chance? Happy to address anything else that comes up. |
|
Thanks for the contribution! The e2e-mysql and e2e-postgres checks still fail on the latest commit, and there have been no updates since August 20. The linked issue #8964 was also closed. Closing as stale. Feel free to reopen it, or open a new PR rebased on main once the e2e tests pass. |
Closes #8964
Summary
The
gh-copilotplugin pins the correct Copilot metrics API version(
2026-03-10) but is only partially implemented against it: severalresponse fields are dropped on extract, org-level rows lose their
identity, three endpoints aren't called at all, and a response-body
bug silently zeroes out both the enterprise and user report collectors.
Bugfixes
Double-read bug (2 occurrences).
parseRawReportResponseandparseUserMetricsReportResponseeach readres.Bodyonce directly,then again inside
parseReportMetadataResponse. The second readalways came back empty, so
metawas alwaysniland everyenterprise/user report was silently discarded — no error, no rows.
Fixed by reading once in both places.
Org identity.
ExtractOrgMetricshardcodedEnterpriseId: ""andnever set
OrganizationId, so org-level rows in the shared dailymetrics table had no identity of their own. Now stamps
OrganizationIdfrom the report (falling back to the connection'sconfigured org), and passes
EnterpriseIdthrough instead of forcingit blank.
Field gaps
daily/weekly/monthly_active_copilot_cloud_agent_usersused_copilot_coding_agent,used_copilot_cloud_agentai_adoption_phase/totals_by_ai_adoption_phase_tool_copilot_metrics_by_ai_adoption_phasetablepull_requests.copilot_suggestions_by_comment_typetotals_by_cli.last_known_cli_version,.avg_tokens_per_requestCopilotCliMetricsai_adoption_phasefield names (including the 2026-07-07 review-cyclefields and 2026-06-26
total_pull_requests_merged) were checkedagainst GitHub's changelog posts.
Missing endpoints
Implements
enterprise-28-day/latest,organization-28-day/latest,users-28-day/latest. These are single "latest" snapshot calls (noday param, unlike the -1-day reports) whose payload wraps entries in
a
day_totals[]array. Reuses the existingenterpriseDayTotal/userDailyReportshapes for the entries; writes to new, separatetables so this cadence can't silently overwrite -1-day rows for the
same
(connection, scope, day). Per-IDE/feature/language breakdownsare out of scope for 28-day data in this pass — the -1-day breakdowns
already cover those dimensions.
Migrations
20260720_add_copilot_metrics_gaps_v2.go— new columns + AIadoption phase table
20260720_add_copilot_28day_reports.go— the two new 28-day tablesMigration struct field names were cross-checked against the real
model structs field-by-field to make sure
AutoMigrateTablestargetsthe right columns.
Testing
go build ./plugins/gh-copilot/...go vet ./plugins/gh-copilot/...go test ./plugins/gh-copilot/...non-empty daily metrics tables (regression test for the
double-read bug)
day_totals[]shape against a real 28-day report response