-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
TSVB Filter ratio denominator not handling negative values #150738
Comments
Pinging @elastic/kibana-visualizations @elastic/kibana-visualizations-external (Team:Visualizations) |
This is the script that runs during filter ration function
It seems that when the denominator is negative it defaults to 0. This hasn't changed the last many minors so it doesn't see as a bug to me but as a business decision. Unfortunately at this point I dont know how the decision was made. I will change it to enhancement for now, we need to research why this decision was made and either close the issue or change the behavior. |
@stratoula you are right, this was the formula that was used since the beginning of TSVB #9725 |
Filter ratio is supported in Lens formulas and it doesn't have this limitation so I am closing this as it is supported in Lens with formulas. |
Do we have any explanation why it doesn't work in TSVB? Is it documented anywhere? The fact that it works in lens is only confirming that it might be bug in tsvb. |
It is how it worked in TSVB since the beginning, @simianhacker can give more information I assume why this has been decided. |
Well the fact that it work the same since it was implemented is nature of every bug. Can't understand why this issue is closed, nothing changed since the first comment. Also, seems it is not documented and works correctly in other parts of the system, which contradicts any business decision that could be made. On top of that it is simply wrong from mathematical perspective giving no warning to the users, until they find out their dashboards have wrong calculations. |
From a product perspective, we decided to use ZERO since were were talking about a ratios. Maybe it would have been more appropriate to return That being said, I could see an argument for changing the painless script to:
Which would support |
BTW... I've created a PR for this change: #152053 |
Perfect, thanks for fixing this. |
my2c - this seems to be a bug. The fact it doesn't come up often is, I expect, likely because most users are actually not creating ratios with different signs in nominator/denominator (otherwise, wouldn't they also think it's odd their values come up If it's a low effort fix, I'm ok with merging, despite the minor change in behavior (which imho is buggy). |
## Summary This PR fixes #150738 by adding support for negative denominators for TSVB's filter ratios. ### Checklist - [X] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
@m-wcislo I just merged the PR, the update will be in 8.8 @thomasneirynck & @m-wcislo As far as returning |
No big opinion either way fwiw. Maybe just keep as-is and not change the behavior. |
## Summary This PR fixes elastic#150738 by adding support for negative denominators for TSVB's filter ratios. ### Checklist - [X] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
Kibana version:
v 8.4.3
Elasticsearch version:
v 8.4.3
Server OS version:
Rhel7
Browser version:
Firefox 109.0.1
Browser OS version:
Ubuntu 22.04
Describe the bug:
When using TSVB Metric, when adding Filter Ratio aggregation (Sum based) it seems that result is made 0 when the result of underlying sum for denominator is negative.
Steps to reproduce:
1.Data with field test which is runtime field with values both negative, positive and 0.
2.Create TSVB Metric with Filter ratio aggregation based on sum of test
3.Following was observed:
Expected behavior:
Denominator seems to have problems with negative values. So expected is to have 1 when both numerator and denominator filters same documents and counts same value (even when the sum is negative).
The text was updated successfully, but these errors were encountered: