DORA metrics Prometheus exporter - polls Woodpecker and Forgejo APIs
- Python 99.1%
- Dockerfile 0.9%
|
|
||
|---|---|---|
| docs | ||
| src | ||
| tests | ||
| .gitignore | ||
| .woodpecker.yaml | ||
| Dockerfile | ||
| README.md | ||
| requirements.txt | ||
| tiers.yaml | ||
pal-e-dora-exporter
DORA metrics Prometheus exporter. Polls Woodpecker CI and Forgejo APIs, exposes metrics at /metrics for Prometheus scraping.
Metrics
| Metric | Type | Labels | Description |
|---|---|---|---|
dora_deployments_total |
Counter | repo, status, event | Pipeline deployment count |
dora_deployment_duration_seconds |
Histogram | repo | Pipeline duration (created to finished) |
dora_deployment_last_success_timestamp |
Gauge | repo | Unix timestamp of last successful pipeline |
dora_pr_merges_total |
Counter | repo | Merged pull request count |
dora_pr_lead_time_seconds |
Histogram | repo | PR lead time (created to merged) |
dora_pr_review_count |
Histogram | repo | Review count per merged PR |
Endpoints
GET /health-- 200 OK liveness probeGET /metrics-- Prometheus metrics
Configuration
All configuration via environment variables:
| Variable | Required | Default | Description |
|---|---|---|---|
WOODPECKER_URL |
yes | Woodpecker API base URL | |
WOODPECKER_TOKEN |
yes | Woodpecker API Bearer token | |
FORGEJO_URL |
yes | Forgejo instance URL | |
FORGEJO_USER |
yes | Forgejo username | |
FORGEJO_PASSWORD |
yes | Forgejo password | |
POLL_INTERVAL |
no | 60 | Seconds between collection cycles |
Run Locally
pip install -r requirements.txt \
--extra-index-url https://forgejo.tail5b443a.ts.net/api/packages/forgejo_admin/pypi/simple/
export WOODPECKER_URL=https://woodpecker.tail5b443a.ts.net
export WOODPECKER_TOKEN=...
export FORGEJO_URL=https://forgejo.tail5b443a.ts.net
export FORGEJO_USER=forgejo_admin
export FORGEJO_PASSWORD=...
uvicorn src.main:app --host 0.0.0.0 --port 8000
Docker
docker build -t dora-exporter .
docker run -p 8000:8000 \
-e WOODPECKER_URL=... \
-e WOODPECKER_TOKEN=... \
-e FORGEJO_URL=... \
-e FORGEJO_USER=... \
-e FORGEJO_PASSWORD=... \
dora-exporter
CI
Woodpecker pipeline builds and pushes to Harbor on push to main. Image: harbor.tail5b443a.ts.net/pal-e-dora-exporter/dora-exporter.
Architecture
Woodpecker API ---+
+--> pal-e-dora-exporter --> /metrics --> Prometheus --> Grafana
Forgejo API ------+ (k8s pod) :8000 (scrape) (dashboard)