PankajChaudhari-Atos opened a new pull request, #9019:
URL: https://github.com/apache/devlake/pull/9019
### Summary
This PR bundles two related gh-copilot changes (18 files):
1. **feat: AI credit usage billing metrics** (ports apache/devlake#8980)
Adds collection/extraction of GitHub Copilot AI credit usage billing
metrics at org, user, and enterprise levels — new models, tasks
(`ai_credit_collector`/`ai_credit_extractor`), a migration for the new
billing tables, and e2e snapshot fixtures.
2. **fix: report-body double-read zeroing Copilot user/enterprise metrics**
`parseUserMetricsReportResponse` and `parseRawReportResponse` read the
HTTP response body once (via `io.ReadAll`) and then called
`parseReportMetadataResponse(res, ...)`, which re-read the
already-consumed
body. The second read returned empty → "Report metadata response was
empty,
skipping" → 0 records, silently zeroing user and enterprise Copilot
metrics
(org metrics were unaffected because that path reads the body once
inline).
Fix: parse the already-read `body` via `parseReportMetadata(body, logger)`
and drop the redundant re-read.
### Testing
- `go build ./plugins/gh-copilot/...`, `go vet`, and `go test
./plugins/gh-copilot/models/...` pass.
- Behavioral validation on a live deployment: before the fix, user-metrics
collection logged "empty, skipping" and produced 0 rows; after the fix, it
downloads report files and populates `_raw_copilot_user_metrics` and
`_tool_copilot_user_daily_metrics`.
### Notes
- Commits are DCO signed-off; PR #8980 authorship credited via
`Co-authored-by`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]