]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
add signatures metric to auth, so we can plot signatures/second
authorbert hubert <bert.hubert@netherlabs.nl>
Wed, 10 Dec 2014 15:43:26 +0000 (16:43 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Wed, 10 Dec 2014 15:43:26 +0000 (16:43 +0100)
pdns/common_startup.cc
pdns/dnssecsigner.cc

index d57b666c53a8782743e2c25e561ff5b0fabcf9e7..86bba3fbbc3755da3eef2e4cbe6b5e7f70f45dd9 100644 (file)
@@ -219,7 +219,7 @@ void declareStats(void)
   S.declare("recursing-answers","Number of recursive answers sent out");
   S.declare("recursing-questions","Number of questions sent to recursor");
   S.declare("corrupt-packets","Number of corrupt packets received");
-
+  S.declare("signatures", "Number of DNSSEC signatures made");
   S.declare("tcp-queries","Number of TCP queries received");
   S.declare("tcp-answers","Number of answers sent out over TCP");
 
index 680ce31d48b883db7c45f1189fcb21ae3e94c4ae..3ecbf35483f337634ad9cb312b48d26760d57956 100644 (file)
@@ -27,6 +27,8 @@
 #include "dns_random.hh"
 #include "lock.hh"
 #include "arguments.hh"
+#include "statbag.hh"
+extern StatBag S;
 
 /* this is where the RRSIGs begin, keys are retrieved,
    but the actual signing happens in fillOutRRSIG */
@@ -121,6 +123,8 @@ typedef map<pair<string, string>, string> signaturecache_t;
 static signaturecache_t g_signatures;
 static int g_cacheweekno;
 
+AtomicCounter* g_signatureCount;
+
 uint64_t signatureCacheSize(const std::string& str)
 {
   ReadLock l(&g_signatures_lock);
@@ -129,6 +133,9 @@ uint64_t signatureCacheSize(const std::string& str)
 
 void fillOutRRSIG(DNSSECPrivateKey& dpk, const std::string& signQName, RRSIGRecordContent& rrc, vector<shared_ptr<DNSRecordContent> >& toSign) 
 {
+  if(!g_signatureCount)
+    g_signatureCount = S.getPointer("signatures");
+    
   DNSKEYRecordContent drc = dpk.getDNSKEY(); 
   const DNSCryptoKeyEngine* rc = dpk.getKey();
   rrc.d_tag = drc.getTag();
@@ -150,7 +157,7 @@ void fillOutRRSIG(DNSSECPrivateKey& dpk, const std::string& signQName, RRSIGReco
   }
   
   rrc.d_signature = rc->sign(msg);
-
+  (*g_signatureCount)++;
   if(doCache) {
     /* we add some jitter here so not all your slaves start pruning their caches at the very same millisecond */
     int weekno = (time(0) - dns_random(3600)) / (86400*7);  // we just spent milliseconds doing a signature, microsecond more won't kill us