add GGIO type

This commit is contained in:
lnk
2026-04-21 16:33:46 +08:00
parent 54c97ad103
commit b87da0f454
4 changed files with 10 additions and 9 deletions

View File

@@ -354,7 +354,7 @@ protected:
std::string final_msg = msg; std::string final_msg = msg;
if (suppressed_before_emit > 0) { if (suppressed_before_emit > 0) {
std::ostringstream suppressed_oss; std::ostringstream suppressed_oss;
suppressed_oss << msg << "中间重复抑制 " suppressed_oss << msg << "已过滤重复同类日志 "
<< suppressed_before_emit << suppressed_before_emit
<< " 条】"; << " 条】";
final_msg = suppressed_oss.str(); final_msg = suppressed_oss.str();
@@ -442,14 +442,14 @@ private:
RateState& st = s_rate_map[key]; RateState& st = s_rate_map[key];
const int RESET_SEC = G_LOG_RATE_RESET_SEC ; // 1小时重置 const int RESET_SEC = G_LOG_RATE_RESET_SEC ; // 1小时重置
const int LIMIT_SEC = G_LOG_RATE_LIMIT_SEC ; // 进入限流后:1分钟1条 const int LIMIT_SEC = G_LOG_RATE_LIMIT_SEC ; // 进入限流后:多久发1条 主要控制中频和高频那些,低频的都直接放行了
// 初始化 / 强制每小时重置 // 初始化 / 强制每小时重置
if (st.last_reset.time_since_epoch().count() == 0) { if (st.last_reset.time_since_epoch().count() == 0) {
st.last_reset = now; st.last_reset = now;
} else { } else {
auto since_reset = duration_cast<seconds>(now - st.last_reset).count(); auto since_reset = duration_cast<seconds>(now - st.last_reset).count();
if (since_reset >= RESET_SEC) { if (since_reset >= RESET_SEC) { //重置周期
st = RateState(); st = RateState();
st.last_reset = now; st.last_reset = now;
} }
@@ -467,12 +467,12 @@ private:
} else { } else {
auto gap_ms = duration_cast<milliseconds>(now - st.last_seen).count(); auto gap_ms = duration_cast<milliseconds>(now - st.last_seen).count();
if (gap_ms >= G_LOG_RATE_KEEP_ALL_MS) { if (gap_ms >= G_LOG_RATE_KEEP_ALL_MS) { //什么时候不需要限流 //低频 //如果这里设置的很低,就不会限流
allow_burst = -1; // 全部保留 allow_burst = -1; // 全部保留
} else if (gap_ms >= G_LOG_RATE_KEEP_BURST_MS) { } else if (gap_ms >= G_LOG_RATE_KEEP_BURST_MS) {
allow_burst = G_LOG_RATE_KEEP_BURST_COUNT; // 前60条 allow_burst = G_LOG_RATE_KEEP_BURST_COUNT; // 前60条 //中频 //如果这里设置的比低频低,也不会生效
} else { } else {
allow_burst = G_LOG_RATE_KEEP_HIGHFREQ_COUNT; // 前10条 allow_burst = G_LOG_RATE_KEEP_HIGHFREQ_COUNT; // 前10条 //高频
} }
} }

View File

@@ -2840,7 +2840,7 @@ void processGGIO_start_data_end(char* mp_id,char* fullname,double v,long long ti
snprintf(mp_name, sizeof(mp_name), "unknown"); snprintf(mp_name, sizeof(mp_name), "unknown");
} }
DIY_WARNLOG_CODE(mp_id,2 ,LOG_CODE_REPORT, DIY_WARNLOG_CODE(mp_id,2 ,LOG_CODE_GGIO_LPHD,
"监测点:%s(%s),在%s发生事件:%s,事件值:%.2f", "监测点:%s(%s),在%s发生事件:%s,事件值:%.2f",
mp_name, mp_id, time_str, descBa.constData(), v); mp_name, mp_id, time_str, descBa.constData(), v);

View File

@@ -170,6 +170,7 @@ typedef enum LogCode {
LOG_CODE_TRANSIENT = 300, /* 暂态发生 */ LOG_CODE_TRANSIENT = 300, /* 暂态发生 */
LOG_CODE_TRANSIENT_COMM = 301, /* 暂态接口 */ LOG_CODE_TRANSIENT_COMM = 301, /* 暂态接口 */
LOG_CODE_COMTRADE_FILE = 302, /* 录波文件Comtrade */ LOG_CODE_COMTRADE_FILE = 302, /* 录波文件Comtrade */
LOG_CODE_GGIO_LPHD = 304, /* GGIO事件 */
LOG_CODE_MQ = 400, /* MQ发送 */ LOG_CODE_MQ = 400, /* MQ发送 */
LOG_CODE_RT_DATA = 401, /* 实时数据 */ LOG_CODE_RT_DATA = 401, /* 实时数据 */
LOG_CODE_LEDGER_UPDATE = 402, /* 台账更新 */ LOG_CODE_LEDGER_UPDATE = 402, /* 台账更新 */

View File

@@ -1455,7 +1455,7 @@ ST_VOID u_iec_rpt_ind_data(MVL_VAR_ASSOC** info_va,
//need do nothing! //need do nothing!
not_set_rpt_q_this = FALSE; not_set_rpt_q_this = FALSE;
} }
else if (strstr(FULL_FCDA_Name, "GGIO")) else if (strstr(FULL_FCDA_Name, "GGIO") || strstr(FULL_FCDA_Name, "LPHD"))
{ {
not_set_rpt_q_this = FALSE; not_set_rpt_q_this = FALSE;
} }
@@ -1478,7 +1478,7 @@ ST_VOID u_iec_rpt_ind_data(MVL_VAR_ASSOC** info_va,
//need do nothing! //need do nothing!
not_set_rpt_TimeID_this = FALSE; not_set_rpt_TimeID_this = FALSE;
} }
else if (strstr(FULL_FCDA_Name, "GGIO")) {//CZY 2023-08-17 WW 2022-11-14修改判断 LLN0$BR$brcbRDRE else if (strstr(FULL_FCDA_Name, "GGIO") || strstr(FULL_FCDA_Name, "LPHD")) {//CZY 2023-08-17 WW 2022-11-14修改判断 LLN0$BR$brcbRDRE
//need do nothing! //need do nothing!
not_set_rpt_TimeID_this = FALSE; not_set_rpt_TimeID_this = FALSE;
} }