{
const string pbasename = getPrometheusName(name);
StatsMap entries;
- for (unsigned int n = 0; n < RecThreadInfo::numRecursorThreads(); ++n) {
+ // Only distr and worker threads, I think we should revisit this as we now not only have the handler thread but also
+ // taskThread(s).
+ for (unsigned int n = 0; n < RecThreadInfo::numDistributors() + RecThreadInfo::numWorkers(); ++n) {
uint64_t tm = doGetThreadCPUMsec(n);
std::string pname = pbasename + "{thread=\"" + std::to_string(n) + "\"}";
entries.emplace(name + "-thread-" + std::to_string(n), StatsMapEntry{pname, std::to_string(tm)});
}
}
+static void recursorThread();
+
void RecThreadInfo::start(unsigned int id, const string& name, const std::map<unsigned int, std::set<int>>& cpusMap)
{
thread = std::thread([id, name] {
return a;
}
-/*
- This function should only be called by the handler to gather metrics, wipe the cache,
- reload the Lua script (not the Lua config) or change the current trace regex,
- and by the SNMP thread to gather metrics. */
+// This function should only be called by the handler to gather
+// metrics, wipe the cache, reload the Lua script (not the Lua config)
+// or change the current trace regex, and by the SNMP thread to gather
+// metrics.
+// Note that this currently skips the handler, but includes the taskThread(s).
template <class T>
T broadcastAccFunction(const boost::function<T*()>& func)
{
}
}
-void* recursorThread()
+static void recursorThread()
{
try {
auto& threadInfo = RecThreadInfo::self();
threadInfo.setExitCode(EXIT_FAILURE);
RecursorControlChannel::stop = 1;
g_log << Logger::Critical << "Priming cache failed, stopping" << endl;
- return nullptr;
}
g_log << Logger::Debug << "Done priming cache with root hints" << endl;
}
}
}
}
- return nullptr;
}
catch (PDNSException& ae) {
g_log << Logger::Error << "Exception: " << ae.reason << endl;
- return nullptr;
}
catch (std::exception& e) {
g_log << Logger::Error << "STL Exception: " << e.what() << endl;
- return nullptr;
}
catch (...) {
g_log << Logger::Error << "any other exception in main: " << endl;
- return nullptr;
}
}