Timelion greatest value so far

(Albert Kult) #1

Hi,

This is likely to be a niche case, but still wondering if there's a solution. Using Timelion, I'd like to find the greatest value so far.

Let's assume we have the following time series:
Jan 1: 10
Jan 2: 3
Jan 3: 5
Jan 4: 11
Jan 5: 7
Jan 6: 13
Jan 7: 14
Jan 8: 9
Jan 9: 8

Using whatever greatest value so far algorithm there might be:
On Jan 1, it should give 10;
On Jan 2, it should give 10 as well because 10 > 3;
On Jan 3, it should give 10 as well because 10 > 5;
On Jan 4, it should give 11 because 11 > 10;
On Jan 5, it should give 11 as well because 11 > 7;
On Jan 6, it should give 13 because 13 > 11;
On Jan 7, it should give 14 because 14 > 13;
On Jan 8 and 9, it should give 14 because 14 > 9 and 14 > 8.

Best regards.

(Josh Dover) #2

Been playing around with this and I haven't found a way to do it with the existing Timelion functions. Basically you need something similar to cusum that would calculate the cumulative max.

The good news is, adding new function to Timelion is possible by adding a plugin. Here's a (bit outdated) example and here's the implementation of cusum which I imagine would only need subtle changes to become your own cumax.

If you get it working, we'd love a pull request upstream! If you're not a developer, open an issue on the Kibana repo and someone else may pick it up to add to a future Kibana version.

(Albert Kult) #3

Hi Josh,

Thanks for the suggestion. Amending the cusum plugin has worked like a charm.
I've created the pull request here https://github.com/elastic/kibana/pull/33650

Best regards,
Albert.

(system) closed #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.