Permalink
Browse files

add signatures metric to auth, so we can plot signatures/second

  • Loading branch information...
1 parent e5217bb commit 1b97ba09b512d03b9936d4ae1f972a2c77883f42 @ahupowerdns ahupowerdns committed with mind04 Dec 10, 2014
Showing with 9 additions and 2 deletions.
  1. +1 −1 pdns/common_startup.cc
  2. +8 −1 pdns/dnssecsigner.cc
@@ -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");
@@ -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

0 comments on commit 1b97ba0

Please sign in to comment.