Skip to main content

Extract Azure DevOps Pull Request metrics to SQLite and generate PowerBI-compatible CSVs.

Project description

ado-git-repo-insights

CI codecov Python License

Extract Azure DevOps Pull Request metrics to SQLite and generate PowerBI-compatible CSVs.

Overview

This tool replaces the MongoDB-based ado-pull-request-metrics with a lightweight, file-based solution that:

  • Stores data in SQLite - No external database required
  • Runs as an Azure DevOps Pipeline Task - Scheduled daily extraction
  • Preserves the PowerBI CSV contract - Same filenames, columns, and ordering
  • Supports incremental + backfill extraction - Efficient daily updates with periodic convergence

Quick Start

Installation

pip install ado-git-repo-insights

Usage Options

This tool provides two ways to extract Azure DevOps Pull Request metrics:

Aspect CLI (Option 1) Extension (Option 2)
Requires Python Yes No (bundled)
Installation pip install Upload VSIX to ADO
Pipeline syntax Script steps Task step
Works outside ADO Yes No (ADO only)
Flexibility Higher Standard

Option 1: Python CLI

Best for users comfortable with Python/pip, custom scripts, and non-ADO CI/CD systems.

First Run (Extract Data)

ado-insights extract \
  --organization MyOrg \
  --projects "ProjectOne,ProjectTwo" \
  --pat $ADO_PAT \
  --database ./ado-insights.sqlite

Note: End date defaults to yesterday (to avoid incomplete data). Include today: --end-date $(date +%Y-%m-%d) (Bash) or --end-date (Get-Date -Format yyyy-MM-dd) (PowerShell)

Generate CSVs

ado-insights generate-csv \
  --database ./ado-insights.sqlite \
  --output ./csv_output

Backfill Mode (Weekly Convergence)

ado-insights extract \
  --organization MyOrg \
  --projects "ProjectOne,ProjectTwo" \
  --pat $ADO_PAT \
  --database ./ado-insights.sqlite \
  --backfill-days 60

Option 2: Azure DevOps Extension

Best for teams that prefer the ADO pipeline editor UI or want a self-contained task without managing Python dependencies.

steps:
  - task: ExtractPullRequests@1
    inputs:
      organization: 'MyOrg'
      projects: 'Project1,Project2'
      pat: '$(PAT_SECRET)'
      database: '$(Pipeline.Workspace)/data/ado-insights.sqlite'
      outputDir: '$(Pipeline.Workspace)/csv_output'

Installation:

  1. Download the .vsix from GitHub Releases
  2. Install in your ADO organization: Organization Settings → Extensions → Browse local extensions

Configuration

Create a config.yaml file:

organization: MyOrg

projects:
  - ProjectOne
  - ProjectTwo
  - Project%20Three  # URL-encoded names supported

api:
  base_url: https://dev.azure.com
  version: 7.1-preview.1
  rate_limit_sleep_seconds: 0.5
  max_retries: 3
  retry_delay_seconds: 5
  retry_backoff_multiplier: 2.0

backfill:
  enabled: true
  window_days: 60

Then run:

ado-insights extract --config config.yaml --pat $ADO_PAT

Azure DevOps Pipeline Integration

See sample-pipeline.yml for a complete example.

Scheduled Daily Extraction

schedules:
  - cron: "0 6 * * *"  # Daily at 6 AM UTC
    displayName: "Daily PR Extraction"
    branches:
      include: [main]
    always: true

Weekly Backfill

schedules:
  - cron: "0 6 * * 0"  # Weekly on Sunday
    displayName: "Weekly Backfill"
    branches:
      include: [main]
    always: true

CSV Output Contract

The following CSVs are generated with exact schema and column order for PowerBI compatibility:

File Columns
organizations.csv organization_name
projects.csv organization_name, project_name
repositories.csv repository_id, repository_name, project_name, organization_name
pull_requests.csv pull_request_uid, pull_request_id, organization_name, project_name, repository_id, user_id, title, status, description, creation_date, closed_date, cycle_time_minutes
users.csv user_id, display_name, email
reviewers.csv pull_request_uid, user_id, vote, repository_id

Security & Permissions

PR Insights Dashboard (Phase 3)

The PR Insights dashboard reads data from pipeline-produced artifacts. Users must have Build Read permission on the analytics pipeline to view dashboard data.

Requirement Details
Permission scope Build → Read on the pipeline that produces artifacts
No special redaction Data is not filtered per-user; access is all-or-nothing
Artifact retention Operators must configure retention for their desired analytics window

If a user lacks permissions, the dashboard displays: "No access to analytics pipeline artifacts. Ask an admin for Build Read on pipeline X."

Governance

This project is governed by authoritative documents in agents/:

Development

# Setup
python -m venv .venv
source .venv/bin/activate  # or .venv\Scripts\activate on Windows
pip install -e .[dev]

# Lint + Format
ruff check .
ruff format .

# Type Check
mypy src/

# Test
pytest

License

MIT

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ado_git_repo_insights-2.2.0.tar.gz (514.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ado_git_repo_insights-2.2.0-py3-none-any.whl (35.1 kB view details)

Uploaded Python 3

File details

Details for the file ado_git_repo_insights-2.2.0.tar.gz.

File metadata

  • Download URL: ado_git_repo_insights-2.2.0.tar.gz
  • Upload date:
  • Size: 514.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ado_git_repo_insights-2.2.0.tar.gz
Algorithm Hash digest
SHA256 4f511e8443df029ab5b743ac48373fa53b2e989bd64d13c5232b81db31a66e6b
MD5 696c9cda518b41934712cf6be429dfd3
BLAKE2b-256 01c6778f7e82544a42e730d16d15e91b9eafddfa389870eaa6dd33a458dfe9f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for ado_git_repo_insights-2.2.0.tar.gz:

Publisher: release.yml on oddessentials/ado-git-repo-insights

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ado_git_repo_insights-2.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ado_git_repo_insights-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 604dda789b51ce3d4262573e50b75f7648edac47516c2683680d56e2ce838cce
MD5 f9306dd41709f1eac4cadde10ae37092
BLAKE2b-256 c7bf90642888be4f64081ccda51144a272cf33078974155af3ff6b01dbb6558f

See more details on using hashes here.

Provenance

The following attestation bundles were made for ado_git_repo_insights-2.2.0-py3-none-any.whl:

Publisher: release.yml on oddessentials/ado-git-repo-insights

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page