[tor-commits] [doctor/master] Messages about unmesured relays weren't being effectively suppressed

atagar at torproject.org atagar at torproject.org
Sun Aug 31 23:31:06 UTC 2014


commit 67ae3828256ae5ceb2184cbe53bdf9f6504be999
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun Aug 31 16:30:48 2014 -0700

    Messages about unmesured relays weren't being effectively suppressed
    
    We suppress messages based on their content but the notice about unmeasured
    relays have stats that change each hour. As a result they effectively weren't
    being suppressed causing a notice each hour.
    
    Adding a hack to clobber the dynamic data so our suppression string will
    work...
    
      As_a_bandwidth_authority_gabelmoo_lacked_a_measurement_for_0_of_0_relays_(0%) 1409527674
    
    I'm not thrilled with this solution, but we can add generic handling when we
    have more than one message that needs it.
---
 consensus_health_checker.py |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/consensus_health_checker.py b/consensus_health_checker.py
index 25a1143..e3cc7bf 100755
--- a/consensus_health_checker.py
+++ b/consensus_health_checker.py
@@ -178,7 +178,18 @@ def main():
   is_all_suppressed = True  # either no issues or they're all already suppressed
 
   for issue in issues:
-    key = issue.get_message().replace(' ', '_')
+    if issue._template == 'TOO_MANY_UNMEASURED_RELAYS':
+      # Hack because this message has too much dynamic data to be effectively
+      # suppressed. Hate doing this here, so better would be to make this a
+      # config property.
+
+      attr = dict(issue._attr)
+      attr.update({'unmeasured': 0, 'total': 0, 'percentage': 0})
+
+      key = CONFIG['msg'][issue._template].format(**attr).replace(' ', '_')
+    else:
+      key = issue.get_message().replace(' ', '_')
+
     duration = issue.get_suppression_duration()
 
     if rate_limit_notice(key, duration):



More information about the tor-commits mailing list