From: bert hubert Date: Sat, 31 Oct 2015 18:26:25 +0000 (+0100) Subject: teach dnsdist about uptime metric X-Git-Tag: dnsdist-1.0.0-alpha1~263 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=61d1b966ea128f176f19d26ac30affe387921240;p=pdns teach dnsdist about uptime metric --- diff --git a/pdns/dnsdist-carbon.cc b/pdns/dnsdist-carbon.cc index e9fc295db..69ab9521a 100644 --- a/pdns/dnsdist-carbon.cc +++ b/pdns/dnsdist-carbon.cc @@ -10,6 +10,11 @@ #include "dnsdist.hh" GlobalStateHolder g_carbon; +static time_t s_start=time(0); +uint64_t uptimeOfProcess(const std::string& str) +{ + return time(0) - s_start; +} void* carbonDumpThread() try diff --git a/pdns/dnsdist.hh b/pdns/dnsdist.hh index 09f8aefd9..c1e743745 100644 --- a/pdns/dnsdist.hh +++ b/pdns/dnsdist.hh @@ -11,6 +11,7 @@ #include #include "sholder.hh" void* carbonDumpThread(); +uint64_t uptimeOfProcess(const std::string& str); struct DNSDistStats { using stat_t=std::atomic; // 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} }; };