Skip to content

Commit

Permalink
Fix metric
Browse files Browse the repository at this point in the history
  • Loading branch information
kaapstorm committed Oct 19, 2024
1 parent ea918f3 commit d35d19f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions corehq/motech/repeaters/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,11 +436,16 @@ def update_repeater(repeat_record_states, repeater_id, lock_token):
multiprocess_mode=MPM_MAX
)

# This metric monitors the number of Repeaters waiting to be sent. A
# steep increase indicates a problem with `process_repeaters()`.

def get_all_ready_count():
return Repeater.objects.all_ready().count()


# This metric monitors the number of Repeaters with RepeatRecords ready to
# be sent. A steep increase indicates a problem with `process_repeaters()`.
metrics_gauge_task(
'commcare.repeaters.all_ready',
lambda: Repeater.objects.all_ready().count(),
get_all_ready_count,
run_every=crontab(minute='*/5'), # every five minutes
multiprocess_mode=MPM_MAX
)

0 comments on commit d35d19f

Please sign in to comment.