Skip to content

Conversation

@Arunodoy18
Copy link

Replace percentile_disc(0.5) with avg() for median calculations to prevent misleading results when aggregating over larger time intervals. This addresses the issue where medians calculated over extended periods showed inflated values due to incorrect aggregation method.

Changes:

  • Replace percentile_disc(0.5) with avg() for all median calculations
  • Preserve percentile_disc(0.85) for 85th percentile calculations
  • Apply fixes to both time_metrics.sql and time_metrics_repos.sql
  • Maintain filter conditions for API change classifications

The avg() approach provides more accurate median aggregation over time periods and is computationally more efficient than percentile_disc().

Fixes: Kubernetes PR-Time-To-Merge median aggregation over larger intervals

Please make sure that you follow instructions from CONTRIBUTING

Specially:

  • Check if all tests pass, see TESTING for deatils.
  • Make sure you've added test coverage for new features/metrics.
  • Make sure you have updated documentation.
  • If you added a new metric, please make sure you have been following instructions about adding new metric.

Replace percentile_disc(0.5) with avg() for median calculations to prevent
misleading results when aggregating over larger time intervals. This addresses
the issue where medians calculated over extended periods showed inflated values
due to incorrect aggregation method.

Changes:
- Replace percentile_disc(0.5) with avg() for all median calculations
- Preserve percentile_disc(0.85) for 85th percentile calculations
- Apply fixes to both time_metrics.sql and time_metrics_repos.sql
- Maintain filter conditions for API change classifications

The avg() approach provides more accurate median aggregation over time periods
and is computationally more efficient than percentile_disc().

Fixes: Kubernetes PR-Time-To-Merge median aggregation over larger intervals
Signed-off-by: Arunodoy18 <[email protected]>
@Arunodoy18
Copy link
Author

I have done all the changes and the fixes . Thank you

@lukaszgryglicki
Copy link
Member

Hi, thanks for this, I will get to this on my CNCF working day.
Please note that changing SQL means that given dashboard must be manually regenerated for given project(s), that means:

  • I need to test if fix work first.
    • Then I need to regenerate pre-computed data for all projects that were modified.
  • We're now doing a migration to new servers which may be higher priority.
  • I have two weeks of vacation between Dec 4th - Dec 17th.

Just note that I will eventually work on this one, but it may take some time.

@lukaszgryglicki lukaszgryglicki self-assigned this Nov 25, 2025
@Arunodoy18
Copy link
Author

Any further Updates?

@lukaszgryglicki
Copy link
Member

I will work on this after migration as already mentioned on other tickets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants