Skip to content

[Feature][Plugin] Add Python Plugin for GitHub Copilot Enterprise & User Usage MetricsΒ #8664

@ansri-abodey

Description

@ansri-abodey

Search before asking

  • I had searched in the issues and found no similar feature requirement.

Use case

Search before asking

  • I had searched in the issues and found no similar feature requirement.

Description

I would like to contribute a new plugin to DevLake that ingests GitHub Copilot Usage Metrics.

To fully understand the impact of AI on our development lifecycle, we need both high-level adoption trends and granular user-level data. I plan to use the Copilot Usage Metrics API (2022-11-28) to collect this data.

Strategic Value: Why Measure This?

Integrating Copilot metrics allows us to answer critical questions about the ROI of AI coding assistants by correlating them with existing DORA and engineering metrics:

  1. Velocity & Lead Time:
    • Hypothesis: High Copilot usage (acceptance rates) should reduce Lead Time for Changes by speeding up the "coding" phase.
    • Metric: Correlate total_lines_accepted with PR Cycle Time.
  2. Quality & Stability:
    • Hypothesis: We need to monitor if increased AI speed impacts code quality.
    • Metric: Correlate copilot_active_users with Change Failure Rate (CFR) and Bug Count.
  3. Adoption vs. Performance:
    • Hypothesis: Teams with higher Copilot adoption perform better.
    • Metric: Compare Deployment Frequency between high-adoption and low-adoption teams (using the User-level breakdown).

Data Sources

I will target the following two report endpoints:

  1. Enterprise Metrics (Aggregated)

    • Endpoint: GET /enterprises/{enterprise}/copilot/metrics/reports/enterprise-1-day
    • Purpose: Provides high-level daily summaries of active users, acceptance rates, and chat interactions across the entire enterprise.
    • Docs: Get Copilot enterprise usage metrics
  2. User Metrics (Granular)

    • Endpoint: GET /enterprises/{enterprise}/copilot/metrics/reports/users-1-day
    • Purpose: Provides detailed usage stats per user (e.g., lines suggested vs. accepted, editor used, last activity). This allows for correlation with individual developer output.
    • Docs: Get Copilot users usage metrics

Note: I will use the *-1-day endpoints to allow DevLake to incrementally collect and store daily historical data.

Implementation Plan

I propose implementing this as a Python Plugin using the pydevlake framework.

Proposed Scope:

  1. Create a new Python plugin copilot.
  2. Stream 1: CopilotEnterpriseMetricsStream:
    • Fetches the daily enterprise report URL.
    • Downloads and parses the JSON to store daily aggregated stats.
  3. Stream 2: CopilotUserMetricsStream:
    • Fetches the daily user report URL.
    • Downloads and parses the JSON to store individual user activity.

Questions for Maintainers

  1. Domain Modeling:
    • Should the Enterprise Metrics map to a new table (e.g., copilot_enterprise_daily)?
    • Should the User Metrics map to a new table (e.g., copilot_user_daily)?### Search before asking
  • I had searched in the issues and found no similar feature requirement.

Description

I would like to contribute a new plugin to DevLake that ingests GitHub Copilot Usage Metrics.

To fully understand the impact of AI on our development lifecycle, we need both high-level adoption trends and granular user-level data. I plan to use the Copilot Usage Metrics API (2022-11-28) to collect this data.

Strategic Value: Why Measure This?

Integrating Copilot metrics allows us to answer critical questions about the ROI of AI coding assistants by correlating them with existing DORA and engineering metrics:

  1. Velocity & Lead Time:
    • Hypothesis: High Copilot usage (acceptance rates) should reduce Lead Time for Changes by speeding up the "coding" phase.
    • Metric: Correlate total_lines_accepted with PR Cycle Time.
  2. Quality & Stability:
    • Hypothesis: We need to monitor if increased AI speed impacts code quality.
    • Metric: Correlate copilot_active_users with Change Failure Rate (CFR) and Bug Count.
  3. Adoption vs. Performance:
    • Hypothesis: Teams with higher Copilot adoption perform better.
    • Metric: Compare Deployment Frequency between high-adoption and low-adoption teams (using the User-level breakdown).

Data Sources

I will target the following two report endpoints:

  1. Enterprise Metrics (Aggregated)

    • Endpoint: GET /enterprises/{enterprise}/copilot/metrics/reports/enterprise-1-day
    • Purpose: Provides high-level daily summaries of active users, acceptance rates, and chat interactions across the entire enterprise.
    • Docs: Get Copilot enterprise usage metrics
  2. User Metrics (Granular)

    • Endpoint: GET /enterprises/{enterprise}/copilot/metrics/reports/users-1-day
    • Purpose: Provides detailed usage stats per user (e.g., lines suggested vs. accepted, editor used, last activity). This allows for correlation with individual developer output.
    • Docs: Get Copilot users usage metrics

Note: I will use the *-1-day endpoints to allow DevLake to incrementally collect and store daily historical data.

Implementation Plan

I propose implementing this as a Python Plugin using the pydevlake framework.

Proposed Scope:

  1. Create a new Python plugin copilot.
  2. Stream 1: CopilotEnterpriseMetricsStream:
    • Fetches the daily enterprise report URL.
    • Downloads and parses the JSON to store daily aggregated stats.
  3. Stream 2: CopilotUserMetricsStream:
    • Fetches the daily user report URL.
    • Downloads and parses the JSON to store individual user activity.

Questions for Maintainers

  1. Domain Modeling:
    • Should the Enterprise Metrics map to a new table (e.g., copilot_enterprise_daily)?
    • Should the User Metrics map to a new table (e.g., copilot_user_daily)?

Description

No response

Related issues

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    add-a-pluginThis issue is to add a plugincomponent/pydevlakeRelates to the Python framework and/or plugin.priority/highThis issue is very importanttype/feature-requestThis issue is a proposal for something new

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions