]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2136] removed 'set' command and introduced a 'poll-interval' config item
authorNaoki Kambe <kambe@jprs.co.jp>
Sat, 21 Jul 2012 12:51:31 +0000 (21:51 +0900)
committerNaoki Kambe <kambe@jprs.co.jp>
Wed, 8 Aug 2012 11:44:58 +0000 (20:44 +0900)
The description about 'set' command was removed from the manpages, and
A 'poll-interval' config item was introduced into the manpages. Also
the implement, the testcases and specification related to the set
command were removed from source codes and the specfile.

src/bin/stats/b10-stats.8
src/bin/stats/b10-stats.xml
src/bin/stats/stats.py.in
src/bin/stats/stats.spec
src/bin/stats/tests/b10-stats_test.py

index 2b9df85a51b66aa99392a51fe41324a6c7be4eeb..56ee4d0821433aca7c16d71374218f8dff4310fb 100644 (file)
@@ -1,7 +1,7 @@
 '\" t
 .\"     Title: b10-stats
 .\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
-.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\" Generator: DocBook XSL Stylesheets v1.77.1 <http://docbook.sf.net/>
 .\"      Date: June 20, 2012
 .\"    Manual: BIND10
 .\"    Source: BIND10
@@ -9,6 +9,15 @@
 .\"
 .TH "B10\-STATS" "8" "June 20, 2012" "BIND10" "BIND10"
 .\" -----------------------------------------------------------------
