Skip to content

Commit 969e094

Browse files
authored
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 <rohit.yadav@shapeblue.com>
1 parent 64ecd00 commit 969e094

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

server/src/main/java/com/cloud/server/StatsCollector.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -644,13 +644,12 @@ class HostCollector extends AbstractStatsCollector {
644644
@Override
645645
protected void runInContext() {
646646
try {
647-
LOGGER.debug("HostStatsCollector is running...");
648-
649647
SearchCriteria<HostVO> sc = createSearchCriteriaForHostTypeRoutingStateUpAndNotInMaintenance();
650-
651-
Map<Object, Object> metrics = new HashMap<>();
652648
List<HostVO> hosts = _hostDao.search(sc, null);
653649

650+
LOGGER.debug(String.format("HostStatsCollector is running to process %d UP hosts", hosts.size()));
651+
652+
Map<Object, Object> metrics = new HashMap<>();
654653
for (HostVO host : hosts) {
655654
HostStatsEntry hostStatsEntry = (HostStatsEntry) _resourceMgr.getHostStatistics(host.getId());
656655
if (hostStatsEntry != null) {
@@ -1192,13 +1191,12 @@ class VmStatsCollector extends AbstractStatsCollector {
11921191
@Override
11931192
protected void runInContext() {
11941193
try {
1195-
LOGGER.trace("VmStatsCollector is running...");
1196-
11971194
SearchCriteria<HostVO> sc = createSearchCriteriaForHostTypeRoutingStateUpAndNotInMaintenance();
11981195
List<HostVO> hosts = _hostDao.search(sc, null);
11991196

1200-
Map<Object, Object> metrics = new HashMap<>();
1197+
LOGGER.debug(String.format("VmStatsCollector is running to process VMs across %d UP hosts", hosts.size()));
12011198

1199+
Map<Object, Object> metrics = new HashMap<>();
12021200
for (HostVO host : hosts) {
12031201
Date timestamp = new Date();
12041202
Map<Long, VMInstanceVO> vmMap = getVmMapForStatsForHost(host);

0 commit comments

Comments
 (0)