devstats icon indicating copy to clipboard operation
devstats copied to clipboard

[bug] PR Time to Merge should use average, not greatest

Open jberkus opened this issue 1 year ago • 7 comments

When looking at larger intervals of time, Kubernetes PR-Time-To-Merge uses this calculation:

greatest(percentile_disc(0.5) within group (order by open_to_lgtm asc), 0) as m_o2l_a,

This is wrong; it leads to having a greater value the larger your time interval is, which is deceptive. For aggregating a median, there's two reasonable possibilities: a median of medians, or an average of medians. In practice, those two values are rarely that divergent, and an average is faster to calculate.

Therefore it should be:

avg(percentile_disc(0.5) within group (order by open_to_lgtm asc), 0) as m_o2l_a,

This mistake exists across all cacluations in this view.

Assigning to myself, will submit a PR later.

/assign

jberkus avatar Nov 15 '24 18:11 jberkus

I'm OK with this change, just cc @caniszczyk - this is now calculated according to some specs that were given initially long time ago...

lukaszgryglicki avatar Nov 16 '24 14:11 lukaszgryglicki

+1

Cheers,

Chris Aniszczyk https://aniszczyk.org

On Sat, Nov 16, 2024 at 8:41 AM Łukasz Gryglicki @.***> wrote:

I'm OK with this change, just cc @caniszczyk https://github.com/caniszczyk - this is now calculated according to some specs that were given initially long time ago...

— Reply to this email directly, view it on GitHub https://github.com/cncf/devstats/issues/85#issuecomment-2480599692, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAPSIKLL4NZM4UQ3ZSM6ML2A5KRPAVCNFSM6AAAAABR3XXOGGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOBQGU4TSNRZGI . You are receiving this because you were mentioned.Message ID: @.***>

caniszczyk avatar Nov 16 '24 14:11 caniszczyk

Sp @jberkus pls create a PR and ping me, once merged I'll regenerate all dashboards - the question is:

  • do we need this change in K8s only, or across all projects? If all then please also change metric in "metrics/all/xyz.sql" in addition to "metrics/kubernetes/xyz.sql".

lukaszgryglicki avatar Nov 16 '24 14:11 lukaszgryglicki

I haven't checked yet whether this is all projects.

jberkus avatar Nov 16 '24 17:11 jberkus

I mean metric is the same in all projects, my question was: do you want to change in all projects or just in K8s?

lukaszgryglicki avatar Nov 16 '24 19:11 lukaszgryglicki

Hi, i would love to contribute to this issue . .take-issue

Arunodoy18 avatar Nov 24 '25 23:11 Arunodoy18

Great, thank you.

lukaszgryglicki avatar Nov 25 '25 05:11 lukaszgryglicki