+.\" * Define some portability stuff
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" http://bugs.debian.org/507673
+.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.ie \n(.g .ds Aq \(aq
+.el       .ds Aq '
+.\" -----------------------------------------------------------------
 .\" * set default formatting
 .\" -----------------------------------------------------------------
 .\" disable hyphenation
@@ -37,7 +46,12 @@ and communicates by using the Command Channel by
 with other modules like
 \fBbind10\fR,
 \fBb10\-auth\fR
-and so on\&. It waits for coming data from other modules, then other modules send data to stats module periodically\&. Other modules send stats data to stats module independently from implementation of stats module, so the frequency of sending data may not be constant\&. The stats module collects data and aggregates it\&.
+and so on\&.
+\fBb10\-stats\fR
+periodically requests statistics data to each module and receives\&. The interval time can be configured via
+\fBbindctl\fR\&.
+\fBb10\-stats\fR
+cannot accept any command from other modules for updating statistics data\&. The stats module collects data and aggregates it\&.
 \fBb10\-stats\fR
 invokes an internal command for
 \fBbind10\fR
@@ -53,17 +67,20 @@ This enables maximum debug logging\&.
 .RE
 .SH "CONFIGURATION AND COMMANDS"
 .PP
-The
+The configurable setting in
+stats\&.spec
+is:
+.PP
+\fIpoll\-interval\fR
+.RS 4
+is a timer interval in seconds for
 \fBb10\-stats\fR
-command does not have any configurable settings\&.
+to polling each module for its statistics data\&. The default is 60 second\&. Polling can be disabled by setting to 0\&. The type of the value should be an unsigned integer\&. Setting to a negative integer is ignored\&.
+.RE
 .PP
 The configuration commands are:
 .PP
 
-\fBset\fR
-will set new statistics data specified in arguments\&. Statistics data to be set and the module name which owns statistics data are required in argument\&. Pid of the module in argument is optional\&.
-.PP
-
 \fBshow\fR
 will send the statistics data in JSON format\&. By default, it outputs all the statistics data it has collected\&. An optional item name may be specified to receive individual output\&.
 .PP
@@ -93,7 +110,7 @@ statistics:
 .PP
 boot_time
 .RS 4
-The date and time when this daemon was started in ISO 8601 format\&. This is a constant which can\'t be reset except by restarting
+The date and time when this daemon was started in ISO 8601 format\&. This is a constant which can\*(Aqt be reset except by restarting
 \fBb10\-stats\fR\&.
 .RE
 .PP
@@ -106,7 +123,7 @@ lname
 .RS 4
 This is the name used for the
 \fBb10\-msgq\fR
-command\-control channel\&. (This is a constant which can\'t be reset except by restarting
+command\-control channel\&. (This is a constant which can\*(Aqt be reset except by restarting
 \fBb10\-stats\fR\&.)
 .RE
 .PP
index 32b636f66c4aa1f2626404a2463f71d9cf1a22f0..b0b58d1d5ae99e838dceb459413732add7cafd97 100644 (file)
@@ -1,6 +1,6 @@
 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
                "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
-              [<!ENTITY mdash "&#8212;">]>
+               [<!ENTITY mdash "&#8212;">]>
 <!--
  - Copyright (C) 2010-2012  Internet Systems Consortium, Inc. ("ISC")
  -
       <command>bind10</command> and communicates by using the
       Command Channel by <command>b10-msgq</command> with other
       modules like <command>bind10</command>, <command>b10-auth</command>
-      and so on. It waits for coming data from other modules, then
-      other modules send data to stats module periodically. Other
-      modules send stats data to stats module independently from
-      implementation of stats module, so the frequency of sending
-      data may not be constant. The stats module collects data and
+      and so on. <command>b10-stats</command> periodically requests statistics
+      data to each module and receives. The interval time can be configured
+      via <command>bindctl</command>. <command>b10-stats</command> cannot
+      accept any command from other modules for updating statistics data. The
+      stats module collects data and
       aggregates it. <command>b10-stats</command> invokes an internal
       command for <command>bind10</command> after its initial
       starting to make sure it collects statistics data from
@@ -78,9 +78,9 @@
       <varlistentry>
         <term><option>-v</option>, <option>--verbose</option></term>
         <listitem>
-         <para>
-          This enables maximum debug logging.
-         </para>
+          <para>
+            This enables maximum debug logging.
+          </para>
         </listitem>
       </varlistentry>
     </variablelist>
     <title>CONFIGURATION AND COMMANDS</title>
 
     <para>
-      The <command>b10-stats</command> command does not have any
-      configurable settings.
+      The configurable setting in <filename>stats.spec</filename> is:
     </para>
 
+    <variablelist>
+      <varlistentry>
+        <term><varname>poll-interval</varname></term>
+        <listitem>
+          <para>
+            is a timer interval in seconds for <command>b10-stats</command> to
+            polling each module for its statistics data. The default is 60
+            second. Polling can be disabled by setting to 0. The type of the
+            value should be an unsigned integer. Setting to a negative integer
+            is ignored.
+          </para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
+
 <!-- TODO: formating -->
     <para>
       The configuration commands are:
     </para>
 
-    <para>
-      <command>set</command> will set new statistics data specified in
-      arguments. Statistics data to be set and the module name which owns
-      statistics data are required in argument. Pid of the module in argument
-      is optional.
-    </para>
-
     <para>
       <command>show</command> will send the statistics data
       in JSON format.
index 2072351549dc763869912c82784b02ab340fa308..398d4fc76bf0bf2f020fffd21046ca0b55d1347e 100755 (executable)
@@ -504,22 +504,6 @@ class Stats:
                 1, "specified arguments are incorrect: " \
                     + "owner: " + str(owner) + ", name: " + str(name))
 
-    def command_set(self, owner, pid=-1, data={}):
-        """
-        handle set command
-        """
-        errors = self.update_statistics_data(owner, pid, **data)
-        if errors:
-            return isc.config.create_answer(
-                1, "errors while setting statistics data: " \
-                    + ", ".join(errors))
-        errors = self.update_statistics_data(
-            self.module_name, last_update_time=get_datetime() )
-        if errors:
-            raise StatsError("stats spec file is incorrect: "
-                             + ", ".join(errors))
-        return isc.config.create_answer(0)
-
 if __name__ == "__main__":
     try:
         parser = OptionParser()
index 5be5e947ec94fcbadac6b74114681d76ff4173d9..6fbf7bbe4f4a70326183f57da4181ee8ece7a7c4 100644 (file)
             "item_description": "statistics item name of the owner"
           }
         ]
-      },
-      {
-        "command_name": "set",
-        "command_description": "set the value of specified name in statistics data",
-        "command_args": [
-          {
-            "item_name": "owner",
-            "item_type": "string",
-            "item_optional": false,
-            "item_default": "",
-            "item_description": "module name of the owner of the statistics data"
-          },
-         {
-           "item_name": "pid",
-            "item_type": "integer",
-            "item_optional": true,
-            "item_default": -1,
-            "item_description": "process id of the owner module"
-          },
-         {
-           "item_name": "data",
-            "item_type": "map",
-            "item_optional": false,
-            "item_default": {},
-            "item_description": "statistics data set of the owner",
-            "map_item_spec": []
-          }
-        ]
       }
     ],
     "statistics": [
index 724affb138d764fc8bf3ffce9542cd62f1fc00f0..d77077b187f4c7550ac0fb773e41463dcfb1a04f 100644 (file)
@@ -168,7 +168,6 @@ class TestStats(unittest.TestCase):
         self.assertTrue('command_shutdown' in self.stats.callbacks)
         self.assertTrue('command_show' in self.stats.callbacks)
         self.assertTrue('command_showschema' in self.stats.callbacks)
-        self.assertTrue('command_set' in self.stats.callbacks)
         self.assertEqual(self.stats.config['poll-interval'], 60)
 
     def test_init_undefcmd(self):
@@ -235,12 +234,6 @@ class TestStats(unittest.TestCase):
                 params={ 'owner' : 'Boss',
                   'name'  : 'boot_time' }),
             (0, {'Boss': {'boot_time': self.const_datetime}}))
