This is a graphite-api function for the ASAP dynamic smoothing algorithm
https://arxiv.org/pdf/1703.00983.pdf
http://github.com/stanford-futuredata/ASAP
this requires the MAIN BRANCH of graphite-api, the current 1.1.3 version is not really up-to-date
pip install --upgrade git+https://github.com/brutasse/graphite-api
pip install --upgrade git+https://github.com/wyndhblb/graphite_asap
If you data as "nulls/Nones" in the data list, it will FORCE them to be 0, otherwise the algorithm cannot really function, as it needs to be able to dynamically compute windowing layers.
This is a dynamic windowing algorithm, meaning that the returned vector is NOT necessarily going to be the same length as the one you wish. If you want a 500 point vector back you can easily get much lower then that if the windowing deems it ok. For very "flat" data (i.e. sigma^4 is very small) you may even just get a few points.
In your graphing world it's recommended you use "connected" lines, not just points, as the returned data can be very sparse.
What this means is that the "step" (or delta time between points) may not be an int, but a float. Unfortunately, graphite does not like floats for the steps size.
Graphite-api, when using the Graphing (not the json) output actually does ok with floats, the json writer does not,
and so we must attempt to round the resulting step size.
As a result your graphs may look like there is the data does not transport all the way to the end of the graph due
to what appears to be a "timeshift" because the time step over the run of a few hundred points with out the
floating point precision will loose (or gain) too much time between steps.
(There is probably an easy interpolation sort of fix for this, just have not implemented it yet)
In the graphite-api.yaml
file install this package and then add to the functions list
functions:
- ... the other functions ...
- graphite_asap.functions.ASAPFunctions
And in your favorite query engine
# attempt to get a vector with 10second steps
http://xxx/render?target=asap(path.to.metric, '10s')
# attempt to get a vector that has roughly this number of points
http://xxx/render?target=asap(path.to.metric, 100)