2026-05-09 11:23:45 +08:00
|
|
|
|
#pragma once
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @file roller.h
|
|
|
|
|
|
* @brief 负载平衡,离群检测
|
|
|
|
|
|
* @author your name (you@domain.com)
|
|
|
|
|
|
* @version 0.1
|
|
|
|
|
|
* @date 2023-12-08
|
|
|
|
|
|
*
|
|
|
|
|
|
* Copyright: Baosight Co. Ltd.
|
|
|
|
|
|
* DO NOT COPY/USE WITHOUT PERMISSION
|
|
|
|
|
|
*
|
|
|
|
|
|
*/
|
|
|
|
|
|
#include <eqpalg/alg_base.h>
|
|
|
|
|
|
#include <eqpalg/define/public.h>
|
|
|
|
|
|
#include <array>
|
|
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
|
|
|
|
using std::string;
|
|
|
|
|
|
class Roller :public AlgBase {
|
|
|
|
|
|
public:
|
|
|
|
|
|
Roller(const string name, const mix_cc::json& rule_json, const string ruleId);
|
|
|
|
|
|
|
|
|
|
|
|
virtual ~Roller();
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
int init() override;
|
|
|
|
|
|
AlarmInfo exec_mon() override;
|
|
|
|
|
|
std::vector<AlarmInfo> exec_task(mix_cc::time_range_t time_range) override;
|
2026-05-09 13:30:09 +08:00
|
|
|
|
const array<string, 2> BIG_SMALL = {"过大", "过小"};
|
2026-05-09 11:23:45 +08:00
|
|
|
|
|
|
|
|
|
|
private:
|
2026-05-09 13:30:09 +08:00
|
|
|
|
TimeDur interval_time_;
|
|
|
|
|
|
std::string error_content_;
|
|
|
|
|
|
double error_diff_;
|
|
|
|
|
|
std::string error_name_;
|
|
|
|
|
|
std::map<int, double> mmean_tags_;
|
|
|
|
|
|
std::vector<int> comparison_tags_;
|
|
|
|
|
|
std::map<int, int> tags_errors_;
|
|
|
|
|
|
std::array<double, 3> min_max_sum_;
|
|
|
|
|
|
int n_tags_;
|
2026-05-09 11:23:45 +08:00
|
|
|
|
private:
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @brief 查询mmean_tags_ 调用ihd均值查询API
|
|
|
|
|
|
* @return int
|
|
|
|
|
|
*/
|
|
|
|
|
|
int refresh_mmean_tags_ihd();
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @brief 打印载入信息
|
|
|
|
|
|
*/
|
|
|
|
|
|
void print_load_content();
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @brief
|
|
|
|
|
|
* @return int 0:本次查找-没有异常 -1:本次查找-查找完成
|
|
|
|
|
|
*/
|
|
|
|
|
|
int exec_mon_base();
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @brief 从vector中获取min max sum,存入
|
|
|
|
|
|
* @param comparison_tags My Param doc
|
|
|
|
|
|
* @return int
|
|
|
|
|
|
*/
|
|
|
|
|
|
int minmaxsum_get(std::vector<int> comparison_tags);
|
|
|
|
|
|
};
|