-        self.assertEqual(
-            send_command(
-                'set', 'Stats',
-                params={ 'owner' : 'Boss',
-                  'data'  : { 'boot_time' : self.const_datetime } }),
-            (0, None))
         self.assertEqual(
             send_command(
                 'show', 'Stats',
@@ -751,172 +744,6 @@ class TestStats(unittest.TestCase):
                          isc.config.create_answer(
                 1, "module name is not specified"))
 
-    def test_command_set(self):
-        orig_get_datetime = stats.get_datetime
-        stats.get_datetime = lambda : self.const_datetime
-        (rcode, value) = isc.config.ccsession.parse_answer(
-            self.stats.command_set(owner='Boss',
-                                   data={ 'boot_time' : self.const_datetime }))
-        stats.get_datetime = orig_get_datetime
-        self.assertEqual(rcode, 0)
-        self.assertTrue(value is None)
-        self.assertEqual(self.stats.statistics_data['Boss']['boot_time'],
-                         self.const_datetime)
-        self.assertEqual(self.stats.statistics_data['Stats']['last_update_time'],
-                         self.const_datetime)
-        self.assertEqual(self.stats.command_set(owner='Stats',
-                                                data={ 'lname' : 'foo@bar' }),
-                         isc.config.create_answer(0, None))
-        self.stats.statistics_data['Stats'] = {}
-        self.stats.mccs.specification = isc.config.module_spec.ModuleSpec(
-            { "module_name": self.stats.module_name,
-              "statistics": [] } )
-        self.assertEqual(self.stats.command_set(owner='Stats',
-                                                data={ 'lname' : '_foo_@_bar_' }),
-                         isc.config.create_answer(
-                1,
-                "errors while setting statistics data: unknown item lname"))
-        self.stats.statistics_data['Stats'] = {}
-        self.stats.mccs.specification = isc.config.module_spec.ModuleSpec(
-            { "module_name": self.stats.module_name } )
-        self.assertEqual(self.stats.command_set(owner='Stats',
-                                                data={ 'lname' : '_foo_@_bar_' }),
-                         isc.config.create_answer(
-                1,
-                "errors while setting statistics data: No statistics specification"))
-        self.stats.statistics_data['Stats'] = {}
-        self.stats.mccs.specification = isc.config.module_spec.ModuleSpec(
-            { "module_name": self.stats.module_name,
-              "statistics": [
-                    {
-                        "item_name": "dummy",
-                        "item_type": "string",
-                        "item_optional": False,
-                        "item_default": "",
-                        "item_title": "Local Name",
-                        "item_description": "brabra"
-                        } ] } )
-        self.assertRaises(stats.StatsError,
-                          self.stats.command_set, owner='Stats', data={ 'dummy' : '_xxxx_yyyy_zzz_' })
-
-    def test_command_set_withpid(self):
-        # one pid of Auth
-        retval = isc.config.ccsession.parse_answer(
-            self.stats.command_set(owner='Auth',
-                                   pid=9997,
-                                   data={ 'queries.tcp' : 1001,
-                                          'queries.perzone':
-                                              [{ 'zonename': 'test1.example',
-                                                 'queries.tcp': 1 },
-                                               { 'zonename': 'test2.example',
-                                                 'queries.tcp': 2,
-                                                 'queries.udp': 3 }]}))
-        self.assertEqual(retval, (0,None))
-        self.assertTrue('Auth' in self.stats.statistics_data)
-        self.assertTrue('queries.tcp' in self.stats.statistics_data['Auth'])
-        self.assertEqual(self.stats.statistics_data['Auth']['queries.tcp'], 1001)
-        self.assertEqual(self.stats.statistics_data['Auth']['queries.perzone'],
-                         [{ 'zonename': 'test1.example',
-                            'queries.tcp': 1 },
-                          { 'zonename': 'test2.example',
-                            'queries.tcp': 2,
-                            'queries.udp': 3 }])
-        self.assertTrue('Stats' in self.stats.statistics_data)
-        self.assertTrue('last_update_time' in self.stats.statistics_data['Stats'])
-        self.assertTrue('Auth' in self.stats.statistics_data_bypid)
-        self.assertTrue(9997 in self.stats.statistics_data_bypid['Auth'])
-        self.assertTrue('queries.tcp' in self.stats.statistics_data_bypid['Auth'][9997])
-        self.assertTrue('queries.perzone' in self.stats.statistics_data_bypid['Auth'][9997])
-        self.assertEqual(self.stats.statistics_data_bypid['Auth'][9997]['queries.tcp'], 1001)
-        self.assertEqual(self.stats.statistics_data_bypid['Auth'][9997]['queries.perzone'],
-                         [{ 'zonename': 'test1.example',
-                            'queries.tcp': 1 },
-                          { 'zonename': 'test2.example',
-                            'queries.tcp': 2,
-                            'queries.udp': 3 }])
-        # check consolidation of statistics data even if there is
-        # non-existent pid of Auth
-        retval = isc.config.ccsession.parse_answer(
-            self.stats.command_set(owner='Auth',
-                                   pid=10000,
-                                   data={ 'queries.tcp' : 2001,
-                                          'queries.perzone':
-                                              [{ 'zonename': 'test1.example',
-                                                 'queries.tcp': 101 },
-                                               { 'zonename': 'test2.example',
-                                                 'queries.tcp': 102,
-                                                 'queries.udp': 103 }]}))
-        self.assertEqual(retval, (0,None))
-        self.assertTrue('Auth' in self.stats.statistics_data)
-        self.assertTrue('queries.tcp' in self.stats.statistics_data['Auth'])
-        self.assertEqual(self.stats.statistics_data['Auth']['queries.tcp'], 3002)
-        self.assertEqual(self.stats.statistics_data['Auth']['queries.perzone'],
-                         [{ 'zonename': 'test1.example',
-                            'queries.tcp': 102 },
-                          { 'zonename': 'test2.example',
-                            'queries.tcp': 104,
-                            'queries.udp': 106 }])
-        self.assertTrue('Auth' in self.stats.statistics_data_bypid)
-        self.assertTrue(9997 in self.stats.statistics_data_bypid['Auth'])
-        self.assertTrue('queries.tcp' in self.stats.statistics_data_bypid['Auth'][9997])
-        self.assertEqual(self.stats.statistics_data_bypid['Auth'][9997]['queries.tcp'], 1001)
-        self.assertEqual(self.stats.statistics_data_bypid['Auth'][9997]['queries.perzone'],
-                         [{ 'zonename': 'test1.example',
-                            'queries.tcp': 1 },
-                          { 'zonename': 'test2.example',
-                            'queries.tcp': 2,
-                            'queries.udp': 3 }])
-        # another pid of Auth
-        retval = isc.config.ccsession.parse_answer(
-            self.stats.command_set(owner='Auth',
-                                   pid=9996,
-                                   data={ 'queries.tcp' : 1002,
-                                          'queries.udp' : 1003,
-                                          'queries.perzone':
-                                              [{ 'zonename': 'test1.example',
-                                                 'queries.tcp': 10,
-                                                 'queries.udp': 11},
-                                               { 'zonename': 'test2.example',
-                                                 'queries.tcp': 12,
-                                                 'queries.udp': 13 }]}))
-        self.assertEqual(retval, (0,None))
-        self.assertTrue('Auth' in self.stats.statistics_data)
-        self.assertTrue('queries.tcp' in self.stats.statistics_data['Auth'])
-        self.assertTrue('queries.udp' in self.stats.statistics_data['Auth'])
-        self.assertTrue('queries.perzone' in self.stats.statistics_data['Auth'])
-        self.assertEqual(self.stats.statistics_data['Auth']['queries.tcp'], 4004)
-        self.assertEqual(self.stats.statistics_data['Auth']['queries.udp'], 1003)
-        self.assertEqual(self.stats.statistics_data['Auth']['queries.perzone'],
-                         [{ 'zonename': 'test1.example',
-                            'queries.tcp': 112,
-                            'queries.udp': 11},
-                          { 'zonename': 'test2.example',
-                            'queries.tcp': 116,
-                            'queries.udp': 119 }])
-        self.assertTrue('Auth' in self.stats.statistics_data_bypid)
-        self.assertTrue(9997 in self.stats.statistics_data_bypid['Auth'])
-        self.assertTrue(9996 in self.stats.statistics_data_bypid['Auth'])
-        self.assertTrue('queries.tcp' in self.stats.statistics_data_bypid['Auth'][9997])
-        self.assertTrue('queries.udp' in self.stats.statistics_data_bypid['Auth'][9996])
-        self.assertTrue('queries.udp' in self.stats.statistics_data_bypid['Auth'][9996])
-        self.assertTrue('queries.perzone' in self.stats.statistics_data_bypid['Auth'][9996])
-        self.assertEqual(self.stats.statistics_data_bypid['Auth'][9997]['queries.tcp'], 1001)
-        self.assertEqual(self.stats.statistics_data_bypid['Auth'][9997]['queries.perzone'],
-                         [{ 'zonename': 'test1.example',
-                            'queries.tcp': 1 },
-                          { 'zonename': 'test2.example',
-                            'queries.tcp': 2,
-                            'queries.udp': 3 }])
-        self.assertEqual(self.stats.statistics_data_bypid['Auth'][9996]['queries.tcp'], 1002)
-        self.assertEqual(self.stats.statistics_data_bypid['Auth'][9996]['queries.udp'], 1003)
-        self.assertEqual(self.stats.statistics_data_bypid['Auth'][9996]['queries.perzone'],
-                         [{ 'zonename': 'test1.example',
-                            'queries.tcp': 10,
-                            'queries.udp': 11},
-                          { 'zonename': 'test2.example',
-                            'queries.tcp': 12,
-                            'queries.udp': 13 }])
-
 class TestOSEnv(unittest.TestCase):
     def test_osenv(self):
         """