From e10ff189aca57bba91933088195d4edda199cb20 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 13 Apr 2024 23:14:48 +0200 Subject: Adding upstream version 1.9.3. Signed-off-by: Daniel Baumann --- dnsdist-carbon.cc | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'dnsdist-carbon.cc') diff --git a/dnsdist-carbon.cc b/dnsdist-carbon.cc index 5a5014d..1b1c0fe 100644 --- a/dnsdist-carbon.cc +++ b/dnsdist-carbon.cc @@ -26,6 +26,7 @@ #include "dnsdist-carbon.hh" #include "dnsdist.hh" #include "dnsdist-backoff.hh" +#include "dnsdist-metrics.hh" #ifndef DISABLE_CARBON #include "dolog.hh" @@ -53,19 +54,19 @@ static bool doOneCarbonExport(const Carbon::Endpoint& endpoint) const time_t now = time(nullptr); { - auto entries = g_stats.entries.read_lock(); + auto entries = dnsdist::metrics::g_stats.entries.read_lock(); for (const auto& entry : *entries) { str << namespace_name << "." << hostname << "." << instance_name << "." << entry.d_name << ' '; - if (const auto& val = boost::get(&entry.d_value)) { + if (const auto& val = std::get_if(&entry.d_value)) { str << (*val)->load(); } - else if (const auto& adval = boost::get*>(&entry.d_value)) { + else if (const auto& adval = std::get_if*>(&entry.d_value)) { str << (*adval)->load(); } - else if (const auto& dval = boost::get(&entry.d_value)) { + else if (const auto& dval = std::get_if(&entry.d_value)) { str << **dval; } - else if (const auto& func = boost::get(&entry.d_value)) { + else if (const auto& func = std::get_if(&entry.d_value)) { str << (*func)(entry.d_name); } str << ' ' << now << "\r\n"; @@ -98,6 +99,12 @@ static bool doOneCarbonExport(const Carbon::Endpoint& endpoint) str << base << "tcpavgqueriesperconnection" << ' ' << state->tcpAvgQueriesPerConnection.load() << " " << now << "\r\n"; str << base << "tcpavgconnectionduration" << ' ' << state->tcpAvgConnectionDuration.load() << " " << now << "\r\n"; str << base << "tcptoomanyconcurrentconnections" << ' ' << state->tcpTooManyConcurrentConnections.load() << " " << now << "\r\n"; + str << base << "healthcheckfailures" << ' ' << state->d_healthCheckMetrics.d_failures << " " << now << "\r\n"; + str << base << "healthcheckfailuresparsing" << ' ' << state->d_healthCheckMetrics.d_parseErrors << " " << now << "\r\n"; + str << base << "healthcheckfailurestimeout" << ' ' << state->d_healthCheckMetrics.d_timeOuts << " " << now << "\r\n"; + str << base << "healthcheckfailuresnetwork" << ' ' << state->d_healthCheckMetrics.d_networkErrors << " " << now << "\r\n"; + str << base << "healthcheckfailuresmismatch" << ' ' << state->d_healthCheckMetrics.d_mismatchErrors << " " << now << "\r\n"; + str << base << "healthcheckfailuresinvalid" << ' ' << state->d_healthCheckMetrics.d_invalidResponseErrors << " " << now << "\r\n"; } std::map frontendDuplicates; @@ -120,7 +127,7 @@ static bool doOneCarbonExport(const Carbon::Endpoint& endpoint) str << base << "tcpdiedreadingquery" << ' ' << front->tcpDiedReadingQuery.load() << " " << now << "\r\n"; str << base << "tcpdiedsendingresponse" << ' ' << front->tcpDiedSendingResponse.load() << " " << now << "\r\n"; str << base << "tcpgaveup" << ' ' << front->tcpGaveUp.load() << " " << now << "\r\n"; - str << base << "tcpclientimeouts" << ' ' << front->tcpClientTimeouts.load() << " " << now << "\r\n"; + str << base << "tcpclienttimeouts" << ' ' << front->tcpClientTimeouts.load() << " " << now << "\r\n"; str << base << "tcpdownstreamtimeouts" << ' ' << front->tcpDownstreamTimeouts.load() << " " << now << "\r\n"; str << base << "tcpcurrentconnections" << ' ' << front->tcpCurrentConnections.load() << " " << now << "\r\n"; str << base << "tcpmaxconcurrentconnections" << ' ' << front->tcpMaxConcurrentConnections.load() << " " << now << "\r\n"; @@ -141,7 +148,7 @@ static bool doOneCarbonExport(const Carbon::Endpoint& endpoint) errorCounters = &front->tlsFrontend->d_tlsCounters; } else if (front->dohFrontend != nullptr) { - errorCounters = &front->dohFrontend->d_tlsCounters; + errorCounters = &front->dohFrontend->d_tlsContext.d_tlsCounters; } if (errorCounters != nullptr) { str << base << "tlsdhkeytoosmall" << ' ' << errorCounters->d_dhKeyTooSmall << " " << now << "\r\n"; @@ -198,7 +205,7 @@ static bool doOneCarbonExport(const Carbon::Endpoint& endpoint) std::map dohFrontendDuplicates; const string base = "dnsdist." + hostname + ".main.doh."; for (const auto& doh : g_dohlocals) { - string name = doh->d_local.toStringWithPort(); + string name = doh->d_tlsContext.d_addr.toStringWithPort(); boost::replace_all(name, ".", "_"); boost::replace_all(name, ":", "_"); boost::replace_all(name, "[", "_"); @@ -288,7 +295,7 @@ static void carbonHandler(Carbon::Endpoint&& endpoint) usleep(toSleepUSec); } else { - vinfolog("Carbon export for %s took longer (%s usec) than the configured interval (%d usec)", endpoint.server.toStringWithPort(), elapsedUSec, intervalUSec); + vinfolog("Carbon export for %s took longer (%s us) than the configured interval (%d us)", endpoint.server.toStringWithPort(), elapsedUSec, intervalUSec); } consecutiveFailures = 0; } -- cgit v1.2.3