[or-cvs] r22612: {arm} change: notice level log entry for bandwidth prepopulation s (in arm/trunk: . interface/graphing util)

Damian Johnson atagar1 at gmail.com
Wed Jul 7 04:09:30 UTC 2010


Author: atagar
Date: 2010-07-07 04:09:30 +0000 (Wed, 07 Jul 2010)
New Revision: 22612

Modified:
   arm/trunk/TODO
   arm/trunk/armrc.sample
   arm/trunk/interface/graphing/bandwidthStats.py
   arm/trunk/util/connections.py
Log:
change: notice level log entry for bandwidth prepopulation success
fix: only raising connection resolution rate if deemed necessary by multiple subsiquent entires



Modified: arm/trunk/TODO
===================================================================
--- arm/trunk/TODO	2010-07-07 00:35:46 UTC (rev 22611)
+++ arm/trunk/TODO	2010-07-07 04:09:30 UTC (rev 22612)
@@ -9,12 +9,7 @@
       progress - /init and /util are done and /interface is in progress. Known
       bugs are being fixed while refactoring.
         [X] header panel
-        [ ] graph panel
-          - prepopulate bandwidth graph with contents of state file
-              Open questions:
-                - How frequently are the bandwidth values in the state file
-                updated?
-                - Is it every second, matching the last BW events?
+        [X] graph panel
         [ ] log panel
           - option to clear log
           - allow home/end keys to jump to start/end
@@ -157,12 +152,6 @@
         'SETEVENTS')
         - 'guard' option that restricts to GETINFO only  (start with this)
         - issue sighup reset
-  * provide observed bandwidth
-      Newer relays have a 'w' entry that states the bandwidth and old versions
-      have client side measurements (third argument in 'Bandwidth' of
-      descriptor, note that it's in KB/s). Label the former (server side) as 
-      'Measured' and later (client side) as 'Observed' to differentiate.
-      requested by arma
   * menu with all torrc options (making them editable/toggleable)
   * Setup wizard for new relays
       Setting the password and such for torrc generation (idea by ioerror)

Modified: arm/trunk/armrc.sample
===================================================================
--- arm/trunk/armrc.sample	2010-07-07 00:35:46 UTC (rev 22611)
+++ arm/trunk/armrc.sample	2010-07-07 04:09:30 UTC (rev 22612)
@@ -71,6 +71,7 @@
 log.panelRecreated DEBUG
 log.graph.ps.invalidStat WARN
 log.graph.ps.abandon WARN
+log.graph.bw.prepopulateSuccess NOTICE
 log.graph.bw.prepopulateFailure NOTICE
 log.connLookupFailed INFO
 log.connLookupFailover NOTICE

Modified: arm/trunk/interface/graphing/bandwidthStats.py
===================================================================
--- arm/trunk/interface/graphing/bandwidthStats.py	2010-07-07 00:35:46 UTC (rev 22611)
+++ arm/trunk/interface/graphing/bandwidthStats.py	2010-07-07 04:09:30 UTC (rev 22612)
@@ -18,9 +18,10 @@
 # valid keys for the accountingInfo mapping
 ACCOUNTING_ARGS = ("status", "resetTime", "read", "written", "readLimit", "writtenLimit")
 
+PREPOPULATE_SUCCESS_MSG = "Read a day of bandwidth history from the state file"
 PREPOPULATE_FAILURE_MSG = "Unable to prepopulate bandwidth information (%s)"
 
-DEFAULT_CONFIG = {"features.graph.bw.accounting.show": True, "features.graph.bw.accounting.rate": 10, "features.graph.bw.accounting.isTimeLong": False, "log.graph.bw.prepopulateFailure": log.NOTICE}
+DEFAULT_CONFIG = {"features.graph.bw.accounting.show": True, "features.graph.bw.accounting.rate": 10, "features.graph.bw.accounting.isTimeLong": False, "log.graph.bw.prepopulateSuccess": log.NOTICE, "log.graph.bw.prepopulateFailure": log.NOTICE}
 
 class BandwidthStats(graphPanel.GraphStats, TorCtl.PostEventListener):
   """
@@ -158,6 +159,11 @@
     del self.primaryCounts[intervalIndex][self.maxCol + 1:]
     del self.secondaryCounts[intervalIndex][self.maxCol + 1:]
     
+    msg = PREPOPULATE_SUCCESS_MSG
+    missingSec = 900 * max(missingReadEntries, missingWriteEntries)
+    if missingSec: msg += "(last %s is missing)" % uiTools.getTimeLabel(missingSec)
+    log.log(self._config["log.graph.bw.prepopulateSuccess"], msg)
+    
     return True
   
   def bandwidth_event(self, event):

Modified: arm/trunk/util/connections.py
===================================================================
--- arm/trunk/util/connections.py	2010-07-07 00:35:46 UTC (rev 22611)
+++ arm/trunk/util/connections.py	2010-07-07 04:09:30 UTC (rev 22612)
@@ -253,6 +253,10 @@
     self._cond = threading.Condition()  # used for pausing the thread
     self._subsiquentFailures = 0  # number of failed resolutions with the default in a row
     self._resolverBlacklist = []  # resolvers that have failed to resolve
+    
+    # Number of sequential times the threshold rate's been too low. This is to
+    # avoid having stray spikes up the rate.
+    self._rateThresholdBroken = 0
   
   def run(self):
     while not self._halt:
@@ -285,11 +289,14 @@
         
         newMinDefaultRate = 100 * lookupTime
         if self.defaultRate < newMinDefaultRate:
-          # adding extra to keep the rate from frequently changing
-          self.defaultRate = newMinDefaultRate + 0.5
-          
-          msg = "connection lookup time increasing to %0.1f seconds per call" % self.defaultRate
-          log.log(CONFIG["log.connLookupRateGrowing"], msg)
+          if self._rateThresholdBroken >= 3:
+            # adding extra to keep the rate from frequently changing
+            self.defaultRate = newMinDefaultRate + 0.5
+            
+            msg = "connection lookup time increasing to %0.1f seconds per call" % self.defaultRate
+            log.log(CONFIG["log.connLookupRateGrowing"], msg)
+          else: self._rateThresholdBroken += 1
+        else: self._rateThresholdBroken = 0
         
         if isDefault: self._subsiquentFailures = 0
       except IOError, exc:



More information about the tor-commits mailing list