]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
auth: Change StatType for some metrics from counter to gauge
authorMischan Toosarani-Hausberger <migosch@gmail.com>
Tue, 2 Jun 2020 18:40:03 +0000 (20:40 +0200)
committerMischan Toosarani-Hausberger <migosch@gmail.com>
Fri, 5 Jun 2020 21:28:18 +0000 (23:28 +0200)
"packetcache-size" and "query-cache-size" are both decremented and
incremented and thus clearly gauges.

"security-status" is an ordered category and thus also qualifies as a
gauge.

docs/http-api/index.rst
pdns/auth-packetcache.cc
pdns/auth-querycache.cc
pdns/common_startup.cc
pdns/statbag.cc
pdns/statbag.hh

index decfd4dc26d04da79afebc9ebde981e6e572194c..81ee64ea17e9f8eb598334ce13074bac3218c539 100644 (file)
@@ -79,7 +79,7 @@ A simple ``GET`` request will return a response similar to the following:
   # TYPE pdns_auth_packetcache_miss counter
   pdns_auth_packetcache_miss 0
   # HELP pdns_auth_packetcache_size Number of entries in the packet cache
-  # TYPE pdns_auth_packetcache_size counter
+  # TYPE pdns_auth_packetcache_size gauge
   pdns_auth_packetcache_size 0
   # HELP pdns_auth_query_cache_hit Number of hits on the query cache
   # TYPE pdns_auth_query_cache_hit counter
@@ -88,7 +88,7 @@ A simple ``GET`` request will return a response similar to the following:
   # TYPE pdns_auth_query_cache_miss counter
   pdns_auth_query_cache_miss 0
   # HELP pdns_auth_query_cache_size Number of entries in the query cache
-  # TYPE pdns_auth_query_cache_size counter
+  # TYPE pdns_auth_query_cache_size gauge
   pdns_auth_query_cache_size 0
   # HELP pdns_auth_rd_queries Number of recursion desired questions
   # TYPE pdns_auth_rd_queries counter
@@ -103,7 +103,7 @@ A simple ``GET`` request will return a response similar to the following:
   # TYPE pdns_auth_recursion_unanswered counter
   pdns_auth_recursion_unanswered 0
   # HELP pdns_auth_security_status Security status based on regular polling
-  # TYPE pdns_auth_security_status counter
+  # TYPE pdns_auth_security_status gauge
   pdns_auth_security_status 0
   # HELP pdns_auth_servfail_packets Number of times a server-failed packet was sent out
   # TYPE pdns_auth_servfail_packets counter
index 759864e58888323b83981edccd7e210e9c004ad7..1cb554f44ed4e4513594ecd1527608ba0e9ecc6b 100644 (file)
@@ -34,7 +34,7 @@ AuthPacketCache::AuthPacketCache(size_t mapsCount): d_maps(mapsCount), d_lastcle
 {
   S.declare("packetcache-hit", "Number of hits on the packet cache");
   S.declare("packetcache-miss", "Number of misses on the packet cache");
-  S.declare("packetcache-size", "Number of entries in the packet cache");
+  S.declare("packetcache-size", "Number of entries in the packet cache", StatType::gauge);
   S.declare("deferred-packetcache-inserts","Amount of packet cache inserts that were deferred because of maintenance");
   S.declare("deferred-packetcache-lookup","Amount of packet cache lookups that were deferred because of maintenance");
 
index f98d9b133d875aa8d15222ac17c40d0831ae426a..82489e1e9214a4fafa33fdf1941d8221d1e3d491 100644 (file)
@@ -35,7 +35,7 @@ AuthQueryCache::AuthQueryCache(size_t mapsCount): d_maps(mapsCount), d_lastclean
 {
   S.declare("query-cache-hit","Number of hits on the query cache");
   S.declare("query-cache-miss","Number of misses on the query cache");
-  S.declare("query-cache-size", "Number of entries in the query cache");
+  S.declare("query-cache-size", "Number of entries in the query cache", StatType::gauge);
   S.declare("deferred-cache-inserts","Amount of cache inserts that were deferred because of maintenance");
   S.declare("deferred-cache-lookup","Amount of cache lookups that were deferred because of maintenance");
 
index 1c67740d2200b6de91cf43df72d7c5cdf928c648..fe4994cc1392e12ad86babd5a76d95682f7e0ba1 100644 (file)
@@ -370,7 +370,7 @@ void declareStats(void)
   S.declare("servfail-packets","Number of times a server-failed packet was sent out");
   S.declare("latency","Average number of microseconds needed to answer a question", getLatency, StatType::gauge);
   S.declare("timedout-packets","Number of packets which weren't answered within timeout set");
-  S.declare("security-status", "Security status based on regular polling");
+  S.declare("security-status", "Security status based on regular polling", StatType::gauge);
   S.declareDNSNameQTypeRing("queries","UDP Queries Received");
   S.declareDNSNameQTypeRing("nxdomain-queries","Queries for non-existent records within existent domains");
   S.declareDNSNameQTypeRing("noerror-queries","Queries for existing records, but for type we don't have");
index 3dd5a8de123bf54afd226b7ba78e47014688eac4..70eddcb2445946e4d8ec92cb60000042103fcba7 100644 (file)
@@ -103,12 +103,12 @@ StatType StatBag::getStatType(const string &item)
   return d_statTypes[item];
 }
 
-void StatBag::declare(const string &key, const string &descrip)
+void StatBag::declare(const string &key, const string &descrip, StatType statType)
 {
   auto i=make_unique<AtomicCounter>(0);
   d_stats[key]=std::move(i);
   d_keyDescrips[key]=descrip;
-  d_statTypes[key]=StatType::counter;
+  d_statTypes[key]=statType;
 }
 
 void StatBag::declare(const string &key, const string &descrip, StatBag::func_t func, StatType statType)
index 3026912590734030c653b7a070f32591cd07f2ed..1887b7833a4cc5c329b7f5599a7260a721fd6d21 100644 (file)
@@ -87,7 +87,7 @@ class StatBag
 public:
   StatBag(); //!< Naked constructor. You need to declare keys before this class becomes useful
   ~StatBag();
-  void declare(const string &key, const string &descrip=""); //!< Before you can store or access a key, you need to declare it
+  void declare(const string &key, const string &descrip="", StatType statType=StatType::counter); //!< Before you can store or access a key, you need to declare it
   void declare(const string &key, const string &descrip, func_t func, StatType statType); //!< Before you can store or access a key, you need to declare it
 
   void declareRing(const string &name, const string &title, unsigned int size=10000);