action #127025
Updated by tinita 11 months ago
## Motivation
In #121582 we added statistics from our backlog to Grafana:
* Ticket counts of the different backlog queries
* Cycle & lead times
The cycle and lead times are reported in a way that we can calculate the mean times, but not median.
It was requested that we support median.
Also it should be possible to feed data for a certain time frame to Grafana, e.g. when we change something in the calculation, or the Grafana database is gone, or we simply want to import historical data. Ideally this script can be used by other teams as well.
## Acceptance criteria
* **AC1:** Grafana graphs for cycle and lead time based on the median instead of mean are available
## Suggestions
* Find out why in https://github.com/openSUSE/backlogger/blob/main/backlogger.py#L198 it was chosen to calculate the mean value instead of just feeding all raw values directly to grafana?
* It wasn't chosen to feed the mean value. Like tinita wrote in https://progress.opensuse.org/issues/121582#note-34 it would be wrong to feed the mean value to Grafana. Instead we feed the sum of cycle times and the number of tickets.
* Extract the leadTime calculation from the [backlogger script](https://github.com/openSUSE/backlogger), because the original backlog status page script doesn't need this, and it will make it easier to add new options that don't make much sense for the backlogger
* Refactor/split up the code to avoid copying logic/config data if that makes sense (unless it's more work and not worth the effort)
* Use the same codebase since other teams can also benefit from this effort
* Metrics can be computed based on an option for a certain timeframe
* Metrics still include data for the last day by default
* Metrics include data for each individual ticket, so we can calculate the median in Grafana
* Read up what median is and how to compute it :-D
* MAke this an additional feature that can be used at the same time (so we can compare both accurately based on real data)