]> granicus.if.org Git - pdns/commitdiff
teach dnsdist about uptime metric
authorbert hubert <bert.hubert@netherlabs.nl>
Sat, 31 Oct 2015 18:26:25 +0000 (19:26 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Sat, 31 Oct 2015 18:26:25 +0000 (19:26 +0100)
pdns/dnsdist-carbon.cc
pdns/dnsdist.hh

index e9fc295db06ebd6b2dd6751a865158b6620bfd52..69ab9521a5903c5cd723512126da73b8bc4f343e 100644 (file)
 #include "dnsdist.hh"
 
 GlobalStateHolder<CarbonConfig> g_carbon;
+static time_t s_start=time(0);
+uint64_t uptimeOfProcess(const std::string& str)
+{
+  return time(0) - s_start;
+}
 
 void* carbonDumpThread()
 try
index 09f8aefd981dcdba2429eee5082de950a5c6bf9f..c1e74374525cbc12d6e43942ae11f837703f9229 100644 (file)
@@ -11,6 +11,7 @@
 #include <thread>
 #include "sholder.hh"
 void* carbonDumpThread();
+uint64_t uptimeOfProcess(const std::string& str);
 struct DNSDistStats
 {
   using stat_t=std::atomic<uint64_t>; // aww yiss ;-)
@@ -43,6 +44,7 @@ struct DNSDistStats
     {"latency100-1000", &latency100_1000}, {"latency-slow", &latencySlow},
     {"latency-avg100", &latencyAvg100}, {"latency-avg1000", &latencyAvg1000}, 
     {"latency-avg10000", &latencyAvg10000}, {"latency-avg1000000", &latencyAvg1000000},
+    {"uptime", uptimeOfProcess},
     {"real-memory-usage", getRealMemoryUsage}
   };
 };