[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [doctor/master] Shorten and summarize fallback directory irc notifications
commit 352d5de72554f779eeca281c5d273f59901b84b4
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Sat Jun 22 12:47:03 2019 -0700
Shorten and summarize fallback directory irc notifications
Adjusting the irc notifications per teor's request...
https://trac.torproject.org/projects/tor/ticket/30940
In particiular notifications now begin with a count summary (like emails), and
present at most four relays. For example...
[fallback-directories] 157/157 (100%) fallback directories have become slow or unresponsive...
[fallback-directories] 8FA37B93397015B2BC5A525C908485260BE9F422 => ORPort is unreachable (81.7.11.96:9001)
[fallback-directories] 36B9E7AC1E36B62A9D6F330ABEB6012BA7F0D400 => ORPort is unreachable (37.187.22.87:9001)
[fallback-directories] 230A8B2A8BA861210D9B4BA97745AEC217A94207 => ORPort is unreachable (163.172.176.167:443)
[fallback-directories] 823AA81E277F366505545522CEDC2F529CE4DC3F => ORPort is unreachable (192.160.102.164:9001)
[fallback-directories] ... and 153 more
---
fallback_directories.py | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/fallback_directories.py b/fallback_directories.py
index 184c971..231927e 100755
--- a/fallback_directories.py
+++ b/fallback_directories.py
@@ -19,11 +19,7 @@ log = util.get_logger('fallback_directories')
NOTIFICATION_THRESHOLD = 25 # send notice if this percentage of fallbacks are unusable
TO_ADDRESSES = ['tor-consensus-health@xxxxxxxxxxxxxxxxxxxx', 'teor@xxxxxxxxxxxxxx', 'nickm@xxxxxxxxxxxxxx', 'gus@xxxxxxxxxxxxxx']
EMAIL_SUBJECT = 'Fallback Directory Summary (%i/%i, %i%%)'
-
-EMAIL_BODY = """\
-%i/%i (%i%%) fallback directories have become slow or unresponsive...
-
-"""
+SYNOPSIS = '%i/%i (%i%%) fallback directories have become slow or unresponsive...'
downloader = stem.descriptor.remote.DescriptorDownloader(timeout = 30)
@@ -70,14 +66,24 @@ def main():
if issue_percent >= NOTIFICATION_THRESHOLD:
log.info('Sending notification')
+ synopsis = SYNOPSIS % (len(issues), len(fallback_directories), issue_percent)
subject = EMAIL_SUBJECT % (len(issues), len(fallback_directories), issue_percent)
- body = EMAIL_BODY % (len(issues), len(fallback_directories), issue_percent)
- util.send(subject, body = body + '\n'.join([' * %s' % issue for issue in issues]), to = TO_ADDRESSES)
+ email_body = synopsis + '\n\n' + '\n'.join([' * %s' % issue for issue in issues])
+ util.send(subject, body = email_body, to = TO_ADDRESSES)
# notification for #tor-bots
- body = '\n'.join(['[fallback-directories] %s' % issue for issue in issues])
+ irc_lines = [synopsis]
+
+ for i, issue in enumerate(issues):
+ if i < 4:
+ irc_lines.append(issue)
+ else:
+ irc_lines.append('... and %i more' % (len(issues) - i))
+ break
+
+ irc_body = '\n'.join(['[fallback-directories] %s' % line for line in irc_lines])
util.send('Announce or', body = body, to = ['tor-misc@xxxxxxxxxxxxxxxxxx'])
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits