-
Notifications
You must be signed in to change notification settings - Fork 329
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
Update wallet_balance
metric to f64 instead of u64
#2440
Conversation
wallet_balance
metric to f64 instead of u64
wallet_balance
metric to f64 instead of u64wallet_balance
metric to f64 instead of u64
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! Let's also mention in the metric description and the changelog that the reported value may not be 100% accurate due to loss of precision when converting the balance to floating point.
%balance.amount, denom = %balance.denom, account = %key.account, | ||
"Error parsing amount into f64 and therefore won't be reported to telemetry" | ||
); | ||
warn!( |
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.
Let's remove this and make the trace above a warning instead.
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.
Handling the parsing error has been updated to only be a warning
…precision due to conversion to f64
Closes: #2381
Description
This PR is an alternative solution to the PR #2425.
Instead of dividing the
wallet_balance
metric by a configurable order of magnitude, this PR updates the metric type fromu64
tof64
.As
f64::MAX
is bigger thanU256::MAX
this solves the overflow problem without the need to divide thewallet_balance
, thus does not introduce a new configurable value.PR author checklist:
unclog
.docs/
).Reviewer checklist:
Files changed
in the GitHub PR explorer.