Add support for healthchecks "log" feature #628 #645

Merged
witten merged 8 commits from :feat628-add-healtchecks-logs-support into master 2023-03-07 22:21:31 +00:00
2 changed files with 16 additions and 0 deletions
Showing only changes of commit 4fcfddbe08 - Show all commits

View File

@ -27,6 +27,14 @@ def ping_monitor(hook_config, config_filename, state, monitoring_log_level, dry_
Ping the configured Cronhub URL, modified with the monitor.State. Use the given configuration
filename in any log entries. If this is a dry run, then don't actually ping anything.
'''
if state not in MONITOR_STATE_TO_CRONHUB:
logger.debug(
'{}: Ignoring unsupported monitoring {} in Cronhub hook'.format(
Soumik_Dutta marked this conversation as resolved
Review

Heads up that I've been slowly starting to use f-strings instead of .format() in new code (or converting to f-strings when I work on old code). It's totally fine if you don't do it here though.

Heads up that I've been slowly starting to use [f-strings](https://realpython.com/python-f-strings/) instead of `.format()` in new code (or converting to f-strings when I work on old code). It's totally fine if you don't do it here though.
config_filename, state.name.lower()
)
)
return
dry_run_label = ' (dry run; not actually pinging)' if dry_run else ''
formatted_state = '/{}/'.format(MONITOR_STATE_TO_CRONHUB[state])
ping_url = (

View File

@ -27,6 +27,14 @@ def ping_monitor(hook_config, config_filename, state, monitoring_log_level, dry_
Ping the configured Cronitor URL, modified with the monitor.State. Use the given configuration
filename in any log entries. If this is a dry run, then don't actually ping anything.
'''
if state not in MONITOR_STATE_TO_CRONITOR:
logger.debug(
'{}: Ignoring unsupported monitoring {} in Cronitor hook'.format(
config_filename, state.name.lower()
)
)
return
Soumik_Dutta marked this conversation as resolved
Review

This looks great!

This looks great!
dry_run_label = ' (dry run; not actually pinging)' if dry_run else ''
ping_url = '{}/{}'.format(hook_config['ping_url'], MONITOR_STATE_TO_CRONITOR[state])