forked from GithubBackups/healthchecks
The sendalerts commands measures notification dwell time and reports it over statsd protocol. Experimental, may go away in a future commit.
This commit is contained in:
parent
5d9944873c
commit
9f2638bf72
@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file.
|
||||
- Add a Pause button in the checks list (#312)
|
||||
- Documentation in Markdown
|
||||
- Added an example of capturing and submitting log output (#315)
|
||||
- The sendalerts commands measures dwell time and reports it over statsd protocol
|
||||
|
||||
### Bug Fixes
|
||||
- Increase the allowable length of Matrix room alias to 100 (#320)
|
||||
|
@ -4,6 +4,7 @@ from threading import Thread
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.utils import timezone
|
||||
from hc.api.models import Check, Flip
|
||||
from statsd.defaults.env import statsd
|
||||
|
||||
|
||||
def notify(flip_id, stdout):
|
||||
@ -24,10 +25,13 @@ def notify(flip_id, stdout):
|
||||
check.project.set_next_nag_date()
|
||||
|
||||
# Send notifications
|
||||
send_time = timezone.now()
|
||||
errors = flip.send_alerts()
|
||||
for ch, error in errors:
|
||||
stdout.write("ERROR: %s %s %s\n" % (ch.kind, ch.value, error))
|
||||
|
||||
statsd.timing("hc.sendalerts.dwellTime", send_time - flip.created)
|
||||
|
||||
|
||||
def notify_on_thread(flip_id, stdout):
|
||||
t = Thread(target=notify, args=(flip_id, stdout))
|
||||
|
@ -4,3 +4,4 @@ django-compressor==2.4
|
||||
psycopg2==2.8.4
|
||||
pytz==2019.3
|
||||
requests==2.22.0
|
||||
statsd=3.3.0
|
Loading…
x
Reference in New Issue
Block a user