Skip to content

Log "no action" messages at a DEBUG level #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion patroni/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ def __init__(self, config: 'Config') -> None:
self.next_run = time.time()
self.scheduled_restart: Dict[str, Any] = {}

self._last_cycle_info = ""

def load_dynamic_configuration(self) -> None:
"""Load Patroni dynamic configuration.

Expand Down Expand Up @@ -198,7 +200,15 @@ def _run_cycle(self) -> None:
the change and cache the new dynamic configuration values in ``patroni.dynamic.json`` file under Postgres data
directory.
"""
logger.info(self.ha.run_cycle())

info: str = self.ha.run_cycle()
# if we report no action, show this message as INFO only when emitted for the first time
# demote it to DEBUG afterwards as long as it repeats
log_ha_action = logger.info
if info.startswith('no action.') or info.startswith('PAUSE: no action.') and self._last_cycle_info == info:
log_ha_action = logger.debug

log_ha_action(info)

if self.dcs.cluster and self.dcs.cluster.config and self.dcs.cluster.config.data \
and self.config.set_dynamic_configuration(self.dcs.cluster.config):
Expand Down