bool DetectorGroup::check()

in src/oomd/engine/DetectorGroup.cpp [37:67]


bool DetectorGroup::check(OomdContext& context, uint32_t silenced_logs) {
  // Note we're running all Detectors so that any detectors keeping sliding
  // windows can update their window
  bool triggered = true;

  for (const auto& detector : detectors_) {
    if (silenced_logs & LogSources::PLUGINS) {
      OLOG << LogStream::Control::DISABLE;
    }

    PluginRet ret = detector->run(context);

    if (silenced_logs & LogSources::PLUGINS) {
      OLOG << LogStream::Control::ENABLE;
    }

    switch (ret) {
      case PluginRet::CONTINUE:
        continue;
      case PluginRet::STOP:
        triggered = false;
        break;
      case PluginRet::ASYNC_PAUSED:
        // ASYNC_PAUSED is not supported for detectors. Treat as no-op
        continue;
        // missing default to protect against future PluginRet vals
    }
  }

  return triggered;
}