]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/balancer: optimized info level logs
authorTimothy Q Nguyen <timqn22@gmail.com>
Thu, 23 Oct 2025 17:32:01 +0000 (10:32 -0700)
committerLaura Flores <lflores@ibm.com>
Mon, 17 Nov 2025 17:39:56 +0000 (11:39 -0600)
Improved the quality of one of the info level logs by
adding more information to it and removing a
similar log in debug level. This is in an effort to
provide maximum information at info level without
clogging up the info level logs with multiple logs.
I've also added a check for the "balancing root"
logs which are repeated multiple times without
adding new information. Now only the first of the
repeating "balancing root" logs is logged at info
level, the rest will be logged in debug level.

Signed-off-by: Timothy Q Nguyen <timqn22@gmail.com>
src/pybind/mgr/balancer/module.py

index ee18869cc531d8ed8c174dd19424fcb60fa4f5d1..3f73682894dc58de2a17b9c380d4fad25508a053 100644 (file)
@@ -1020,10 +1020,9 @@ class Module(MgrModule):
         return pe.show(verbose=verbose)
 
     def optimize(self, plan: Plan) -> Tuple[int, str]:
-        self.log.debug('Optimize plan %s' % plan.name)
         max_misplaced = cast(float, self.get_ceph_option('target_max_misplaced_ratio'))
-        self.log.info('Mode %s, max misplaced %f' %
-                      (plan.mode, max_misplaced))
+        self.log.info('Optimize plan %s, mode %s, max misplaced %f' %
+                      (plan.name, plan.mode, max_misplaced))
 
         info = self.get('pg_status')
         unknown = info.get('unknown_pgs_ratio', 0.0)
@@ -1301,13 +1300,17 @@ class Module(MgrModule):
                 min_pgs = osds * min_pg_per_osd
                 if best_pe.total_by_root[root][key] < min_pgs:
                     self.log.debug('Skipping root %s (pools %s), total pgs %d '
-                                  '< minimum %d (%d per osd)',
-                                  root, pools,
-                                  best_pe.total_by_root[root][key],
-                                  min_pgs, min_pg_per_osd)
+                                   '< minimum %d (%d per osd)',
+                                   root, pools,
+                                   best_pe.total_by_root[root][key],
+                                   min_pgs, min_pg_per_osd)
                     continue
-                self.log.info('Balancing root %s (pools %s) by %s' %
-                              (root, pools, key))
+                if left == max_iterations:
+                    self.log.info('Balancing root %s (pools %s) by %s' %
+                                  (root, pools, key))
+                else:
+                    self.log.debug('Balancing root %s (pools %s) by %s' %
+                                   (root, pools, key))
                 target = best_pe.target_by_root[root]
                 actual = best_pe.actual_by_root[root][key]
                 queue = sorted(actual.keys(),