Skip to content

Commit

Permalink
Merge branch 'master' into support-monitoring-hive-metrics
Browse files Browse the repository at this point in the history
Signed-off-by: 淞筱 <[email protected]>
  • Loading branch information
a-little-fool authored Dec 10, 2023
2 parents 9ab8ea2 + 9cdcd5b commit cedeae1
Show file tree
Hide file tree
Showing 432 changed files with 4,766 additions and 2,853 deletions.
40 changes: 39 additions & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,8 @@
"avatar_url": "https://avatars.githubusercontent.com/u/131688897?v=4",
"profile": "https://github.com/Calvin979",
"contributions": [
"doc"
"doc",
"code"
]
},
{
Expand All @@ -1440,6 +1441,43 @@
"contributions": [
"code"
]
},
{
"login": "jinyaoMa",
"name": "Jinyao Ma",
"avatar_url": "https://avatars.githubusercontent.com/u/25066570?v=4",
"profile": "https://github.com/jinyaoMa",
"contributions": [
"code"
]
},
{
"login": "LinuxSuRen",
"name": "Rick",
"avatar_url": "https://avatars.githubusercontent.com/u/1450685?v=4",
"profile": "https://linuxsuren.github.io/open-source-best-practice/",
"contributions": [
"code",
"test"
]
},
{
"login": "ZY945",
"name": "东风",
"avatar_url": "https://avatars.githubusercontent.com/u/74083801?v=4",
"profile": "https://github.com/ZY945",
"contributions": [
"code"
]
},
{
"login": "prolevel1",
"name": "sonam singh",
"avatar_url": "https://avatars.githubusercontent.com/u/51995525?v=4",
"profile": "https://github.com/prolevel1",
"contributions": [
"code"
]
}
],
"contributorsPerLine": 7,
Expand Down
4 changes: 4 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@
- [ ] I have read the [Contributing Guide](https://hertzbeat.com/docs/others/contributing/)
- [ ] I have written the necessary doc or comment.
- [ ] I have added the necessary unit tests and all cases have passed.

## Add or update API

- [ ] I have added the necessary [e2e tests](../e2e) and all cases have passed.
38 changes: 38 additions & 0 deletions .github/workflows/backend-build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Backend CI

on:
push:
branches: [ master, dev ]
pull_request:
branches: [ master, dev ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Build with Maven
run: mvn clean -B package --file pom.xml
- name: Build Image
env:
IMAGE_PUSH: false
IMAGE_LOAD: true
IMAGE_PLATFORM: linux/amd64
run: |
docker buildx create --use --name mybuilder --driver docker-container
docker buildx use mybuilder
./script/docker/server/build.sh
- name: Run E2E
run: |
sudo curl -L https://github.com/docker/compose/releases/download/v2.23.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
sudo chmod u+x /usr/local/bin/docker-compose
cd e2e && ./start.sh
2 changes: 1 addition & 1 deletion .github/workflows/doc-pdf-builder.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'hertzbeat-doc-pdf-builder'
name: 'HertzBeat Doc Pdf Builder'
on:
page_build

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Node CI with Yarn
name: Frontend CI

on:
push:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/issues-translator.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: 'issues-translator'
name: 'Issues Translator'
on:
issue_comment:
types: [created]
issues:
types: [opened]

jobs:
build:
translate:
runs-on: ubuntu-latest
steps:
- uses: usthe/[email protected]
Expand Down
24 changes: 0 additions & 24 deletions .github/workflows/maven-build.yml

This file was deleted.

8 changes: 8 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This configuration file was automatically generated by Gitpod.
# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml)
# and commit this file to your remote git repository to share the goodness with others.

# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart

tasks:
- init: mvn install -DskipTests=false
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,14 @@ Thanks to these wonderful people, welcome to join us:
<td align="center" valign="top" width="14.28%"><a href="https://github.com/1036664317"><img src="https://avatars.githubusercontent.com/u/7696697?v=4?s=100" width="100px;" alt="moghn"/><br /><sub><b>moghn</b></sub></a><br /><a href="https://github.com/dromara/hertzbeat/commits?author=1036664317" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/xiaoguolong"><img src="https://avatars.githubusercontent.com/u/33684988?v=4?s=100" width="100px;" alt="xiaoguolong"/><br /><sub><b>xiaoguolong</b></sub></a><br /><a href="https://github.com/dromara/hertzbeat/commits?author=xiaoguolong" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Clownsw"><img src="https://avatars.githubusercontent.com/u/28394742?v=4?s=100" width="100px;" alt="Smliexx"/><br /><sub><b>Smliexx</b></sub></a><br /><a href="https://github.com/dromara/hertzbeat/commits?author=Clownsw" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Calvin979"><img src="https://avatars.githubusercontent.com/u/131688897?v=4?s=100" width="100px;" alt="Naruse"/><br /><sub><b>Naruse</b></sub></a><br /><a href="https://github.com/dromara/hertzbeat/commits?author=Calvin979" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Calvin979"><img src="https://avatars.githubusercontent.com/u/131688897?v=4?s=100" width="100px;" alt="Naruse"/><br /><sub><b>Naruse</b></sub></a><br /><a href="https://github.com/dromara/hertzbeat/commits?author=Calvin979" title="Documentation">📖</a> <a href="https://github.com/dromara/hertzbeat/commits?author=Calvin979" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/bbelide2"><img src="https://avatars.githubusercontent.com/u/26840796?v=4?s=100" width="100px;" alt="Bala Sukesh"/><br /><sub><b>Bala Sukesh</b></sub></a><br /><a href="https://github.com/dromara/hertzbeat/commits?author=bbelide2" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/jinyaoMa"><img src="https://avatars.githubusercontent.com/u/25066570?v=4?s=100" width="100px;" alt="Jinyao Ma"/><br /><sub><b>Jinyao Ma</b></sub></a><br /><a href="https://github.com/dromara/hertzbeat/commits?author=jinyaoMa" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://linuxsuren.github.io/open-source-best-practice/"><img src="https://avatars.githubusercontent.com/u/1450685?v=4?s=100" width="100px;" alt="Rick"/><br /><sub><b>Rick</b></sub></a><br /><a href="https://github.com/dromara/hertzbeat/commits?author=LinuxSuRen" title="Code">💻</a> <a href="https://github.com/dromara/hertzbeat/commits?author=LinuxSuRen" title="Tests">⚠️</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ZY945"><img src="https://avatars.githubusercontent.com/u/74083801?v=4?s=100" width="100px;" alt="东风"/><br /><sub><b>东风</b></sub></a><br /><a href="https://github.com/dromara/hertzbeat/commits?author=ZY945" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/prolevel1"><img src="https://avatars.githubusercontent.com/u/51995525?v=4?s=100" width="100px;" alt="sonam singh"/><br /><sub><b>sonam singh</b></sub></a><br /><a href="https://github.com/dromara/hertzbeat/commits?author=prolevel1" title="Code">💻</a></td>
</tr>
</tbody>
</table>
Expand Down Expand Up @@ -430,7 +436,7 @@ WeChat Group : Add friend `tan-cloud`, and will invite you to the group.
- [Jpom](https://gitee.com/dromara/Jpom) : 简而轻的低侵入式在线构建、自动部署、日常运维、项目监控软件
- [ArgusDBM](https://github.com/zmops/ArgusDBM) : 开源数据库一体化监控平台,致力于监控所有数据库
- [WangMarket](http://www.wang.market/) : 开源 SAAS 云建站系统

- [API Testing](https://github.com/LinuxSuRen/api-testing):轻量级、可扩展的接口开发、测试工具

##### Sponsor

Expand Down
9 changes: 8 additions & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,14 @@ Thanks these wonderful people, welcome to join us:
<td align="center" valign="top" width="14.28%"><a href="https://github.com/1036664317"><img src="https://avatars.githubusercontent.com/u/7696697?v=4?s=100" width="100px;" alt="moghn"/><br /><sub><b>moghn</b></sub></a><br /><a href="https://github.com/dromara/hertzbeat/commits?author=1036664317" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/xiaoguolong"><img src="https://avatars.githubusercontent.com/u/33684988?v=4?s=100" width="100px;" alt="xiaoguolong"/><br /><sub><b>xiaoguolong</b></sub></a><br /><a href="https://github.com/dromara/hertzbeat/commits?author=xiaoguolong" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Clownsw"><img src="https://avatars.githubusercontent.com/u/28394742?v=4?s=100" width="100px;" alt="Smliexx"/><br /><sub><b>Smliexx</b></sub></a><br /><a href="https://github.com/dromara/hertzbeat/commits?author=Clownsw" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Calvin979"><img src="https://avatars.githubusercontent.com/u/131688897?v=4?s=100" width="100px;" alt="Naruse"/><br /><sub><b>Naruse</b></sub></a><br /><a href="https://github.com/dromara/hertzbeat/commits?author=Calvin979" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Calvin979"><img src="https://avatars.githubusercontent.com/u/131688897?v=4?s=100" width="100px;" alt="Naruse"/><br /><sub><b>Naruse</b></sub></a><br /><a href="https://github.com/dromara/hertzbeat/commits?author=Calvin979" title="Documentation">📖</a> <a href="https://github.com/dromara/hertzbeat/commits?author=Calvin979" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/bbelide2"><img src="https://avatars.githubusercontent.com/u/26840796?v=4?s=100" width="100px;" alt="Bala Sukesh"/><br /><sub><b>Bala Sukesh</b></sub></a><br /><a href="https://github.com/dromara/hertzbeat/commits?author=bbelide2" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/jinyaoMa"><img src="https://avatars.githubusercontent.com/u/25066570?v=4?s=100" width="100px;" alt="Jinyao Ma"/><br /><sub><b>Jinyao Ma</b></sub></a><br /><a href="https://github.com/dromara/hertzbeat/commits?author=jinyaoMa" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://linuxsuren.github.io/open-source-best-practice/"><img src="https://avatars.githubusercontent.com/u/1450685?v=4?s=100" width="100px;" alt="Rick"/><br /><sub><b>Rick</b></sub></a><br /><a href="https://github.com/dromara/hertzbeat/commits?author=LinuxSuRen" title="Code">💻</a> <a href="https://github.com/dromara/hertzbeat/commits?author=LinuxSuRen" title="Tests">⚠️</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ZY945"><img src="https://avatars.githubusercontent.com/u/74083801?v=4?s=100" width="100px;" alt="东风"/><br /><sub><b>东风</b></sub></a><br /><a href="https://github.com/dromara/hertzbeat/commits?author=ZY945" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/prolevel1"><img src="https://avatars.githubusercontent.com/u/51995525?v=4?s=100" width="100px;" alt="sonam singh"/><br /><sub><b>sonam singh</b></sub></a><br /><a href="https://github.com/dromara/hertzbeat/commits?author=prolevel1" title="Code">💻</a></td>
</tr>
</tbody>
</table>
Expand Down Expand Up @@ -435,6 +441,7 @@ HertzBeat 赫兹跳动是 [Dromara开源社区](https://dromara.org/) 下顶级
- [Jpom](https://gitee.com/dromara/Jpom) : 简而轻的低侵入式在线构建、自动部署、日常运维、项目监控软件
- [ArgusDBM](https://github.com/zmops/ArgusDBM) : 开源数据库一体化监控平台,致力于监控所有数据库
- [WangMarket](http://www.wang.market/) : 开源 SAAS 云建站系统
- [API Testing](https://github.com/LinuxSuRen/api-testing):轻量级、可扩展的接口开发、测试工具

##### 赞助

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@
import org.springframework.stereotype.Component;

/**
* alerter config
*
* alerter prop config
* @author tom
*
*/
@Component
@ConfigurationProperties(prefix = "alerter")
Expand All @@ -35,7 +33,6 @@
public class AlerterProperties {

/**
* 告警内容控制台链接
* Alarm content console link
*/
private String consoleUrl = "https://console.tancloud.cn";
Expand Down Expand Up @@ -71,62 +68,40 @@ public class AlerterProperties {
private String serverChanNotifyUrl = "https://sctapi.ftqq.com/%s.send";

/**
* 告警评估时间间隔起始基数 每下一次乘2 单位毫秒
* base of alert eval interval time, unit:ms. The next time is 2 times the previous time.
*/
@Deprecated
private long alertEvalIntervalBase = 1000 * 60 * 10L;

/**
* 最大告警评估时间间隔 单位毫秒
* max of alert eval interval time, unit:ms
*/
@Deprecated
private long maxAlertEvalInterval = 1000 * 60 * 60 * 24L;

/**
* 系统内置告警(available alert, reachable alert...)触发次数
* system alert(available alert, reachable alert...) trigger times
*/
@Deprecated
private int systemAlertTriggerTimes = 1;

/**
* Data entry configuration properties 数据入口配置属性
* Data entry configuration properties
*/
private EntranceProperties entrance;

/**
* Data entry configuration properties 数据入口配置属性
* The entry can obtain data from messaging middleware such as kafka rabbitmq rocketmq 入口可以是从kafka rabbitmq rocketmq等消息中间件获取数据
* Data entry configuration properties
*/
@Getter
@Setter
public static class EntranceProperties {

/**
* kafka configuration information kafka配置信息
* kafka configuration information
*/
private KafkaProperties kafka;

@Getter
@Setter
public static class KafkaProperties {
/**
* Whether the kafka data entry is started kafka数据入口是否启动
* Whether the kafka data entry is started
*/
private boolean enabled = true;

/**
* kafka's connection server url kafka的连接服务器url
* kafka's connection server url
*/
private String servers = "127.0.0.1:9092";
/**
* The name of the topic that receives the data 接收数据的topic名称
* The name of the topic that receives the data
*/
private String topic;
/**
* Consumer Group ID 消费者组ID
* Consumer Group ID
*/
private String groupId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@
import java.util.concurrent.TimeUnit;

/**
* warehouse 工作线程池
* alarm module thread pool
* @author tom
*
*/
@Component
@Slf4j
Expand All @@ -43,11 +42,11 @@ public AlerterWorkerPool() {
}

private void initWorkExecutor() {
// 线程工厂
ThreadFactory threadFactory = new ThreadFactoryBuilder()
.setUncaughtExceptionHandler((thread, throwable) -> {
log.error("workerExecutor has uncaughtException.");
log.error(throwable.getMessage(), throwable); })
log.error(throwable.getMessage(), throwable);
})
.setDaemon(true)
.setNameFormat("alerter-worker-%d")
.build();
Expand All @@ -61,9 +60,9 @@ private void initWorkExecutor() {
}

/**
* Run the alerter task 运行alerter任务
* @param runnable task 任务
* @throws RejectedExecutionException when The thread pool is full of 线程池满
* Run the alerter task
* @param runnable task
* @throws RejectedExecutionException when The thread pool is full of
*/
public void executeJob(Runnable runnable) throws RejectedExecutionException {
workerExecutor.execute(runnable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@

/**
* Calculate alarms based on the alarm definition rules and collected data
* 根据告警定义规则和采集数据匹配计算告警
*
* @author tom
*/
@Component
Expand Down Expand Up @@ -96,7 +94,6 @@ public CalculateAlarm(AlerterWorkerPool workerPool, CommonDataQueue dataQueue,
this.triggeredAlertMap = new ConcurrentHashMap<>(128);
this.notRecoveredAlertMap = new ConcurrentHashMap<>(128);
// Initialize stateAlertMap
// 初始化stateAlertMap
List<Monitor> monitors = monitorDao.findMonitorsByStatus(CommonConstants.UN_AVAILABLE_CODE);
if (monitors != null) {
for (Monitor monitor : monitors) {
Expand Down Expand Up @@ -136,13 +133,12 @@ private void calculate(CollectRep.MetricsData metricsData) {
long monitorId = metricsData.getId();
String app = metricsData.getApp();
String metrics = metricsData.getMetrics();
// If the indicator group whose scheduling priority is 0 has the status of collecting response data UN_REACHABLE/UN_CONNECTABLE, the highest severity alarm is generated to monitor the status change
// 先判断调度优先级为0的指标组采集响应数据状态 UN_REACHABLE/UN_CONNECTABLE 则需发最高级别告警进行任务状态变更
// If the metrics whose scheduling priority is 0 has the status of collecting response data UN_REACHABLE/UN_CONNECTABLE,
// the highest severity alarm is generated to monitor the status change
if (metricsData.getPriority() == 0) {
handlerAvailableMetrics(monitorId, app, metricsData);
}
// Query the alarm definitions associated with the indicator set of the monitoring type
// 查出此监控类型下的此指标集合下关联配置的告警定义信息
// Query the alarm definitions associated with the metrics of the monitoring type
// field - define[]
Map<String, List<AlertDefine>> defineMap = alertDefineService.getMonitorBindAlertDefines(monitorId, app, metrics);
if (defineMap.isEmpty()) {
Expand Down Expand Up @@ -293,7 +289,6 @@ private void afterThresholdRuleMatch(long currentTimeMilli, long monitorId, Stri
.firstAlarmTime(currentTimeMilli)
.lastAlarmTime(currentTimeMilli)
// Keyword matching and substitution in the template
// 模板中关键字匹配替换
.content(AlertTemplateUtil.render(define.getTemplate(), fieldValueMap))
.build();
int defineTimes = define.getTimes() == null ? 1 : define.getTimes();
Expand All @@ -320,7 +315,7 @@ private boolean execAlertExpression(Map<String, Object> fieldValueMap, String ex
} catch (Exception e) {
log.error("Alert Define Rule: {} Run Error: {}.", e, e.getMessage());
}
return match;
return match != null && match;
}

private void handlerAvailableMetrics(long monitorId, String app, CollectRep.MetricsData metricsData) {
Expand Down
Loading

0 comments on commit cedeae1

Please sign in to comment.