[bind10-dev] How to implement query counters in auth module?

Naoki Kambe kambe at jprs.co.jp
Mon Sep 13 12:36:56 UTC 2010

Jinmei-san, Evan-san,

This is a question related to trac #191.  We need to add some
implements into the auth module in order that the stats module works
along with the auth module. Because the auth module doesn't either
seem to have query counters nor throw counters to the stats module. So
the stats module can't collect query counters from the auth module in
current source files. I want to know how to implement that. Can you
give me any suggestions? I think I may add following implements into
auth_srv.cc and/or some source files in the auth module:

    - Received Query counters
      + They are ones over UDP and TCP.
      + The variables of counters are shared with several auth
    - Throwing the counts toward the stats module periodically

  An example code:	# This may be wrong or inefficient.
    // a query counter over UDP
    static int udp_queries = 0
    // receives queries and increase counters
    // construct command
    static string udp_queries_str;
    sprintf(udp_queries_str, "%d", udp_queries);
    static string stats_command = "{ \"command\": ["
       		  	       	+ "  \"increase\","
       		  	       	+ "   { \"stats_data\": {"
       		  	       	+ "       \"auth.queries.udp\": " + udp_queries_str
       		  	       	+ "     }"
       		  	       	+ "   }"
       		  	       	+ "  ]"
       		  	       	+ "}";
    // throw the count
    stats_session->group_sendmsg(stats_command, "Stats", "*", "*");
    // reset counter and return to init
    udp_queries = 0;

      ... I think the case of TCP is almost same above.

  Please refer to the wikipage for details:


Naoki Kambe

More information about the bind10-dev mailing list