Skip to content

Commit

Permalink
Issue #92 - Update limit monitoring with checks for lowering repeat n…
Browse files Browse the repository at this point in the history
…otifications

Implements new limit trip notification 'frequency' config
by triggering notifications every 'frequency' consecutive
limit-tripping packet, not taking 'threshold' into account.
  • Loading branch information
aywaldron committed Dec 4, 2018
1 parent 9c43ca8 commit f71570b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ait/gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ def telem_handler(session):
packet_dict[v.uid] = v

notif_thrshld = cfg.AitConfig.get('notifications.options.threshold')
notif_freq = cfg.AitConfig.get('notifications.options.frequency')

log.info('Starting telemetry limit monitoring')
try:
Expand All @@ -416,7 +417,8 @@ def telem_handler(session):

limit_trip_repeats[packet.name][field] += 1

if limit_trip_repeats[packet.name][field] == notif_thrshld:
if limit_trip_repeats[packet.name][field] == notif_thrshld or
limit_trip_repeats[packet.name][field] % notif_freq == 0:
notify.trigger_notification('limit-error', msg)

elif defn.warn(v):
Expand All @@ -425,7 +427,8 @@ def telem_handler(session):

limit_trip_repeats[packet.name][field] += 1

if limit_trip_repeats[packet.name][field] == notif_thrshld:
if limit_trip_repeats[packet.name][field] == notif_thrshld or
limit_trip_repeats[packet.name][field] % notif_freq == 0:
notify.trigger_notification('limit-warn', msg)

else:
Expand Down

0 comments on commit f71570b

Please sign in to comment.