output << "\n";
}
+ // Latency histogram buckets
+ output << "# HELP dnsdist_latency Histogram of responses by latency\n";
+ output << "# TYPE dnsdist_latency histogram\n";
+ uint64_t latency_amounts = g_stats.latency0_1;
+ output << "dnsdist_latency_bucket{le=\"1\"} " << latency_amounts << "\n";
+ latency_amounts += g_stats.latency1_10;
+ output << "dnsdist_latency_bucket{le=\"10\"} " << latency_amounts << "\n";
+ latency_amounts += g_stats.latency10_50;
+ output << "dnsdist_latency_bucket{le=\"50\"} " << latency_amounts << "\n";
+ latency_amounts += g_stats.latency50_100;
+ output << "dnsdist_latency_bucket{le=\"100\"} " << latency_amounts << "\n";
+ latency_amounts += g_stats.latency100_1000;
+ output << "dnsdist_latency_bucket{le=\"1000\"} " << latency_amounts << "\n";
+ latency_amounts += g_stats.latencySlow; // Should be the same as latency_count
+ output << "dnsdist_latency_bucket{le=\"+Inf\"} " << latency_amounts << "\n";
+
auto states = g_dstates.getLocal();
const string statesbase = "dnsdist_server_";
else if(udiff < 100000) ++g_stats.latency50_100;
else if(udiff < 1000000) ++g_stats.latency100_1000;
else ++g_stats.latencySlow;
+ g_stats.latencySum += udiff / 1000;
auto doAvg = [](double& var, double n, double weight) {
var = (weight -1) * var/weight + n/weight;
errlog("Fatal pdns error: %s", ae.reason);
_exit(EXIT_FAILURE);
}
+
+uint64_t getLatencyCount(const std::string&)
+{
+ return g_stats.responses + g_stats.selfAnswered + g_stats.cacheHits;
+}
extern vector<pair<struct timeval, std::string> > g_confDelta;
+extern uint64_t getLatencyCount(const std::string&);
+
struct DNSDistStats
{
using stat_t=std::atomic<uint64_t>; // aww yiss ;-)
stat_t noPolicy{0};
stat_t cacheHits{0};
stat_t cacheMisses{0};
- stat_t latency0_1{0}, latency1_10{0}, latency10_50{0}, latency50_100{0}, latency100_1000{0}, latencySlow{0};
+ stat_t latency0_1{0}, latency1_10{0}, latency10_50{0}, latency50_100{0}, latency100_1000{0}, latencySlow{0}, latencySum{0};
stat_t securityStatus{0};
double latencyAvg100{0}, latencyAvg1000{0}, latencyAvg10000{0}, latencyAvg1000000{0};
{"fd-usage", getOpenFileDescriptors},
{"dyn-blocked", &dynBlocked},
{"dyn-block-nmg-size", [](const std::string&) { return g_dynblockNMG.getLocal()->size(); }},
- {"security-status", &securityStatus}
+ {"security-status", &securityStatus},
+ // Latency histogram
+ {"latency-sum", &latencySum},
+ {"latency-count", getLatencyCount},
};
};
{ "dyn-blocked", MetricDefinition(PrometheusMetricType::counter, "Number of queries dropped because of a dynamic block")},
{ "dyn-block-nmg-size", MetricDefinition(PrometheusMetricType::gauge, "Number of dynamic blocks entries") },
{ "security-status", MetricDefinition(PrometheusMetricType::gauge, "Security status of this software. 0=unknown, 1=OK, 2=upgrade recommended, 3=upgrade mandatory") },
+ // Latency histogram
+ { "latency-sum", MetricDefinition(PrometheusMetricType::counter, "Total response time in milliseconds")},
+ { "latency-count", MetricDefinition(PrometheusMetricType::counter, "Number of queries contributing to response time histogram")},
};
};
------------
Number of queries answered in more than 1 second.
+latency-sum
+-----------
+Total response time of all queries combined in milliseconds since the start of dnsdist. Can be used to calculate the
+average response time over all queries.
+
+latency-count
+-------------
+Number of queries contributing to response time histogram
+
+latency-bucket
+--------------
+Number of queries contributing to response time histogram per latency bucket
+
latency0-1
----------
Number of queries answered in less than 1 ms.
'rule-drop', 'rule-nxdomain', 'rule-refused', 'self-answered', 'downstream-timeouts',
'downstream-send-errors', 'trunc-failures', 'no-policy', 'latency0-1',
'latency1-10', 'latency10-50', 'latency50-100', 'latency100-1000',
- 'latency-slow', 'latency-avg100', 'latency-avg1000', 'latency-avg10000',
- 'latency-avg1000000', 'uptime', 'real-memory-usage', 'noncompliant-queries',
+ 'latency-slow', 'latency-sum', 'latency-count', 'latency-avg100', 'latency-avg1000',
+ 'latency-avg10000', 'latency-avg1000000', 'uptime', 'real-memory-usage', 'noncompliant-queries',
'noncompliant-responses', 'rdqueries', 'empty-queries', 'cache-hits',
'cache-misses', 'cpu-user-msec', 'cpu-sys-msec', 'fd-usage', 'dyn-blocked',
'dyn-block-nmg-size', 'rule-servfail', 'security-status']