Skip to content

Commit

Permalink
修复飞书消息重复发送的问题
Browse files Browse the repository at this point in the history
修复飞书消息重复发送的问题
  • Loading branch information
kechangqing committed Jun 17, 2022
1 parent 1bc7889 commit 140b2c7
Show file tree
Hide file tree
Showing 20 changed files with 252 additions and 155 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ dist/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock
package-lock.json
tests/**/coverage/

7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# 📖 介绍

`Frostmourne`(霜之哀伤)是汽车之家经销商技术部监控系统的开源版本,用于帮助监控几乎所有数据库(包括`Elasticsearch`, `Prometheus`, `SkyWalking`, `MySql` 等等)数据。如果你已经建立起了日志系统,
`Frostmourne`(霜之哀伤)是汽车之家经销商技术部监控系统的开源版本,用于帮助监控几乎所有数据库数据(包括`Elasticsearch`, `Prometheus`, `SkyWalking`, `MySql` 等等)。如果你已经建立起了日志系统,
指标体系,却苦恼于没有一个配套监控系统,也许它能帮到你。

### 项目初衷
Expand Down Expand Up @@ -228,13 +228,13 @@ yarn dev

* ~~【0.9】发布0.8-RELEASE, 进入0.9开发~~ [2022-06-09]
* ~~【0.9】增加telnet端口连通监控~~ [2022-06-09]
* ~~【0.9】修复飞书消息发送两条的问题~~ [2022-06-17]
* 增加本项目内程序日志采集至MySQL并提供查询页面,方便排查问题和监控
* 增加 [SqlServer] 数据监控报警
* Elasticsearch数据名增加kibana链接配置,在数据查询页面增加kibana地址跳转链接,方便将数据查询切换至kibana
* 短信报警方式实现,默认用阿里云短信实现
* 页面展示文字支持英文切换
* 增加 [loki](https://github.com/grafana/loki) 数据监控报警
* 增加 [redis](https://github.com/redis/redis) 数据监控报警
* 数据源列表页面增加数据源图标列,方便区分
* 增加邮箱在线配置页面功能
* 增加企业微信在线配置页面功能
Expand All @@ -246,9 +246,6 @@ yarn dev
* 增加报警组支持
* 增加监控转组功能
* Elasticsearch数据名增加traceid字段配置,可以配置跳转链接。例如: 配置skywalking的链接将跳转到skywalking对应的调用链
* InfluxDB数据查询除了返回数值,另外返回最新一个point详细数据用于报警消息模板
* 增加InfluxDB数据查询页面
* InfluxDB数据监控增加短链接,跳转到InfluxDB数据查询页面
* 监控列表增加"执行日志"操作按钮,点击跳转到对应监控执行日志列表页
* 增加时序数据历史数据比较规则
* 监控增加报警消息允许发送时间段设置,非允许发送时间段内消息将只记录不发送,发送状态为FORBID
Expand Down
4 changes: 4 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
* 【0.9】发布0.8-RELEASE, 进入0.9开发 [2022-06-09]
* 【0.9】增加telnet端口连通监控 [2022-06-09]

### BugFix

* 【0.9】修复飞书消息发送两条的问题 [2022-06-17]

### Document

* 【0.9】增加telnet端口监控使用指南 [telnet.md](./doc/wiki/telnet.md) [2022-06-09]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public void send(AlarmMessageBO alarmMessageBO) {
MessageResult messageResult = new MessageResult(myWay(), false);
// TODO

messageResult.setSuccess(true);
alarmMessageBO.getResultList().add(messageResult);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/
@Component
public class FeishuRobotSender extends MessageSenderChain {

private static final Logger LOGGER = LoggerFactory.getLogger(FeishuRobotSender.class);

@Resource
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public void send(AlarmMessageBO alarmMessageBO) {
MessageResult messageResult = new MessageResult(myWay(), false);
// TODO

messageResult.setSuccess(true);
alarmMessageBO.getResultList().add(messageResult);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.autohome.frostmourne.monitor.service.message.sender;

import static org.junit.jupiter.api.Assertions.*;

import javax.annotation.Resource;

import com.autohome.frostmourne.monitor.model.message.AlarmMessageBO;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit.jupiter.EnabledIf;
import org.springframework.test.context.junit.jupiter.SpringExtension;

@ExtendWith(SpringExtension.class)
@SpringBootTest
@ActiveProfiles({"local"})
@EnabledIf(value = "#{'IntegrationTest'.equals(systemProperties['test-profile'])}")
class FeishuRobotSenderIntegrationTest {

@Resource
private FeishuRobotSender feishuRobotSender;

@Test
void sendTest() {
AlarmMessageBO alarmMessageBO = new AlarmMessageBO();
alarmMessageBO.setTitle("[霜之哀伤监控平台]");
alarmMessageBO.setContent("ccccccccccccccccccccccc");
alarmMessageBO.setFeiShuHook("hook");
feishuRobotSender.send(alarmMessageBO);
}

}
73 changes: 71 additions & 2 deletions frostmourne-vue/src/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,80 @@ export default {
},
route: {
Dashboard: 'Dashboard',
AlarmManager: 'Alarm Manage'
AlarmManager: 'Alarm Manager',
DataQuery: 'Data Query',
DataManager: 'Data Manager',
AccountManager: 'Account Manager',
AlarmList: 'Alarm List',
AlarmEdit: 'Alarm Edit',
ExecuteLog: 'Execute Log',
MyMessage: 'My Message',
MessageTemplate: 'Message Template',
Service: 'Service',
DataSource: 'Data Source',
DataName: 'Data Name',
Account: 'Account',
Team: 'Team',
Department: 'Department'
},
login: {
title: 'Frostmourne Alarm Manager'
},
alarm: {
list: {
add: 'add alarm'
add: 'Add Alarm',
input_id: 'input id',
input_name: 'input name, support vague search',
input_status: 'status',
input_service: 'choose service',
input_status_open: 'OPEN',
input_status_close: 'CLOSE',

header_alarm_name: 'Name',
header_alarm_type: 'Alarm Type',
header_is_open: 'IsOpen',
header_last_execute_result: 'Last Execute',
header_last_execute_time: 'Last Execute Time',
header_owner_object: 'Owner Object',
header_modifier: 'modifier',
header_last_modify_time: 'Last Modify Time',
header_action: 'Action'
},
edit: {
label_basic: 'Basic',
label_alarm_name: 'Alarm Name',
label_status_open: 'OPEN',
label_status_close: 'CLOSE',
label_service: 'Service',
label_risk: 'Risk Level',
label_info: 'info',
label_important: 'important',
label_emergency: 'emergency',
label_crash: 'crash',
label_owner: 'Owner Object',
label_owner_placeholder: 'owner object identity',
label_team: 'Team',
label_team_placeholder: 'Choose team',
label_description: 'Description',
label_data_config: 'Data Config',
label_data: 'Data',
label_aggregation_type: 'Aggregation',
label_pecentile: 'percentile',
label_percentile_placeholder: 'for example: 90',
label_aggregation_field: 'Aggregation Field',
label_bucket_type: 'Bucket Type',
label_bucket_field: 'Bucket Field',

input_service: 'Please choose service'

}
},
dashboard: {
latest_30_day_alert_count: 'latest 30 days alert count',
latest_30_day_message_count: 'latest 30 days message count',
alarm_count: 'Alarms',
schedule_count: 'Schedule count',
alert_count: 'Alerts',
message_count: 'Messages'
}
}
72 changes: 70 additions & 2 deletions frostmourne-vue/src/lang/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,79 @@ export default {
},
route: {
Dashboard: '首页',
AlarmManager: '监控管理'
AlarmManager: '监控管理',
DataQuery: '数据查询',
DataManager: '数据管理',
AccountManager: '账号管理',
AlarmList: '监控列表',
AlarmEdit: '监控编辑',
ExecuteLog: '执行日志',
MyMessage: '我的消息',
MessageTemplate: '消息模板',
Service: '服务信息',
DataSource: '数据源',
DataName: '数据名',
Account: '账号信息',
Team: '团队信息',
Department: '部门信息'
},
login: {
title: 'Frostmourne监控平台'
},
alarm: {
list: {
add: '添加报警'
add: '添加报警',
input_id: '输入id',
input_name: '输入名称,支持模糊查询',
input_status: '监控状态',
input_service: '请选择服务',
input_status_open: '开启',
input_status_close: '关闭',

header_alarm_name: '监控名称',
header_alarm_type: '监控类型',
header_is_open: '是否开启',
header_last_execute_result: '最后执行结果',
header_last_execute_time: '最后执行时间',
header_owner_object: '所属对象',
header_modifier: '最后修改人',
header_last_modify_time: '最后修改时间',
header_action: '操作'
},
edit: {
label_basic: '基础信息',
label_alarm_name: '监控名称',
label_status_open: '开启',
label_status_close: '关闭',
label_service: '所属服务',
label_risk: '风险等级',
label_info: '提示',
label_important: '重要',
label_emergency: '紧急',
label_crash: '我崩了',
label_owner: '所属对象',
label_owner_placeholder: '表示这个监控的归属对象标识',
label_team: '团队',
label_team_placeholder: '选择团队',
label_description: '描述',
label_data_config: '数据配置',
label_data: '数据',
label_aggregation_type: '聚合类型',
label_pecentile: '百分比',
label_percentile_placeholder: '例如: 90',
label_aggregation_field: '聚合字段',
label_bucket_type: '分桶类型',
label_bucket_field: '分桶字段',

input_service: '请选择服务'
}
},
dashboard: {
latest_30_day_alert_count: '最近30天报警次数',
latest_30_day_message_count: '最近30天消息数',
alarm_count: '监控数量',
schedule_count: '调度次数',
alert_count: '报警次数',
message_count: '消息数量'
}
}
2 changes: 1 addition & 1 deletion frostmourne-vue/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if (process.env.NODE_ENV === 'mock') {
mockXHR()
}

// set ElementUI lang to EN
// set ElementUI
Vue.use(ElementUI, { i18n: (key, value) => i18n.t(key, value) })

Vue.config.productionTip = false
Expand Down
8 changes: 4 additions & 4 deletions frostmourne-vue/src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ export const constantRoutes = [
component: Layout,
name: 'query',
redirect: '/query/elasticsearch.view',
meta: { title: '数据查询', icon: 'chart' },
meta: { title: 'Query', icon: 'chart' },
children: [
{
path: 'elasticsearch.view',
name: 'elasticsearch',
component: () => import('@/views/query/elasticsearch.vue'),
meta: { title: '数据查询', icon: 'chart' }
meta: { title: 'DataQuery', icon: 'chart' }
}
]
},
Expand All @@ -85,15 +85,15 @@ export const asyncRoutes = [
component: Layout,
redirect: '/data/source.view',
name: 'data',
meta: { title: '数据管理', icon: 'excel', roles: ['admin'] },
meta: { title: 'DataManager', icon: 'excel', roles: ['admin'] },
children: dataRoutes
},
{
path: '/account',
component: Layout,
redirect: '/account/user-info.view',
name: 'account',
meta: { title: '账号管理', icon: 'people', roles: ['admin'] },
meta: { title: 'AccountManager', icon: 'people', roles: ['admin'] },
children: accountRoutes
},
{
Expand Down
Loading

0 comments on commit 140b2c7

Please sign in to comment.