control: Record configuration load/reload paths
Add `main` recorder entries to the flight recorder when the
configurations are loaded or reloaded thru SIGHUP.
Change-Id: Ib720f6342a8579e2fc0df30e8975dd140dba28e2
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/json/manager.cpp b/control/json/manager.cpp
index c45c873..ae007ad 100644
--- a/control/json/manager.cpp
+++ b/control/json/manager.cpp
@@ -17,7 +17,6 @@
#include "manager.hpp"
-#include "../utils/flight_recorder.hpp"
#include "action.hpp"
#include "event.hpp"
#include "fan.hpp"
@@ -26,6 +25,7 @@
#include "power_state.hpp"
#include "profile.hpp"
#include "sdbusplus.hpp"
+#include "utils/flight_recorder.hpp"
#include "zone.hpp"
#include <systemd/sd-bus.h>
@@ -75,6 +75,7 @@
void Manager::sighupHandler(sdeventplus::source::Signal&,
const struct signalfd_siginfo*)
{
+ FlightRecorder::instance().log("main", "SIGHUP received");
// Save current set of available and active profiles
std::map<configKey, std::unique_ptr<Profile>> profiles;
profiles.swap(_profiles);
@@ -94,6 +95,9 @@
_activeProfiles.swap(activeProfiles);
log<level::ERR>("Error reloading configs, no changes made",
entry("LOAD_ERROR=%s", re.what()));
+ FlightRecorder::instance().log(
+ "main", fmt::format("Error reloading configs, no changes made: {}",
+ re.what()));
}
}
diff --git a/control/json/manager.hpp b/control/json/manager.hpp
index c807252..4c8c72c 100644
--- a/control/json/manager.hpp
+++ b/control/json/manager.hpp
@@ -23,6 +23,7 @@
#include "power_state.hpp"
#include "profile.hpp"
#include "sdbusplus.hpp"
+#include "utils/flight_recorder.hpp"
#include "zone.hpp"
#include <fmt/format.h>
@@ -208,6 +209,9 @@
T::confFileName, isOptional);
if (!confFile.empty())
{
+ FlightRecorder::instance().log(
+ "main", fmt::format("Loading configuration from {}",
+ confFile.string()));
for (const auto& entry : fan::JsonConfig::load(confFile))
{
if (entry.contains("profiles"))
@@ -243,6 +247,9 @@
fmt::format("Configuration({}) loaded successfully",
T::confFileName)
.c_str());
+ FlightRecorder::instance().log(
+ "main", fmt::format("Configuration({}) loaded successfully",
+ T::confFileName));
}
return config;
}