|
1 | | -[](https://codeclimate.com/github/smirnoffmg/metrics/maintainability) |
| 1 | +# Metrics: Jira Engineering Analytics Toolkit |
| 2 | + |
| 3 | +[](https://github.com/your/repo/actions) |
| 4 | +[](https://github.com/your/repo/actions) |
| 5 | +[](LICENSE) |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +## 🚀 Vision |
| 10 | +**Metrics** empowers engineering teams to understand, visualize, and improve their software delivery process using real Jira data. It’s designed for: |
| 11 | +- Engineering managers and leads |
| 12 | +- Data-driven teams |
| 13 | +- Process improvement advocates |
| 14 | +- Anyone who wants actionable insights from Jira |
| 15 | + |
| 16 | +--- |
| 17 | + |
| 18 | +## ✨ Features |
| 19 | +- **Fetches issues from Jira** using JQL (supports cloud and server) |
| 20 | +- **Calculates key metrics:** |
| 21 | + - Cycle time |
| 22 | + - Lead time |
| 23 | + - Queue time (per status) |
| 24 | + - Throughput (weekly) |
| 25 | + - Cumulative queue time (p50 per status) |
| 26 | + - Return to testing (how often issues return to QA) |
| 27 | +- **Visualizes metrics** as clear PNG charts (histograms, bar charts, etc.) |
| 28 | +- **Flexible configuration:** CLI, environment variables, or YAML/JSON config file |
| 29 | +- **Fast, robust, and fully tested** |
| 30 | +- **Extensible:** Modular architecture for adding new metrics or data sources |
| 31 | + |
| 32 | +--- |
| 33 | + |
| 34 | +## 🏗️ Architecture Overview |
| 35 | +- **CLI entrypoint:** `metrics/__main__.py` (uses Click) |
| 36 | +- **Dependency injection:** Clean, testable services via `dependency_injector` |
| 37 | +- **Services:** Metrics calculation, visualization, and Jira repository |
| 38 | +- **Entities:** Strongly-typed Issue model |
| 39 | +- **Config:** Merges CLI, env, and config file (YAML/JSON) |
| 40 | +- **Output:** All charts saved to `output/` directory |
| 41 | + |
| 42 | +--- |
| 43 | + |
| 44 | +## ⚡ Quickstart |
| 45 | + |
| 46 | +### 1. Install dependencies |
| 47 | +```sh |
| 48 | +poetry install |
| 49 | +``` |
2 | 50 |
|
3 | | -# Development team metrics |
| 51 | +### 2. Run metrics analysis |
| 52 | +```sh |
| 53 | +python -m metrics --jira-server https://your-jira --jira-token <token> --jira-jql 'project=MYPROJ' |
| 54 | +``` |
4 | 55 |
|
5 | | -Measure your dev team metrics using python and your task tracker. |
| 56 | +Or with a config file: |
| 57 | +```sh |
| 58 | +python -m metrics --config config.yaml |
| 59 | +``` |
6 | 60 |
|
7 | | -## Supported task trackers |
| 61 | +--- |
8 | 62 |
|
9 | | - - Jira |
| 63 | +## ⚙️ Configuration Matrix |
10 | 64 |
|
11 | | -## Supported metrics |
| 65 | +| Option | CLI Option | Env Var | Config File Key | Required | |
| 66 | +| ----------- | ------------- | ----------- | --------------- | -------- | |
| 67 | +| Jira Server | --jira-server | JIRA_SERVER | jira.server | Yes | |
| 68 | +| Jira Token | --jira-token | JIRA_TOKEN | jira.token | Yes | |
| 69 | +| Jira JQL | --jira-jql | JIRA_JQL | jira.jql | Yes | |
| 70 | +| Config File | --config | N/A | N/A | No | |
12 | 71 |
|
13 | | - - Throughput |
14 | | - - Lead time |
15 | | - - Cycle time |
16 | | - - Queue time |
| 72 | +- **Priority:** CLI > Env > Config file |
| 73 | +- **Config file format:** YAML or JSON |
17 | 74 |
|
18 | | -## Articles |
| 75 | +### Example YAML |
| 76 | +```yaml |
| 77 | +jira: |
| 78 | + server: https://your-jira |
| 79 | + token: your-token |
| 80 | + jql: project=MYPROJ |
| 81 | +``` |
19 | 82 |
|
20 | | -* [Метрики команды разработки](https://habr.com/ru/articles/788930/) |
21 | | -* [Software engineering metrics](https://medium.com/@maximsmirnov/software-engineering-metrics-613be9b99ccd) |
| 83 | +### Example JSON |
| 84 | +```json |
| 85 | +{ |
| 86 | + "jira": { |
| 87 | + "server": "https://your-jira", |
| 88 | + "token": "your-token", |
| 89 | + "jql": "project=MYPROJ" |
| 90 | + } |
| 91 | +} |
| 92 | +``` |
22 | 93 |
|
23 | | -## How to run? |
| 94 | +--- |
24 | 95 |
|
25 | | -```shell |
26 | | -poetry install |
27 | | -poetry run python -m metrics --help |
| 96 | +## 🖥️ Usage |
| 97 | + |
| 98 | +Show help and examples: |
| 99 | +```sh |
| 100 | +python -m metrics --help |
28 | 101 | ``` |
29 | 102 |
|
30 | | -```shell |
31 | | -poetry run python -m metrics --jira-server YOUR_SERVER_URL --jira-token YOUR_PERSONAL_TOKEN --jira-jql "project = Dev (for example)" |
| 103 | +Typical run: |
| 104 | +```sh |
| 105 | +python -m metrics --jira-server https://your-jira --jira-token <token> --jira-jql 'project=MYPROJ' |
32 | 106 | ``` |
33 | 107 |
|
34 | | -## Example output |
| 108 | +**Output:** |
| 109 | +- PNG charts for each metric in the `output/` directory |
| 110 | + |
| 111 | +--- |
| 112 | + |
| 113 | +## 📊 Example Output |
| 114 | + |
| 115 | +Below are sample charts generated by Metrics: |
35 | 116 |
|
36 | 117 | ### Throughput |
| 118 | + |
| 119 | + |
| 120 | +### Lead Time |
| 121 | + |
| 122 | + |
| 123 | +### Cycle Time |
| 124 | + |
| 125 | + |
| 126 | +### Queue Time (per status) |
| 127 | +**Status: New** |
| 128 | + |
| 129 | + |
| 130 | +**Status: Test** |
| 131 | + |
| 132 | + |
| 133 | +--- |
| 134 | + |
| 135 | +## 🧪 Testing & Development |
| 136 | + |
| 137 | +- **Run all tests:** |
| 138 | + ```sh |
| 139 | + make test |
| 140 | + ``` |
| 141 | +- **Check coverage:** |
| 142 | + ```sh |
| 143 | + make coverage |
| 144 | + ``` |
| 145 | +- **Lint and format:** |
| 146 | + ```sh |
| 147 | + make lint |
| 148 | + make format |
| 149 | + ``` |
| 150 | +- **Pre-commit hooks:** |
| 151 | + ```sh |
| 152 | + pre-commit install |
| 153 | + # Now every commit will be checked by Ruff |
| 154 | + ``` |
37 | 155 |
|
38 | | - |
| 156 | +--- |
39 | 157 |
|
40 | | -### Lead time |
| 158 | +## 🛠️ Troubleshooting |
| 159 | +- **Missing dependencies:** Install with `pip install -r requirements.txt` or `poetry install`. |
| 160 | +- **YAML config error:** Install PyYAML: `pip install pyyaml`. |
| 161 | +- **Jira connection error:** Check your server URL, token, and network access. |
| 162 | +- **No output:** Check the `output/` directory and logs for errors. |
41 | 163 |
|
42 | | - |
| 164 | +--- |
43 | 165 |
|
44 | | -### Cycle time |
| 166 | +## ❓ FAQ |
| 167 | +**Q: Can I use this with Jira Cloud?** |
| 168 | +A: Yes! Just use your cloud URL and a valid API token. |
45 | 169 |
|
46 | | - |
| 170 | +**Q: Can I add new metrics or visualizations?** |
| 171 | +A: Yes! The code is modular—add new services or extend existing ones. |
47 | 172 |
|
48 | | -### Queue time for every status |
| 173 | +**Q: How do I contribute?** |
| 174 | +A: Fork, branch, run `make test` and `make lint`, and open a PR! |
49 | 175 |
|
50 | | -#### Status "New" |
| 176 | +--- |
51 | 177 |
|
52 | | - |
| 178 | +## 🤗 Contributing |
| 179 | +We welcome contributions! Please: |
| 180 | +- Follow the code style (enforced by Ruff) |
| 181 | +- Add/maintain docstrings and tests |
| 182 | +- Document new features in the README |
| 183 | +- Open a clear, descriptive pull request |
53 | 184 |
|
54 | | -#### Status "Test" |
| 185 | +--- |
55 | 186 |
|
56 | | - |
| 187 | +## 📄 License |
| 188 | +MIT License. See [LICENSE](LICENSE). |
0 commit comments