-
Notifications
You must be signed in to change notification settings - Fork 328
[q] feat: add snazzy Python trending charts to Copilot Token Usage Analyzer (#24352) #24429
Description
Requested by @pelikhan in issue #24352.
What changed
Enhanced the Copilot Token Usage Analyzer workflow to generate Python-powered trending charts and embed them directly in the report issue.
New charts generated each run
| Chart | When | Description |
|---|---|---|
| 🔥 Top Consumers bar | Always | Horizontal Seaborn bar chart of the top-10 workflows by total token consumption |
| 📈 Daily trend line | ≥ 2 historical data points | Dual-axis line chart: total tokens (red) vs total runs (blue) over time |
| 🗓️ Workflow heatmap | ≥ 3 historical data points | YlOrRd colour-coded heatmap — top-8 workflows × recent dates |
Persistence / trending
Each run appends to cache-memory:
trending/token-usage/history.jsonl— daily aggregated totalstrending/token-usage/workflows.jsonl— per-workflow daily breakdown
Charts grow richer on every subsequent run as history accumulates.
Imports added
shared/charts-with-trending.md— pulls in the Python venv setup (numpy,pandas,matplotlib,seaborn,scipy), cache-memory integration, and trending best practicessafe-outputs: upload-asset— allows charts to be hosted and linked from the issue body
Compilation
✅ copilot-token-usage-analyzer.md — valid, no errors, no warnings
Files changed
-
.github/workflows/copilot-token-usage-analyzer.md -
.github/workflows/copilot-token-usage-analyzer.lock.yml(recompiled)
Warning
Protected Files — Push Permission Denied
This was originally intended as a pull request, but the patch modifies protected files. A human must create the pull request manually.
Protected files
The push was rejected because GitHub Actions does not have
workflowspermission to push these changes, and is never allowed to make such changes, or other authorization being used does not have this permission.
Create the pull request manually
# Download the patch from the workflow run
gh run download 23970325924 -n agent -D /tmp/agent-23970325924
# Create a new branch
git checkout -b q/add-python-trending-charts-24352-4167949b6dc0f5fc main
# Apply the patch (--3way handles cross-repo patches)
git am --3way /tmp/agent-23970325924/aw-q-add-python-trending-charts-24352.patch
# Push the branch and create the pull request
git push origin q/add-python-trending-charts-24352-4167949b6dc0f5fc
gh pr create --title '[q] feat: add snazzy Python trending charts to Copilot Token Usage Analyzer (#24352)' --base main --head q/add-python-trending-charts-24352-4167949b6dc0f5fc --repo github/gh-aw🎩 Equipped by Q · ● 922.5K · ◷
- expires on Apr 6, 2026, 3:33 AM UTC