| 134 | } |
| 135 | |
| 136 | void C2Client::initializeComponentMetrics() { |
| 137 | { |
| 138 | std::lock_guard<std::mutex> guard(metrics_mutex_); |
| 139 | component_metrics_.clear(); |
| 140 | } |
| 141 | |
| 142 | if (root_ == nullptr) { |
| 143 | return; |
| 144 | } |
| 145 | std::vector<std::shared_ptr<core::Processor>> processors; |
| 146 | root_->getAllProcessors(processors); |
| 147 | for (const auto &processor : processors) { |
| 148 | auto rep = std::dynamic_pointer_cast<state::response::ResponseNodeSource>(processor); |
| 149 | if (rep == nullptr) { |
| 150 | continue; |
| 151 | } |
| 152 | // we have a metrics source. |
| 153 | std::vector<std::shared_ptr<state::response::ResponseNode>> metric_vector; |
| 154 | rep->getResponseNodes(metric_vector); |
| 155 | std::lock_guard<std::mutex> guard(metrics_mutex_); |
| 156 | for (auto& metric : metric_vector) { |
| 157 | component_metrics_[metric->getName()] = metric; |
| 158 | } |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | void C2Client::loadC2ResponseConfiguration(const std::string &prefix) { |
| 163 | std::string class_definitions; |
nothing calls this directly
no test coverage detected