Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Lens] Implement counter rate expression #82942

Closed
wants to merge 3 commits into from
Closed

Conversation

mbondyra
Copy link
Contributor

@mbondyra mbondyra commented Nov 9, 2020

Summary

Fixes #46627

Adds lens_counter_rate function.

The counter rate function works almost exactly like derivative expression – if value is increasing or equal, it returns the difference between current and previous value. If value decreased compared to the previous value, the function outputs the current value. Here's the example:

input output comment
1 undefined previous value doesn't exist
5 4 increasing dif(5-1)
11 6 increasing dif(11-6)
4 4 decreasing diff, so the counter is reset to the value
4 0 dif(4-4)

Special cases

For undefined:

input output comment
1 undefined previous value doesn't exist
5 4 increasing dif(5-1)
undefined undefined undefined current value
3 undefined undefined previous value

Question: NaN case

Should value after NaN be also NaN (eg. counter between NaN and 2 - that's that derivative do) or should it be NaN?

input output comment
1 undefined previous value doesn't exist
3 2 increasing dif(3-1)
{} (converted to NaN) NaN
2 2 or NaN?? **This is the doubt**
3 1 increasing diff (3-2)

The expression takes inputColumnId, outputColumnId, outputColumnName, by (similar behavior to new expression time series functions)

Checklist

@mbondyra mbondyra added Feature:Lens Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.11.0 v8.0.0 labels Nov 9, 2020
@mbondyra mbondyra marked this pull request as ready for review November 9, 2020 13:11
@mbondyra mbondyra requested a review from a team November 9, 2020 13:11
@mbondyra mbondyra requested a review from a team as a code owner November 9, 2020 13:11
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@mbondyra mbondyra added the release_note:skip Skip the PR/issue when compiling release notes label Nov 9, 2020
@mbondyra
Copy link
Contributor Author

mbondyra commented Nov 9, 2020

@elasticmachine merge upstream

@botelastic botelastic bot added the Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) label Nov 9, 2020
@kibanamachine
Copy link
Contributor

💔 Build Failed

Failed CI Steps

Metrics [docs]

‼️ ERROR: no builds found for mergeBase sha [d1ef0d6]

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@mbondyra mbondyra closed this Nov 9, 2020
@mbondyra mbondyra deleted the lens/counter-rate branch November 9, 2020 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) Feature:Lens release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.11.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[lens] Add "counter rate" for monotonically increasing numbers
3 participants