rhtyd commented on a change in pull request #4900:
URL: https://github.com/apache/cloudstack/pull/4900#discussion_r609562121
##########
File path:
plugins/metrics/src/main/java/org/apache/cloudstack/response/HostMetricsResponse.java
##########
@@ -117,7 +117,7 @@ public void setCpuTotal(final Integer cpuNumber, final Long
cpuSpeed, final Doub
public void setCpuUsed(final String cpuUsed, final Integer cpuNumber,
final Long cpuSpeed) {
if (cpuUsed != null && cpuNumber != null && cpuSpeed != null) {
- this.cpuUsed = String.format("%.2f Ghz",
Double.valueOf(cpuUsed.replace("%", "")) * cpuNumber * cpuSpeed / (100.0 *
1000.0));
+ this.cpuUsed = String.format("%.2f Ghz",
Double.valueOf(cpuUsed.replace(",",".").replace("%", "")) * cpuNumber *
cpuSpeed / (100.0 * 1000.0));
Review comment:
@Spaceman1984 can you check and fix it at the source, i.e. where the
string is created; this may still not work because many EU locales may display
something like `10,123.456` as `10.123,456` and with this fix result in
something like `10.123.456`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]