This is an automated email from the ASF dual-hosted git repository.

shwstppr pushed a commit to branch 4.18
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.18 by this push:
     new 969e094419d server: improve stats collector logs to state what the 
collector does (#8387)
969e094419d is described below

commit 969e094419d66fab925d1185c3c2551bf22ad407
Author: Rohit Yadav <[email protected]>
AuthorDate: Thu Dec 21 13:06:32 2023 +0530

    server: improve stats collector logs to state what the collector does 
(#8387)
    
    This simply improves the log statement that prints debug statements
    during beginning of a stats collector run for hosts or VMs.
    
    Signed-off-by: Rohit Yadav <[email protected]>
---
 server/src/main/java/com/cloud/server/StatsCollector.java | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/server/src/main/java/com/cloud/server/StatsCollector.java 
b/server/src/main/java/com/cloud/server/StatsCollector.java
index 91410198e2f..19820093f3a 100644
--- a/server/src/main/java/com/cloud/server/StatsCollector.java
+++ b/server/src/main/java/com/cloud/server/StatsCollector.java
@@ -644,13 +644,12 @@ public class StatsCollector extends ManagerBase 
implements ComponentMethodInterc
         @Override
         protected void runInContext() {
             try {
-                LOGGER.debug("HostStatsCollector is running...");
-
                 SearchCriteria<HostVO> sc = 
createSearchCriteriaForHostTypeRoutingStateUpAndNotInMaintenance();
-
-                Map<Object, Object> metrics = new HashMap<>();
                 List<HostVO> hosts = _hostDao.search(sc, null);
 
+                LOGGER.debug(String.format("HostStatsCollector is running to 
process %d UP hosts", hosts.size()));
+
+                Map<Object, Object> metrics = new HashMap<>();
                 for (HostVO host : hosts) {
                     HostStatsEntry hostStatsEntry = (HostStatsEntry) 
_resourceMgr.getHostStatistics(host.getId());
                     if (hostStatsEntry != null) {
@@ -1192,13 +1191,12 @@ public class StatsCollector extends ManagerBase 
implements ComponentMethodInterc
         @Override
         protected void runInContext() {
             try {
-                LOGGER.trace("VmStatsCollector is running...");
-
                 SearchCriteria<HostVO> sc = 
createSearchCriteriaForHostTypeRoutingStateUpAndNotInMaintenance();
                 List<HostVO> hosts = _hostDao.search(sc, null);
 
-                Map<Object, Object> metrics = new HashMap<>();
+                LOGGER.debug(String.format("VmStatsCollector is running to 
process VMs across %d UP hosts", hosts.size()));
 
+                Map<Object, Object> metrics = new HashMap<>();
                 for (HostVO host : hosts) {
                     Date timestamp = new Date();
                     Map<Long, VMInstanceVO> vmMap = 
getVmMapForStatsForHost(host);

Reply via email to