Seems like a nice function to me. I don't think this is complex enough to require a full design document.
I did a quick check of the issue tracker and can't find any previous proposals. I would file a feature request issue: https://github.com/prometheus/prometheus/issues/new/choose On Sat, Aug 3, 2024 at 8:50 AM Jacques Bernier <[email protected]> wrote: > Tl;Dr; I'd like to implement histogram_trimmed_mean > > "A truncated mean or trimmed mean is a statistical measure of central > tendency, much like the mean and median. It involves the calculation of the > mean after discarding given parts of a probability distribution or sample > at the high and low end, and typically discarding an equal amount of both. > This number of points to be discarded is usually given as a percentage of > the total number of points, but may also be given as a fixed number of > points." https://en.wikipedia.org/wiki/Truncated_mean > > Cloudwatch added support for trimmed mean. > https://aws.amazon.com/about-aws/whats-new/2021/07/amazon-cloudwatch-supports-trimmed-mean-statistics/ > There is also a few mention of why trimmed mean can be useful for teams > here https://www.youtube.com/watch?v=_uaaCiyJCFA (skip the first 8 > minutes) > > I will use cloudwatch as an example. If you have a metric, you can > calculate pXX.XX to get percentiles. p50, p99, or p99.9. This is similar to > histogram_quantile(0.5, a_metric), histogram_quantile(0.99, a_metric) and > histogram_quantile(0.999, a_metric). For trimmed mean, it looks very > similar. tmXX.XX[:XX.XX] > tm99 is the with the last 1% removed and tm1:99 is the mean with the first > 1% and the last 1% removed. > > I envision histogram_trimmed_mean(lower, up, metric) working in a similar > way. > > tm99 -> histogram_trimmed_mean(0, 0.99, metric) > tm1:99 -> histogram_trimmed_mean(0.01, 0.99, metric) > > Similar to how histogram_quantile works, histogram_trimmed_mean would use > the values gathered in the different buckets and extrapolate the trimmed > mean. > > Another alternative would be if it was possible to do something similar to > avg_over_time(histogram_quantilte(0.01, metric) < metric < > histogram_quantilte(0.99, metric)) > > -- > You received this message because you are subscribed to the Google Groups > "Prometheus Developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/prometheus-developers/3a9deafc-1180-41f6-9aad-279e876dbc46n%40googlegroups.com > <https://groups.google.com/d/msgid/prometheus-developers/3a9deafc-1180-41f6-9aad-279e876dbc46n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Prometheus Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/CABbyFmqrazsjxVz1G4L%3DD7S2FdM_RVWKd6raTxPrueHRzFBR7Q%40mail.gmail.com.

