]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Dnsdist: Do not report latency metrics of down upstream servers
authorHolger Hoffstätte <holger@applied-asynchrony.com>
Mon, 21 Jun 2021 15:01:11 +0000 (17:01 +0200)
committerHolger Hoffstätte <holger@applied-asynchrony.com>
Mon, 21 Jun 2021 15:01:11 +0000 (17:01 +0200)
pdns/dnsdist-web.cc

index 9d31b3aefaef592dcf49c25fa2777c3c5e3e0c43..5eca7074e4e62b94fcf579bdfb3fbed4e9582906 100644 (file)
@@ -507,7 +507,8 @@ static void handlePrometheus(const YaHTTP::Request& req, YaHTTP::Response& resp)
     output << statesbase << "queries"                      << label << " " << state->queries.load()              << "\n";
     output << statesbase << "responses"                    << label << " " << state->responses.load()            << "\n";
     output << statesbase << "drops"                        << label << " " << state->reuseds.load()              << "\n";
-    output << statesbase << "latency"                      << label << " " << state->latencyUsec/1000.0          << "\n";
+    if (state->isUp())
+        output << statesbase << "latency"                  << label << " " << state->latencyUsec/1000.0          << "\n";
     output << statesbase << "senderrors"                   << label << " " << state->sendErrors.load()           << "\n";
     output << statesbase << "outstanding"                  << label << " " << state->outstanding.load()          << "\n";
     output << statesbase << "order"                        << label << " " << state->order                       << "\n";
@@ -517,7 +518,7 @@ static void handlePrometheus(const YaHTTP::Request& req, YaHTTP::Response& resp)
     output << statesbase << "tcpgaveup"                    << label << " " << state->tcpGaveUp                   << "\n";
     output << statesbase << "tcpreadtimeouts"              << label << " " << state->tcpReadTimeouts             << "\n";
     output << statesbase << "tcpwritetimeouts"             << label << " " << state->tcpWriteTimeouts            << "\n";
-    output << statesbase << "tcpconnecttimeouts"           << label << " " << state->tcpConnectTimeouts         << "\n";
+    output << statesbase << "tcpconnecttimeouts"           << label << " " << state->tcpConnectTimeouts          << "\n";
     output << statesbase << "tcpcurrentconnections"        << label << " " << state->tcpCurrentConnections       << "\n";
     output << statesbase << "tcpmaxconcurrentconnections"  << label << " " << state->tcpMaxConcurrentConnections << "\n";
     output << statesbase << "tcpnewconnections"            << label << " " << state->tcpNewConnections           << "\n";