Skip to content

Commit fbc31c2

Browse files
v-zhuravlevsatterly
authored andcommitted
added timeout option (#176)
* added timeout option * removed timeout from HeartbeatOK event; --timeout option cleanup
1 parent 2c37b0c commit fbc31c2

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

alertaclient/commands/cmd_heartbeats.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
@click.command('heartbeats', short_help='List heartbeats')
1111
@click.option('--alert', is_flag=True, help='Alert on stale or slow heartbeats')
1212
@click.option('--severity', '-s', metavar='SEVERITY', default='major', help='Severity for stale heartbeat alerts')
13+
@click.option('--timeout', metavar='SECONDS', default=86000, type=int, help='Seconds before stale heartbeat alerts will be expired')
1314
@click.option('--purge', is_flag=True, help='Delete all stale heartbeats')
1415
@click.pass_obj
15-
def cli(obj, alert, severity, purge):
16+
def cli(obj, alert, severity, timeout, purge):
1617
"""List heartbeats."""
1718
client = obj['client']
1819

@@ -56,6 +57,7 @@ def cli(obj, alert, severity, purge):
5657
text='Heartbeat not received in {} seconds'.format(b.timeout),
5758
tags=tags,
5859
type='heartbeatAlert',
60+
timeout=timeout,
5961
customer=b.customer
6062
)
6163
elif b.status == 'slow':
@@ -71,6 +73,7 @@ def cli(obj, alert, severity, purge):
7173
text='Heartbeat took more than {}ms to be processed'.format(MAX_LATENCY),
7274
tags=tags,
7375
type='heartbeatAlert',
76+
timeout=timeout,
7477
customer=b.customer
7578
)
7679
else:

0 commit comments

Comments
 (0)