DORA (DevOps Research and Assessment) metrics are a set of industry-standard benchmarks used to measure the performance of a software development and delivery process. They provide key insights into a team's ability to deliver software with both speed and stability. By tracking these metrics, teams can identify areas for improvement, make data-driven decisions, and ultimately enhance their DevOps capabilities.
This script calculates key DORA metrics: Deployment Frequency, Change Failure Rate, and Mean Time to Recover. It processes release data from a CSV file provided via standard input.
The script expects CSV data piped to its standard input. The CSV must contain the following columns: app name, version, and publication date.
app name,version,publication date
AppA,v1.0.0,2024-01-01
AppA,v1.0.1,2024-01-05
AppA,v1.1.0,2024-01-15
AppB,v2.0.0,2024-02-01
AppB,v2.0.1,2024-02-02
You can run the script using uvx, which will execute the command in a temporary virtual environment. Remember to use --from to ensure uvx can find the dora package.
cat data.csv | uvx --from git+https://github.com/johannilsson/dora-metrics doraTo calculate and display DORA metrics:
cat data.csv | dora######################################
### Metrics for App: AppA
######################################
Total Releases: 3
-> Release Frequency:
Average time between releases: 7.00 days
Releases included in calculation:
- v1.0.0 on 2024-01-01
- v1.0.1 on 2024-01-05
- v1.1.0 on 2024-01-15
-> Change Failure Rate:
33.33% (1 change required a hotfix out of 3 total releases)
Changes that failed (and their subsequent fix):
- Change v1.0.0 (2024-01-01) failed, fixed by v1.0.1 (2024-01-05)
-> Mean Time to Recover (MTTR):
Average: 4 days
Recovery periods included in calculation:
- From v1.0.0 (2024-01-01) to v1.0.1 (2024-01-05): 4 days
######################################
### Metrics for App: AppB
######################################
Total Releases: 2
-> Release Frequency:
Average time between releases: 1.00 days
Releases included in calculation:
- v2.0.0 on 2024-02-01
- v2.0.1 on 2024-02-02
-> Change Failure Rate:
50.00% (1 change required a hotfix out of 2 total releases)
Changes that failed (and their subsequent fix):
- Change v2.0.0 (2024-02-01) failed, fixed by v2.0.1 (2024-02-02)
-> Mean Time to Recover (MTTR):
Average: 1 day
Recovery periods included in calculation:
- From v2.0.0 (2024-02-01) to v2.0.1 (2024-02-02): 1 day
To set up the development environment, install the project in editable mode with its development dependencies:
uv pip install -e ".[dev]"This project uses ruff for linting and formatting.
To check for linting issues, run:
uv run ruff check .To automatically fix issues and format the code, run:
uv run ruff check . --fix
uv run ruff format .To run the unit tests, use pytest:
uv run pytest