resp.status = 200;
std::ostringstream output;
+ static const std::set<std::string> metricBlacklist = { "latency-count", "latency-sum" };
for (const auto& e : g_stats.entries) {
if (e.first == "special-memory-usage")
continue; // Too expensive for get-all
// Prometheus suggest using '_' instead of '-'
std::string prometheusMetricName = "dnsdist_" + boost::replace_all_copy(metricName, "-", "_");
+ if (metricBlacklist.count(metricName) != 0) {
+ continue;
+ }
MetricDefinition metricDetails;
-
if (!g_metricDefinitions.getMetricDetails(metricName, metricDetails)) {
vinfolog("Do not have metric details for %s", metricName);
continue;
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";
+ output << "dnsdist_latency_sum " << g_stats.latencySum << "\n";
+ output << "dnsdist_latency_count " << getLatencyCount(std::string()) << "\n";
auto states = g_dstates.getLocal();
const string statesbase = "dnsdist_server_";
{ "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")},
};
};