-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Making millisecond dimension grouping less error prone #20262
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
Conversation
@tsteur I was just able to reproduce the error using an automated test, so I'm pretty confident in the fix now. Should I remove the |
No big preference @snake14 . It may be useful in the future should a non-numeric value be passed there then we'll be able to better understand what's happening I suppose. Haven't tried to test this though what would happen. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@snake14 Added 1 comment to add testcases for other locale too
Thank you @tsteur . I went ahead and updated the tests and confirmed what I expected as far as the behaviour if non-numeric values are found. It logs a warning and casts the value as a float. So something like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 👍
lets wait for core team to check if they think this can cause any issue
@AltamashShaikh @snake14 Were you able to reproduce that problem locally? Your "fix" actually only solves the resulting problem, but it doesn't seem to fix the root cause of the issue. |
@sgiehl Yes. I was able to reproduce the error locally using the new test cases that I wrote. The issue was that we're using the |
@snake14 Sure. But logging an incorrect value before using it, doesn't make the value correct again. It will only help use to see how often that actually happens. |
@sgiehl If you think it's better, I can remove the logging and cast since they're not necessary. As far as the use of |
The As I tried to point out before: The problem is not necessarily the Note: Once you figured that out we can change the |
fyi @sgiehl I don't think it ever retrieves a formatted value as it's called in archiving. It's more an issue that the number is a string instead of an integer and the method doesn't like it. |
@tsteur No. The method does not have a problem with a string if it contains a well formed float or integer. See https://3v4l.org/0DgX0 |
@sgiehl got it. The problem is the |
That's correct. The error was being thrown by trying to multiply by a formatted number and not a valid float. If the number was greater than 999, like 2000, it was trying to multiply |
Please replace the Regarding the type cast to float and the additional logging and the tests: As it turned out that the incoming value does not seem to be the problem, we could actually consider to remove that again. As archiving should never provide invalid values this shouldn't cause any problems. If you think it's worth to keep that, we should create a follow up issue to check if anything was logged within the next weeks/months and remove it again if nothing is logged. Personally I think it would be better to remove it again. The only case I can currently image that a wrong value would be provided is during development (like providing an incorrect type for a dimension). And in that case I prefer to have an error that aborts everything instead of having a warning logged, that can be easily overseen/ignored. |
Thanks @sgiehl . I made the changes you recommended 👍 |
Description:
Some customers were occasionally seeing errors from millisecond dimensions being grouped. This checks if the value is numeric and casts it as a float. If the value isn't numeric, a warning is logged.
Review