-
Notifications
You must be signed in to change notification settings - Fork 152
Float metrics values overflow on ARM systems #117
Comments
@bekriebel This is certainly a bug. Thanks for debugging this and the PR. Cloudprober's source of truth (SoT) is Google internal, which means that I'll have to import his pull request to the internal source and then export it back. Thankfully, this process preserves the original author. Unfortunately, cloudprober was not setup properly for this kind of transformations (reverse). I was trying to sort that out over past few days. That's why delay in accepting the PR. I'll try to finish this process tomorrow. |
No problem. I already have it running in my environment with this change and it is working well. This seems to be the only change necessary for the code to work well on the ARM platform. Thanks for your work on it! |
@bekriebel Thanks. I wanted to ask if you'd mind if I get rid of the trimming completely (that is, we'll print trailing zeros) . I think it's making code a bit obscure and not adding as much value. I can just do it at my end if that sounds good to you. |
@manugarg Yeah, that was my first inclination as well but wasn't sure if it was done this way for a reason. What do you think about just returning |
I went ahead and pushed a new version that doesn't trim or truncate. Personally, I prefer having the extra precision. It can always be truncated on a UI side or in a surfacer if desired. |
On ARM system, the int type is defaulting to the size of int32 and can easily be overrun. As discussed in #117, we can skip trimming the trailing zeros. It's not adding much value and making the code obscure. PiperOrigin-RevId: 193150323
Importing this change back as #119. Please take a look. Keeping precision of 3 decimal points as sometimes we get really long strings in the latency (.3333333.. kind of things). Also, using strconv instead of fmt.Sprintf as strconv is a bit faster. |
On ARM system, the int type is defaulting to the size of int32 and can easily be overrun. As discussed in #117, we can skip trimming the trailing zeros. It's not adding much value and making the code obscure. PiperOrigin-RevId: 193150323
Thanks again, Brint. Closing this issue now. |
When compiled for ARM, metrics values are overflowing when they are cast from float64 to int. This seems to be caused by ARM using int32 instead of int64 during the conversion. This results in high-value metrics getting set to either 2147483.647 or 0 (depending on which GOARM value is used) as soon as the value overflows int32.
The code causing this:
cloudprober/metrics/float.go
Lines 92 to 95 in 882d33f
This can be fixed in a few ways:
I implemented the fourth option on an incoming pull request. Let me know if you'd prefer a different version of the fix.
The text was updated successfully, but these errors were encountered: