]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
mon/MgrStatMonitor: ignore duration for which feature is off
authorShraddha Agrawal <shraddha.agrawal000@gmail.com>
Thu, 22 May 2025 10:26:41 +0000 (15:56 +0530)
committerShraddha Agrawal <shraddha.agrawal000@gmail.com>
Thu, 12 Jun 2025 10:50:25 +0000 (16:20 +0530)
commitd81d2af8fcd708f20f54f863dd613fade57af6e5
tree327341175cf95b13841e8068226ac2026633afcc
parentc318f80ee2eeefbba9865f07026e18c313cba558
mon/MgrStatMonitor: ignore duration for which feature is off

When the availability tracking feature is disabled, we should not
be updating the score. We should start recalculating the score
when the user enables the features again. Essentially, for the
purpose of calculating the score, we need to ignore the duration
for which the feature was turned off.

The score is calculated from the uptime and downtime durations
recorded in `pool_availability` object. These durations are updated
in `calc_pool_availability` by adding the diff between last_uptime/
last_downtime and now.

To discard the duration for which the feature was turned off, we
need to offset the uptime/downtime by this duration. A simple way
to do this is to update the last_uptime and last_downtime to the
timestamp when the feature is toggled on again. To implement the
same, we record the time at which the feature is toggled from off
to on. When `calc_pool_availability` is invoked, if a reset is
required, it resets last_uptime and last_downtime before proceeding
with availability calculations.

We only care about the state when the feature is toggled from off to
on. All other toggle states for the config option will not have any
effect on the score.

Fixes: https://tracker.ceph.com/issues/71494
Signed-off-by: Shraddha Agrawal <shraddhaag@ibm.com>
src/mon/MgrStatMonitor.cc
src/mon/MgrStatMonitor.h