Skip to content

Commit

Permalink
[feature]change the package name (#825)
Browse files Browse the repository at this point in the history
* change the package name to org.dromara.hertzbeat from com.usthe

* [doc] update domain

* change the package name to org.dromara.hertzbeat from com.usthe

* change the package name to org.dromara.hertzbeat from com.usthe

* change the package name to org.dromara.hertzbeat from com.usthe

* change the package name to org.dromara.hertzbeat from com.usthe

* catch aviator CompileExpressionErrorException ExpressionRuntimeException

* update favicon

* [script] update github workflow, add pr template (#819)

* [script]update github workflow, add pr template

* [script]update github workflow

* [script]update github workflow

* update

* update

---------

Co-authored-by: hudongdong <hudongdong9406@zto.com>
Co-authored-by: tomsun28 <tomsun28@outlook.com>
  • Loading branch information
3 people authored Mar 31, 2023
1 parent a866a89 commit d003b61
Show file tree
Hide file tree
Showing 350 changed files with 1,399 additions and 1,518 deletions.
12 changes: 6 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Even small corrections to typos are very welcome :)
1. Deploy and start dependent services `MYSQL` and `TDengine` database
2. Requires `maven3+`, `java8+` and `lombok` environments
3. Modify the dependent service address and other information of the configuration file-`manager/src/main/resources/application.yml`
4. Start `springboot manager` service `manager/src/main/java/com/usthe/manager/Manager.java`
4. Start `springboot manager` service `manager/src/main/java/org/dromara/hertzbeat/manager/Manager.java`

- Front-web start

Expand Down Expand Up @@ -113,13 +113,13 @@ With the above steps, you are a contributor to HertzBeat. Repeat the previous st

[Gitter Channel](https://gitter.im/hertzbeat/community)

[Github Discussion](https://github.com/usthe/hertzbeat/discussions)
[Github Discussion](https://github.com/dromara/hertzbeat/discussions)

[User Club](https://support.qq.com/products/379369)

Add WeChat account `tan-cloud` to pull you into the WeChat group.

QQ group number `718618151`, verify code: `tancloud`
QQ group number `236915833`, verify code: `tancloud`

Public WeChat: `tancloudtech`

Expand Down Expand Up @@ -180,7 +180,7 @@ Public WeChat: `tancloudtech`
1. 部署启动依赖服务`MYSQL``TDengine`数据库
2. 需要`maven3+`, `java8+``lombok`环境
3. 修改配置文件的依赖服务地址等信息-`manager/src/main/resources/application.yml`
4. 启动`springboot manager`服务 `manager/src/main/java/com/usthe/manager/Manager.java`
4. 启动`springboot manager`服务 `manager/src/main/java/org/dromara/hertzbeat/manager/Manager.java`

- 前端启动

Expand Down Expand Up @@ -258,13 +258,13 @@ git pull upstream master

[Gitter Channel](https://gitter.im/hertzbeat/community)

[Github Discussion](https://github.com/usthe/hertzbeat/discussions)
[Github Discussion](https://github.com/dromara/hertzbeat/discussions)

[HertzBeat答疑网站](https://support.qq.com/products/379369)

加微信号 `tan-cloud` 拉您进微信交流群

加QQ群号 `718618151` 进QQ交流群, 验证信息: `tancloud`
加QQ群号 `236915833` 进QQ交流群, 验证信息: `tancloud`

微信公众号: `tancloudtech`

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
![hertzbeat](https://cdn.jsdelivr.net/gh/dromara/hertzbeat@gh-pages/img/badge/custom-monitor.svg)
![hertzbeat](https://cdn.jsdelivr.net/gh/dromara/hertzbeat@gh-pages/img/badge/alert.svg)

**Home: [hertzbeat.com](https://hertzbeat.com)**
**Home: [hertzbeat.dromara.org](https://hertzbeat.dromara.org) | [hertzbeat.com](https://hertzbeat.com)**

**Cloud: [tancloud.cn](https://tancloud.cn)**

Expand Down Expand Up @@ -287,7 +287,7 @@ HertzBeat is a project under the [Dromara Open Source Community](https://dromara

[Gitter Channel](https://gitter.im/hertzbeat/community)

[Github Discussion](https://github.com/usthe/hertzbeat/discussions)
[Github Discussion](https://github.com/dromara/hertzbeat/discussions)

[User Club](https://support.qq.com/products/379369)

Expand Down
4 changes: 2 additions & 2 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
![hertzbeat](https://cdn.jsdelivr.net/gh/dromara/hertzbeat@gh-pages/img/badge/custom-monitor.svg)
![hertzbeat](https://cdn.jsdelivr.net/gh/dromara/hertzbeat@gh-pages/img/badge/alert.svg)

**官网: [hertzbeat.com](https://hertzbeat.com)**
**官网: [hertzbeat.dromara.org](https://hertzbeat.dromara.org) | [hertzbeat.com](https://hertzbeat.com)**

**云服务: [tancloud.cn](https://tancloud.cn)**

Expand Down Expand Up @@ -292,7 +292,7 @@ HertzBeat 赫兹跳动是 [Dromara开源社区](https://dromara.org/) 下项目

[Gitter Channel](https://gitter.im/hertzbeat/community)

[Github Discussion](https://github.com/usthe/hertzbeat/discussions)
[Github Discussion](https://github.com/dromara/hertzbeat/discussions)

[User Club](https://support.qq.com/products/379369)

Expand Down
4 changes: 2 additions & 2 deletions alerter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>hertzbeat</artifactId>
<groupId>com.usthe.tancloud</groupId>
<groupId>org.dromara.hertzbeat</groupId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand All @@ -34,7 +34,7 @@
<dependencies>
<!-- common -->
<dependency>
<groupId>com.usthe.tancloud</groupId>
<groupId>org.dromara.hertzbeat</groupId>
<artifactId>common</artifactId>
<version>${common.version}</version>
<scope>provided</scope>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package com.usthe.alert;
package org.dromara.hertzbeat.alert;

import lombok.Getter;
import lombok.Setter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package com.usthe.alert;
package org.dromara.hertzbeat.alert;

import com.google.common.util.concurrent.ThreadFactoryBuilder;
import lombok.extern.slf4j.Slf4j;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,25 @@
* limitations under the License.
*/

package com.usthe.alert.calculate;
package org.dromara.hertzbeat.alert.calculate;

import com.googlecode.aviator.AviatorEvaluator;
import com.googlecode.aviator.Expression;
import com.usthe.alert.AlerterProperties;
import com.usthe.alert.AlerterWorkerPool;
import com.usthe.common.queue.CommonDataQueue;
import com.usthe.alert.dao.AlertMonitorDao;
import com.usthe.common.entity.alerter.Alert;
import com.usthe.common.entity.alerter.AlertDefine;
import com.usthe.alert.service.AlertDefineService;
import com.usthe.alert.util.AlertTemplateUtil;
import com.usthe.common.entity.manager.Monitor;
import com.usthe.common.entity.message.CollectRep;
import com.usthe.common.util.CommonConstants;
import com.usthe.common.util.CommonUtil;
import com.usthe.common.util.ResourceBundleUtil;
import com.googlecode.aviator.exception.CompileExpressionErrorException;
import com.googlecode.aviator.exception.ExpressionRuntimeException;
import org.dromara.hertzbeat.alert.AlerterProperties;
import org.dromara.hertzbeat.alert.AlerterWorkerPool;
import org.dromara.hertzbeat.common.queue.CommonDataQueue;
import org.dromara.hertzbeat.alert.dao.AlertMonitorDao;
import org.dromara.hertzbeat.common.entity.alerter.Alert;
import org.dromara.hertzbeat.common.entity.alerter.AlertDefine;
import org.dromara.hertzbeat.alert.service.AlertDefineService;
import org.dromara.hertzbeat.alert.util.AlertTemplateUtil;
import org.dromara.hertzbeat.common.entity.manager.Monitor;
import org.dromara.hertzbeat.common.entity.message.CollectRep;
import org.dromara.hertzbeat.common.util.CommonConstants;
import org.dromara.hertzbeat.common.util.CommonUtil;
import org.dromara.hertzbeat.common.util.ResourceBundleUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;

Expand Down Expand Up @@ -212,8 +214,16 @@ private void calculate(CollectRep.MetricsData metricsData) {
for (AlertDefine define : defines) {
String expr = define.getExpr();
try {
Expression expression = AviatorEvaluator.compile(expr, true);
Boolean match = (Boolean) expression.execute(fieldValueMap);
Boolean match = false;
try {
Expression expression = AviatorEvaluator.compile(expr, true);
match = (Boolean) expression.execute(fieldValueMap);
} catch (CompileExpressionErrorException compileException) {
log.error("Alert Define Rule: {} Compile Error: {}.", expr, compileException.getMessage());
} catch (ExpressionRuntimeException expressionRuntimeException) {
log.error("Alert Define Rule: {} Run Error: {}.", expr, expressionRuntimeException.getMessage());
}

if (match != null && match) {
// If the threshold rule matches, the number of times the threshold has been triggered is determined and an alarm is triggered
// 阈值规则匹配,判断已触发阈值次数,触发告警
Expand Down Expand Up @@ -261,7 +271,7 @@ private void calculate(CollectRep.MetricsData metricsData) {
break;
}
} catch (Exception e) {
log.warn(e.getMessage());
log.warn(e.getMessage(), e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package com.usthe.alert.config;
package org.dromara.hertzbeat.alert.config;

import org.springframework.context.annotation.ComponentScan;

Expand All @@ -24,6 +24,6 @@
* @version 2.1
* Created by Musk.Chen on 2023/1/14
*/
@ComponentScan(basePackages = "com.usthe.alert")
@ComponentScan(basePackages = "org.dromara.hertzbeat.alert")
public class AlerterAutoConfiguration {
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
* limitations under the License.
*/

package com.usthe.alert.controller;
package org.dromara.hertzbeat.alert.controller;

import com.usthe.common.entity.alerter.AlertDefine;
import com.usthe.common.entity.alerter.AlertDefineMonitorBind;
import com.usthe.alert.service.AlertDefineService;
import com.usthe.common.entity.dto.Message;
import org.dromara.hertzbeat.common.entity.alerter.AlertDefine;
import org.dromara.hertzbeat.common.entity.alerter.AlertDefineMonitorBind;
import org.dromara.hertzbeat.alert.service.AlertDefineService;
import org.dromara.hertzbeat.common.entity.dto.Message;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
Expand All @@ -40,7 +40,7 @@
import java.util.List;
import java.util.stream.Collectors;

import static com.usthe.common.util.CommonConstants.MONITOR_NOT_EXIST_CODE;
import static org.dromara.hertzbeat.common.util.CommonConstants.MONITOR_NOT_EXIST_CODE;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
* limitations under the License.
*/

package com.usthe.alert.controller;
package org.dromara.hertzbeat.alert.controller;

import com.usthe.common.entity.alerter.AlertDefine;
import com.usthe.alert.service.AlertDefineService;
import com.usthe.common.entity.dto.Message;
import org.dromara.hertzbeat.common.entity.alerter.AlertDefine;
import org.dromara.hertzbeat.alert.service.AlertDefineService;
import org.dromara.hertzbeat.common.entity.dto.Message;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
* limitations under the License.
*/

package com.usthe.alert.controller;
package org.dromara.hertzbeat.alert.controller;

import com.usthe.alert.dto.AlertSummary;
import com.usthe.common.entity.alerter.Alert;
import com.usthe.alert.service.AlertService;
import com.usthe.common.entity.dto.AlertReport;
import com.usthe.common.entity.dto.Message;
import org.dromara.hertzbeat.alert.dto.AlertSummary;
import org.dromara.hertzbeat.common.entity.alerter.Alert;
import org.dromara.hertzbeat.alert.service.AlertService;
import org.dromara.hertzbeat.common.entity.dto.AlertReport;
import org.dromara.hertzbeat.common.entity.dto.Message;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
* limitations under the License.
*/

package com.usthe.alert.dao;
package org.dromara.hertzbeat.alert.dao;

import com.usthe.alert.dto.AlertPriorityNum;
import com.usthe.common.entity.alerter.Alert;
import org.dromara.hertzbeat.alert.dto.AlertPriorityNum;
import org.dromara.hertzbeat.common.entity.alerter.Alert;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
Expand Down Expand Up @@ -60,6 +60,6 @@ public interface AlertDao extends JpaRepository<Alert, Long>, JpaSpecificationEx
*
* @return Number of alerts 告警数量
*/
@Query("select new com.usthe.alert.dto.AlertPriorityNum(mo.priority, count(mo.id)) from Alert mo where mo.status = 0 group by mo.priority")
@Query("select new org.dromara.hertzbeat.alert.dto.AlertPriorityNum(mo.priority, count(mo.id)) from Alert mo where mo.status = 0 group by mo.priority")
List<AlertPriorityNum> findAlertPriorityNum();
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
* limitations under the License.
*/

package com.usthe.alert.dao;
package org.dromara.hertzbeat.alert.dao;

import com.usthe.common.entity.alerter.AlertDefineMonitorBind;
import org.dromara.hertzbeat.common.entity.alerter.AlertDefineMonitorBind;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
* limitations under the License.
*/

package com.usthe.alert.dao;
package org.dromara.hertzbeat.alert.dao;

import com.usthe.common.entity.alerter.AlertDefine;
import org.dromara.hertzbeat.common.entity.alerter.AlertDefine;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
* limitations under the License.
*/

package com.usthe.alert.dao;
package org.dromara.hertzbeat.alert.dao;

import com.usthe.common.entity.manager.Monitor;
import org.dromara.hertzbeat.common.entity.manager.Monitor;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package com.usthe.alert.dto;
package org.dromara.hertzbeat.alert.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package com.usthe.alert.dto;
package org.dromara.hertzbeat.alert.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
* limitations under the License.
*/

package com.usthe.alert.service;
package org.dromara.hertzbeat.alert.service;

import com.usthe.common.entity.alerter.AlertDefine;
import com.usthe.common.entity.alerter.AlertDefineMonitorBind;
import org.dromara.hertzbeat.common.entity.alerter.AlertDefine;
import org.dromara.hertzbeat.common.entity.alerter.AlertDefineMonitorBind;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.jpa.domain.Specification;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
* limitations under the License.
*/

package com.usthe.alert.service;
package org.dromara.hertzbeat.alert.service;

import com.usthe.alert.dto.AlertSummary;
import com.usthe.common.entity.alerter.Alert;
import com.usthe.common.entity.dto.AlertReport;
import org.dromara.hertzbeat.alert.dto.AlertSummary;
import org.dromara.hertzbeat.common.entity.alerter.Alert;
import org.dromara.hertzbeat.common.entity.dto.AlertReport;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.jpa.domain.Specification;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
* limitations under the License.
*/

package com.usthe.alert.service.impl;
package org.dromara.hertzbeat.alert.service.impl;

import com.usthe.alert.dao.AlertDefineBindDao;
import com.usthe.alert.dao.AlertDefineDao;
import com.usthe.common.entity.alerter.AlertDefine;
import com.usthe.common.entity.alerter.AlertDefineMonitorBind;
import com.usthe.alert.service.AlertDefineService;
import org.dromara.hertzbeat.alert.dao.AlertDefineBindDao;
import org.dromara.hertzbeat.alert.dao.AlertDefineDao;
import org.dromara.hertzbeat.common.entity.alerter.AlertDefine;
import org.dromara.hertzbeat.common.entity.alerter.AlertDefineMonitorBind;
import org.dromara.hertzbeat.alert.service.AlertDefineService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
Expand Down
Loading

0 comments on commit d003b61

Please sign in to comment.