Copilot commented on code in PR #10699:
URL: https://github.com/apache/cloudstack/pull/10699#discussion_r2128359970


##########
plugins/metrics/src/main/java/org/apache/cloudstack/metrics/MetricsServiceImpl.java:
##########
@@ -461,8 +463,8 @@ protected ListResponse<VmMetricsStatsResponse> 
createVmMetricsStatsResponse(List
      * @return the set of responses that was created.
      */
     protected List<StatsResponse> createStatsResponse(List<VmStatsVO> 
vmStatsList) {
-        List<StatsResponse> statsResponseList = new ArrayList<StatsResponse>();
-        DecimalFormat decimalFormat = new DecimalFormat("#.##");
+        List<StatsResponse> statsResponseList = new ArrayList<>();
+        DecimalFormat decimalFormat = new DecimalFormat("#.##", 
DecimalFormatSymbols.getInstance(Locale.ENGLISH));

Review Comment:
   Consider extracting the `DecimalFormat` instantiation into a private static 
final constant, since the pattern and locale are constant. This reduces object 
creation overhead on each method call.
   ```suggestion
           DecimalFormat decimalFormat = DECIMAL_FORMAT.get();
   ```



-- 
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.

To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to