oncall icon indicating copy to clipboard operation
oncall copied to clipboard

Calculate OnCall schedule quality

Open Matvey-Kuk opened this issue 2 years ago • 4 comments

Alice, Bob, Sam are on call. I think it would be nice to show some "schedule quality" to help users keep schedules in a good shape.

100% = ((50% * balance) + (50% * working_hours_balance)) * ( 1 / gaps_rate)

We're trying to balance on call hours between engineers on call. Balance = 1 is good. Balance = 0 is bad.

balance = abs (min(Alice, Bob) hours / max(Alice, Bob) hours) * .... all pairs

We're trying to avoid people being on call outside of working hours. At least their on call time outside of working hours should be equal.

working_hours_balance = abs (min(Alice, Bob) hours outside of working hours / max (Alice, Bob) hours outside of working hours) * .... all pairs

We want to avoid gaps in on call schedule. Shift with no users is equal to gap:

gaps_rate = gaps hours / total observed period hours 

Matvey-Kuk avatar Jun 21 '22 08:06 Matvey-Kuk

@Matvey-Kuk you want to calculate schedule's score or per-user score?

Konstantinov-Innokentii avatar Jun 21 '22 09:06 Konstantinov-Innokentii

@Konstantinov-Innokentii schedule's score

Matvey-Kuk avatar Jun 21 '22 10:06 Matvey-Kuk

@Konstantinov-Innokentii We want to provide overall schedule quality. But if we have overloaded users in the schedule, we also focus attention on each of them.

raphael-batte avatar Jun 21 '22 12:06 raphael-batte

@Matvey-Kuk I propose to use a slightly different formula for balance score calculation:

balance = (min(Alice, Bob) hours / max(Alice, Bob) hours + .... all pairs) / number of pairs

It should eliminate the issue with hours distributions like [7, 8, 8, 8, 8, 8], where the formula you provided returns around 50% score, but [7, 8, 8, 8, 8, 8] distribution is pretty balanced and should score more than 50% (returns around 95% with the formula I proposed).

vadimkerr avatar Jun 21 '22 14:06 vadimkerr

@teodosii design here

maskin25 avatar Nov 10 '22 12:11 maskin25

The backend part is now merged in https://github.com/grafana/oncall/pull/338, @teodosii will be working on the frontend part in a separate PR.

vadimkerr avatar Jan 05 '23 13:01 vadimkerr

Frontend is implemented but waiting for a minor backend change to differentiate good remarks from warnings within the api response. Once that is done we can unblock the frontend, because right now on frontend we cannot differentiate info messages (like 'Good schedule') from warnings ('Gaps') as described in the mockups.

PR for it https://github.com/grafana/oncall/pull/1324

teodosii avatar Feb 20 '23 12:02 teodosii