Extract cycle time metrics from your JIRA installation to analyze development team performance.
Cycle time measures how long tasks spend in active development statuses. By default, this includes time spent in:
- Doing
- Blocked
- Review
- In Progress
- In Review
This metric helps teams understand their delivery efficiency and identify bottlenecks.
-
Install dependencies:
pip install -r requirements.txt
-
Get your JIRA API token:
- Go to https://id.atlassian.com/manage-profile/security/api-tokens
- Create a new API token
- Save it securely
-
Run the script:
export JIRA_API_TOKEN="your-token-here" python jira_metrics.py --url https://your-company.atlassian.net --username your-email@company.com
The script generates a CSV file with these columns:
key: Issue key (e.g., PROJ-123)summary: Issue titlecycle_time_hours: Total hours in cycle time statusescycle_time_days: Total days in cycle time statusesstatus: Current issue statuscreated: When the issue was createdresolved: When the issue was resolved (if completed)
If your JIRA uses different status names:
python jira_metrics.py --url https://company.atlassian.net --username user@company.com --statuses "Development" "Code Review" "QA Testing"# Specific project
python jira_metrics.py --jql "project = MYPROJ AND resolved >= -30d" --url https://company.atlassian.net --username user@company.com
# Current sprint
python jira_metrics.py --jql "sprint in openSprints()" --url https://company.atlassian.net --username user@company.compython jira_metrics.py --json --url https://company.atlassian.net --username user@company.comThis creates both a CSV summary and a detailed JSON file with status transition history.
- Never commit your API token to version control
- Use environment variables or a local config file for credentials
- API tokens are safer than passwords and can be easily revoked
Authentication Error: Verify your JIRA URL, username, and API token No Issues Found: Check your JQL query and permissions Missing Status Transitions: The script requires changelog history (may not be available for very old issues)