|
19 | 19 | |1.5| Add daily usage history for each user, old version upgrade guide refer to [this issue](https://github.com/satomic/copilot-usage-advanced-dashboard/issues/10) | 20250404 | |
20 | 20 | |1.6| refactor timezone handling in main.py & Docker run ENV paras |20250410| |
21 | 21 | |1.7| [Add Elasticsearch authentication](https://github.com/satomic/copilot-usage-advanced-dashboard/pull/19) |20250411| |
| 22 | +|1.8| **User Metrics Analytics Module**: Added 5th data source with user adoption leaderboard, Top 10 visualization, hourly automation, and production-ready deployment |20251120| |
22 | 23 |
|
23 | 24 | ## Table of contents |
24 | 25 |
|
| 26 | +- [🚀 Quick Start](#-quick-start-5-minutes) |
25 | 27 | - [Introduction](#Introduction) |
26 | 28 | - [Online Demo Environment ✨](#Online-Demo-Environment) |
27 | 29 | - [Copilot Usage Advanced Dashboard](#Copilot-Usage-Advanced-Dashboard) |
|
36 | 38 | - [5. Copilot Chat](#5-Copilot-Chat) |
37 | 39 | - [6. Seat Analysis](#6-Seat-Analysis) |
38 | 40 | - [7. Breakdown Heatmap](#7-Breakdown-Heatmap) |
| 41 | + - [8. User Metrics Analytics](#8-User-Metrics-Analytics) |
39 | 42 | - [Copilot Usage Advanced Dashboard Original](#Copilot-Usage-Advanced-Dashboard-Original) |
40 | 43 | - [1. Copilot Seat Info & Top Languages](#1-Copilot-Seat-Info--Top-Languages) |
41 | 44 | - [2. Copilot Usage Total Insight](#2-Copilot-Usage-Total-Insight) |
|
48 | 51 |
|
49 | 52 | --- |
50 | 53 |
|
| 54 | +## 🚀 Quick Start (5 Minutes) |
| 55 | + |
| 56 | +### Prerequisites |
| 57 | +- Docker Desktop installed ([Download](https://www.docker.com/products/docker-desktop)) |
| 58 | +- GitHub Personal Access Token with `manage_billing:copilot` scope ([Create Token](https://github.com/settings/tokens)) |
| 59 | +- Your GitHub Organization/Enterprise slug |
| 60 | + |
| 61 | +### Setup Steps |
| 62 | + |
| 63 | +1. **Clone the repository** |
| 64 | +```bash |
| 65 | +git clone https://github.com/satomic/copilot-usage-advanced-dashboard.git |
| 66 | +cd copilot-usage-advanced-dashboard |
| 67 | +``` |
| 68 | + |
| 69 | +2. **Configure environment** |
| 70 | +```bash |
| 71 | +cp .env.template .env |
| 72 | +# Edit .env file with your GitHub PAT and organization slug |
| 73 | +``` |
| 74 | + |
| 75 | +Minimal required configuration: |
| 76 | +```env |
| 77 | +GITHUB_PAT=ghp_your_token_here |
| 78 | +ORGANIZATION_SLUGS=your-org-name |
| 79 | +``` |
| 80 | + |
| 81 | +3. **Start the dashboard** |
| 82 | +```bash |
| 83 | +docker-compose up -d |
| 84 | +``` |
| 85 | + |
| 86 | +4. **Access Grafana** |
| 87 | +- URL: **http://localhost:8080** |
| 88 | +- Username: `admin` |
| 89 | +- Password: `copilot` |
| 90 | +- ✨ Dashboard loads automatically - no manual import needed! |
| 91 | + |
| 92 | +### What Happens Automatically |
| 93 | +✅ Elasticsearch starts and creates 7 indexes |
| 94 | +✅ Grafana starts with pre-configured datasources |
| 95 | +✅ Dashboard provisions automatically from `/grafana-provisioning/dashboards/` |
| 96 | +✅ `cpuad-updater` fetches data from 5 GitHub APIs every hour |
| 97 | +✅ User metrics populate in "User Metrics" row (9 panels) |
| 98 | +✅ System self-heals if any container crashes |
| 99 | + |
| 100 | +### Environment Variables |
| 101 | + |
| 102 | +| Variable | Required | Description | Default | |
| 103 | +|----------|----------|-------------|---------| |
| 104 | +| `GITHUB_PAT` | ✅ Yes | GitHub Personal Access Token | - | |
| 105 | +| `ORGANIZATION_SLUGS` | ✅ Yes | Comma-separated org slugs | - | |
| 106 | +| `ELASTICSEARCH_URL` | No | Elasticsearch endpoint | `http://elasticsearch:9200` | |
| 107 | +| `EXECUTION_INTERVAL_HOURS` | No | Data fetch frequency (hours) | `1` | |
| 108 | +| `INDEX_USER_METRICS` | No | User metrics index name | `copilot_user_metrics` | |
| 109 | +| `INDEX_USER_ADOPTION` | No | Adoption leaderboard index | `copilot_user_adoption` | |
| 110 | + |
| 111 | +--- |
51 | 112 |
|
52 | 113 | # Introduction |
53 | 114 |
|
|
57 | 118 | - [Get a summary of Copilot metrics for a team](https://docs.github.com/en/enterprise-cloud@latest/rest/copilot/copilot-metrics?apiVersion=2022-11-28#get-copilot-metrics-for-a-team) |
58 | 119 | - [Get Copilot seat information and settings for an organization](https://docs.github.com/en/enterprise-cloud@latest/rest/copilot/copilot-user-management?apiVersion=2022-11-28#get-copilot-seat-information-and-settings-for-an-organization) |
59 | 120 | - [List all Copilot seat assignments for an organization](https://docs.github.com/en/enterprise-cloud@latest/rest/copilot/copilot-user-management?apiVersion=2022-11-28#list-all-copilot-seat-assignments-for-an-organization) |
| 121 | +- [**NEW in v1.8** - Get Copilot User Metrics (28-day rolling window)](https://docs.github.com/en/enterprise-cloud@latest/rest/copilot/copilot-usage?apiVersion=2022-11-28#get-a-summary-of-copilot-user-metrics) |
60 | 122 |
|
61 | 123 | representing Copilot usage in multi organizations & teams from different dimensions. The features are summarized as follows: |
62 | 124 | - Data is persisted in Elasticsearch and visualized in Grafana, **not just the past 28 days**. So you can freely choose the time period you want to visualize, such as the past year or a specific month. |
@@ -197,7 +259,57 @@ The choice of variables is dynamically associated with the data display |
197 | 259 |
|
198 | 260 |  |
199 | 261 |
|
200 | | -## Copilot Usage Advanced Dashboard Original |
| 262 | +### 8. User Metrics Analytics |
| 263 | + |
| 264 | +> **NEW in v1.8**: Complete user-level analytics powered by GitHub Copilot User Metrics API. Track individual user adoption, engagement patterns, and feature utilization with automated hourly updates. |
| 265 | +
|
| 266 | +Based on the data from [Get Copilot User Metrics](https://docs.github.com/en/enterprise-cloud@latest/rest/copilot/copilot-usage?apiVersion=2022-11-28#get-a-summary-of-copilot-user-metrics), this module provides comprehensive per-user analytics including: |
| 267 | + |
| 268 | +**Key Metrics:** |
| 269 | +- **Total Users** = `cardinality(user_login)` - Unique users with Copilot activity |
| 270 | +- **Total Suggestions** = `sum(code_generation_activity_count)` - Code suggestions generated across all users |
| 271 | +- **Total Acceptances** = `sum(code_acceptance_activity_count)` - Code suggestions accepted by users |
| 272 | +- **Acceptance Rate** = `sum(code_acceptance_activity_count) / sum(code_generation_activity_count)` - Overall acceptance percentage |
| 273 | +- **Active Days** = `cardinality(day)` - Distinct days each user engaged with Copilot |
| 274 | +- **Adoption Score** = `(active_days / total_days_in_period) × 100` - User engagement percentage |
| 275 | + |
| 276 | +**Per-User Analytics Table:** |
| 277 | +- User-initiated Interactions = `sum(user_initiated_interaction_count)` |
| 278 | +- Code Suggestions Generated = `sum(code_generation_activity_count)` |
| 279 | +- Code Suggestions Accepted = `sum(code_acceptance_activity_count)` |
| 280 | +- Average LOC Suggested = `avg(loc_suggested_to_add_sum)` |
| 281 | +- Average LOC Added = `avg(loc_added_sum)` |
| 282 | +- Agent Usage = `sum(used_agent)` - Copilot Agent feature usage count |
| 283 | +- Chat Usage = `sum(used_chat)` - Copilot Chat feature usage count |
| 284 | +- Active Days = `cardinality(day)` - Days with any Copilot activity |
| 285 | + |
| 286 | +**Top 10 Copilot Users Leaderboard:** |
| 287 | +- Visualizes top 10 users by adoption percentage |
| 288 | +- Color-coded gradient from red (low adoption) to blue (high adoption) |
| 289 | + - 🔴 Red (0-40%): Needs attention |
| 290 | + - 🟠 Orange (40-60%): Moderate usage |
| 291 | + - 🟡 Yellow (60-80%): Good engagement |
| 292 | + - 🟢 Green (80-95%): Excellent adoption |
| 293 | + - 🔵 Blue (95-100%): Power user |
| 294 | + |
| 295 | +**Automated Data Collection:** |
| 296 | +- Runs every hour (configurable via `EXECUTION_INTERVAL_HOURS`) |
| 297 | +- Fetches 28-day rolling window data from GitHub API |
| 298 | +- Calculates adoption scores automatically |
| 299 | +- Stores in 2 Elasticsearch indexes: `copilot_user_metrics` (raw data) and `copilot_user_adoption` (leaderboard scores) |
| 300 | +- No manual intervention required |
| 301 | + |
| 302 | + |
| 303 | + |
| 304 | +**Use Cases:** |
| 305 | +- Identify power users and champions for Copilot evangelism |
| 306 | +- Track onboarding progress for new Copilot users |
| 307 | +- Spot users who need additional training or support |
| 308 | +- Measure team-level adoption trends over time |
| 309 | +- Monitor Chat and Agent feature adoption rates |
| 310 | +- Correlate active days with productivity metrics |
| 311 | + |
| 312 | + |
201 | 313 |
|
202 | 314 | ### 1. Copilot Seat Info & Top Languages |
203 | 315 |
|
|
0 commit comments