Cleanup alive monitor config loading - #477
Conversation
License Check Results🚀 The license check job ran with the Bazel command: bazel run --lockfile_mode=error //:license-checkStatus: Click to expand output |
7fb7950 to
9ce1e97
Compare
|
The created documentation from the pull request is available at: docu-html |
| saf::ifappl::Checkpoint& checkpoint_r, | ||
| const uint16_t bufferSize) | ||
| : ISupervision(id), | ||
| k_aliveReferenceCycle(timers::TimeConversion::convertMilliSecToNanoSec(f_aliveCfg_r.reporting_cycle_ms)), |
There was a problem hiding this comment.
Do you think we could change the underlying type to use std::chrono so that we can use duration_cast and delete our implementation of TimeConversion. Might be better to do on another issue as we could also change the configs type?
| return "/lifecycle_health_" + component_name; | ||
| const std::lock_guard<std::mutex> lock(IdentifierHash::get_registry_mutex()); | ||
| const auto& reg = IdentifierHash::get_registry(); | ||
| const auto it = reg.find(component_name.data()); |
There was a problem hiding this comment.
I would probably stay away from using the registry to get actual data. I think it would work right now however this relies on something else creating the IdentifierHash before. I think right now this works because we have the ConfigAdapter that does this but in the future we won't.
Think we should also make that registry private somehow.
There was a problem hiding this comment.
I think we could just use the hash as the IPC name anyways right?
There was a problem hiding this comment.
Strings are added to the registry on construction so it should always work. Even if it doesn't, we fall back to the hash if the lookup fails. I could add a method get_string_from_hash() and make the registry private. What do you think?
There was a problem hiding this comment.
I don't think there is any benefit in having the name in the IPC path as it shouldn't be edited from outside our interfaces. So I'd say always use hash for the path.
| { | ||
| return "/lifecycle_health_" + it->second; | ||
| } | ||
| return "/lifecycle_health_" + std::to_string(component_name.data()); |
| @@ -58,7 +59,7 @@ class ISupervision | |||
|
|
|||
| /// @brief Get the name of the configuration element for the corresponding supervision container | |||
| /// @return std::string_view View over the name of the corresponding supervision configuration container | |||
| @@ -42,7 +43,7 @@ class ISupervision | |||
| /// @brief Constructor | |||
| /// @param [in] f_supervisionConfigName_p Unique name set by configuration | |||
|
|
||
| #include "score/mw/launch_manager/alive_monitor/details/factory/FlatCfgFactory.hpp" | ||
| #include "score/mw/launch_manager/alive_monitor/details/ifappl/MonitorIfDaemon.hpp" | ||
| #include "score/mw/launch_manager/alive_monitor/details/supervision/Alive.hpp" |
There was a problem hiding this comment.
need std::algo include
| else | ||
| swClusterHandler.reserve(supervised_components); | ||
|
|
||
| // In a later refactoring step, components will register their own alive supervision and provide their identifier. |
There was a problem hiding this comment.
Can you make an issue to track this, just so the comment doesn't get unchecked.
| : osClock{f_osClock}, | ||
| cycleTimer{&osClock}, | ||
| swClusterHandlers{}, | ||
| swClusterHandler{std::make_unique<factory::FlatCfgFactory>()}, |
There was a problem hiding this comment.
Do you think it would make sense to expose this as a param to get easier testing?
There was a problem hiding this comment.
This will be moved around in the next step, I'll revisit this then
|
|
||
| bool PhmDaemon::construct(const AliveMonitorConfig& config, const SupervisionBufferConfig& f_bufferConfig_r) noexcept( | ||
| false) | ||
| bool PhmDaemon::construct(const std::vector<configuration::ComponentConfig>& config) noexcept(false) |
There was a problem hiding this comment.
Can you make a static PhmDaemon::Create method instead.
| // In a later refactoring step, components will register their own alive supervision and provide their identifier. | ||
| // For now, we iterate through them all here. | ||
|
|
||
| LM_LOG_DEBUG() << "Software Cluster Handler starts constructing workers"; |
There was a problem hiding this comment.
I don't think we use the "Software Cluster" term anymore, would be good to remove from logs.
This is the first step of a refactor to better integrate alive supervision and launch manager. The main change in this PR is constructing alive supervision objects component by component using the new config, instead of all components at once, stage by stage. In addition, the PR: