Browse Source

The sendalerts commands measures notification dwell time and reports it over statsd protocol. Experimental, may go away in a future commit.

pull/328/head
Pēteris Caune 5 years ago
parent
commit
9f2638bf72
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
3 changed files with 6 additions and 0 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +4
    -0
      hc/api/management/commands/sendalerts.py
  3. +1
    -0
      requirements.txt

+ 1
- 0
CHANGELOG.md View File

@ -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) - Add a Pause button in the checks list (#312)
- Documentation in Markdown - Documentation in Markdown
- Added an example of capturing and submitting log output (#315) - Added an example of capturing and submitting log output (#315)
- The sendalerts commands measures dwell time and reports it over statsd protocol
### Bug Fixes ### Bug Fixes
- Increase the allowable length of Matrix room alias to 100 (#320) - Increase the allowable length of Matrix room alias to 100 (#320)


+ 4
- 0
hc/api/management/commands/sendalerts.py View File

@ -4,6 +4,7 @@ from threading import Thread
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.utils import timezone from django.utils import timezone
from hc.api.models import Check, Flip from hc.api.models import Check, Flip
from statsd.defaults.env import statsd
def notify(flip_id, stdout): def notify(flip_id, stdout):
@ -24,10 +25,13 @@ def notify(flip_id, stdout):
check.project.set_next_nag_date() check.project.set_next_nag_date()
# Send notifications # Send notifications
send_time = timezone.now()
errors = flip.send_alerts() errors = flip.send_alerts()
for ch, error in errors: for ch, error in errors:
stdout.write("ERROR: %s %s %s\n" % (ch.kind, ch.value, error)) 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): def notify_on_thread(flip_id, stdout):
t = Thread(target=notify, args=(flip_id, stdout)) t = Thread(target=notify, args=(flip_id, stdout))


+ 1
- 0
requirements.txt View File

@ -4,3 +4,4 @@ django-compressor==2.4
psycopg2==2.8.4 psycopg2==2.8.4
pytz==2019.3 pytz==2019.3
requests==2.22.0 requests==2.22.0
statsd=3.3.0

Loading…
Cancel
Save