BIND 10 #2883: discuss/remove class (global) attribute of Counters._statistics

BIND 10 Development do-not-reply at isc.org
Fri Mar 22 20:39:21 UTC 2013


#2883: discuss/remove class (global) attribute of Counters._statistics
-------------------------------------+-------------------------------------
                   Reporter:         |                 Owner:
  jinmei                             |                Status:  new
                       Type:         |             Milestone:  Next-Sprint-
  defect                             |  Proposed
                   Priority:         |              Keywords:
  medium                             |             Sensitive:  0
                  Component:         |           Sub-Project:  Core
  statistics                         |  Estimated Difficulty:  0
               CVSS Scoring:         |           Total Hours:  0
            Defect Severity:  N/A    |
Feature Depending on Ticket:         |
        Add Hours to Ticket:  0      |
                  Internal?:  0      |
-------------------------------------+-------------------------------------
 In the Python isc.statistics.counters.Counters class, there's a class
 attribute named `_statistics`:

 {{{#!python
 class Counters():
 ...
     _statistics = _Statistics()

     def __init__(self, spec_file_name=None):
 }}}

 and Counters._statistics effectively works as a global statistics
 object shared by all modules of the program.  I didn't understand why
 it's defined this way yet, but IMO we should avoid such a global
 reference point unless there's a very strong reason for it.

 I believe no one disagrees global variables are a last resort weapon
 and should be avoided in general (I hope I don't have to explain the
 reasons here), and this is indeed a global variable in practice.

 My first suggestion is to simply make it an instance attribute, and
 update the user side code so it won't assume all `Counters` objects
 share the same single statistics data.  If this suggestion happens to
 be controversial, my secondary suggestion is to discuss why this must
 be global, and if the conclusion still holds document it.

-- 
Ticket URL: <http://bind10.isc.org/ticket/2883>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development


More information about the bind10-tickets mailing list