laravel / pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.
https://pulse.laravel.com
MIT License
1.48k stars 173 forks source link

Add variance to aggregates #406

Closed robertogallea closed 2 months ago

robertogallea commented 2 months ago

Since variance (or standard deviation) can be computed incrementally, it could be very useful to add it to the available Pulse aggregates.

The formula for its incremental computation is the following:

sn^2 = (n-2)/(n-1)s{n-1}^2 + (1/n)(Xn - X'{n-1})^2

where

The only issue preventing me from submitting a complete PR is the fact that the computation requires the mean at the previous step, which altough could be available in the aggregates table, is not directly accessible during the upsert, so a choice has to be done for the strategy used to fetch it from the database.

Some viable solution could be:

taylorotwell commented 2 months ago

Thanks for your pull request to Laravel!

Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include.

If applicable, please consider releasing your code as a package so that the community can still take advantage of your contributions!