Skip to content

Commit

Permalink
Merge pull request #160 from dromara/dev
Browse files Browse the repository at this point in the history
merge dev to master
  • Loading branch information
tomsun28 authored May 29, 2022
2 parents bbcd347 + 921022f commit 848a28d
Show file tree
Hide file tree
Showing 28 changed files with 335 additions and 143 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ Detailed steps refer to [Install via Docker-Compose](script/docker-compose/READM

## ✨ Contributors

Thanks these wonderful people, welcome to join us:
[CONTRIBUTING](CONTRIBUTING.md)
Thanks these wonderful people, welcome to join us:
[Contributor Guide](CONTRIBUTING.md)

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
Expand Down
3 changes: 2 additions & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@

## ✨ Contributors

Thanks these wonderful people, welcome to join us:
Thanks these wonderful people, welcome to join us:
[贡献者指南](CONTRIBUTING.md)

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ public class AlertsController {
@GetMapping
@ApiOperation(value = "Get a list of alarm information based on query filter items", notes = "根据查询过滤项获取告警信息列表")
public ResponseEntity<Message<Page<Alert>>> getAlerts(
@ApiParam(value = "en: Alarm ID List,zh: 告警IDS", example = "6565466456") @RequestParam(required = false) List<Long> ids,
@ApiParam(value = "en: Alarm monitor object ID,zh: 告警监控对象ID", example = "6565463543") @RequestParam(required = false) Long monitorId,
@ApiParam(value = "en: Alarm level,zh: 告警级别", example = "6565463543") @RequestParam(required = false) Byte priority,
@ApiParam(value = "en: Alarm Status,zh: 告警状态", example = "6565463543") @RequestParam(required = false) Byte status,
@ApiParam(value = "en: Alarm content fuzzy query,zh:告警内容模糊查询", example = "linux") @RequestParam(required = false) String content,
@ApiParam(value = "en: Sort field, default id,zh: 排序字段,默认id", example = "name") @RequestParam(defaultValue = "id") String sort,
@ApiParam(value = "en: Sort Type,zh: 排序方式,asc:升序,desc:降序", example = "desc") @RequestParam(defaultValue = "desc") String order,
@ApiParam(value = "en: List current page,zh: 列表当前分页", example = "0") @RequestParam(defaultValue = "0") int pageIndex,
@ApiParam(value = "en: Number of list pagination,zh: 列表分页数量", example = "8") @RequestParam(defaultValue = "8") int pageSize) {
@ApiParam(value = "Alarm ID List | 告警IDS", example = "6565466456") @RequestParam(required = false) List<Long> ids,
@ApiParam(value = "Alarm monitor object ID | 告警监控对象ID", example = "6565463543") @RequestParam(required = false) Long monitorId,
@ApiParam(value = "Alarm level | 告警级别", example = "6565463543") @RequestParam(required = false) Byte priority,
@ApiParam(value = "Alarm Status | 告警状态", example = "6565463543") @RequestParam(required = false) Byte status,
@ApiParam(value = "Alarm content fuzzy query | 告警内容模糊查询", example = "linux") @RequestParam(required = false) String content,
@ApiParam(value = "Sort field, default id | 排序字段,默认id", example = "name") @RequestParam(defaultValue = "id") String sort,
@ApiParam(value = "Sort Type | 排序方式,asc:升序,desc:降序", example = "desc") @RequestParam(defaultValue = "desc") String order,
@ApiParam(value = "List current page | 列表当前分页", example = "0") @RequestParam(defaultValue = "0") int pageIndex,
@ApiParam(value = "Number of list pagination | 列表分页数量", example = "8") @RequestParam(defaultValue = "8") int pageSize) {

Specification<Alert> specification = (root, query, criteriaBuilder) -> {
List<Predicate> andList = new ArrayList<>();
Expand Down Expand Up @@ -91,7 +91,7 @@ public ResponseEntity<Message<Page<Alert>>> getAlerts(
@DeleteMapping
@ApiOperation(value = "Delete alarms in batches", notes = "根据告警ID列表批量删除告警")
public ResponseEntity<Message<Void>> deleteAlertDefines(
@ApiParam(value = "en:Alarm List ID,zh: 告警IDs", example = "6565463543") @RequestParam(required = false) List<Long> ids) {
@ApiParam(value = "Alarm List ID | 告警IDs", example = "6565463543") @RequestParam(required = false) List<Long> ids) {
if (ids != null && !ids.isEmpty()) {
alertService.deleteAlerts(new HashSet<>(ids));
}
Expand All @@ -102,8 +102,8 @@ public ResponseEntity<Message<Void>> deleteAlertDefines(
@PutMapping(path = "/status/{status}")
@ApiOperation(value = "Batch modify alarm status, set read and unread", notes = "批量修改告警状态,设置已读未读")
public ResponseEntity<Message<Void>> applyAlertDefinesStatus(
@ApiParam(value = "en:Alarm status value,zh: 告警状态值", example = "0") @PathVariable Byte status,
@ApiParam(value = "en:Alarm List IDS,zh: 告警IDS", example = "6565463543") @RequestParam(required = false) List<Long> ids) {
@ApiParam(value = "Alarm status value | 告警状态值", example = "0") @PathVariable Byte status,
@ApiParam(value = "Alarm List IDS | 告警IDS", example = "6565463543") @RequestParam(required = false) List<Long> ids) {
if (ids != null && status != null && !ids.isEmpty()) {
alertService.editAlertStatus(status, ids);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import lombok.Builder;
import lombok.Data;
import lombok.ToString;

import java.util.Objects;

/**
* 缓存key唯一标识符
Expand All @@ -11,7 +12,6 @@
*/
@Data
@Builder
@ToString
public class CacheIdentifier {

private String ip;
Expand All @@ -22,4 +22,12 @@ public class CacheIdentifier {

private String password;

@Override
public String toString() {
return "CacheIdentifier {" +
"ip='" + ip + '\'' +
", port='" + port + '\'' +
", username+password=>hash='" + Objects.hash(username, password) + '\'' +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public void addCache(Object key, Object value) {
public Optional<Object> getCache(Object key, boolean refreshCache) {
Long[] cacheTime = timeoutMap.get(key);
if (cacheTime == null || cacheTime.length != CACHE_TIME_LENGTH) {
log.warn("[cache] not hit the cache, key {}.", key);
log.info("[cache] not hit the cache, key {}.", key);
return Optional.empty();
}
if (cacheTime[0] + cacheTime[1] < System.currentTimeMillis()) {
Expand Down
158 changes: 116 additions & 42 deletions home/docs/others/contributing.md
Original file line number Diff line number Diff line change
@@ -1,68 +1,142 @@
---
id: contributing
title: 参与贡献
sidebar_label: 参与贡献
---
title: 贡献者指南
sidebar_label: 贡献者指南
---

参与贡献
=======================================
> 非常欢迎参与项目贡献,我们致力于维护一个互相帮助的快乐社区。

非常欢迎参与项目贡献,我们致力于维护一个互相帮助的快乐社区。
### 贡献方式

### 模块
> 在 HertzBeat 社区,贡献方式有很多:

- **[manager](https://github.com/dromara/hertzbeat/tree/master/manager)** 提供监控管理,系统管理基础服务
> 提供对监控的管理,监控应用配置的管理,系统用户租户后台管理等。
- **[collector](https://github.com/dromara/hertzbeat/tree/master/collector)** 提供监控数据采集服务
> 使用通用协议远程采集获取对端指标数据。
- **[scheduler](https://github.com/dromara/hertzbeat/tree/master/scheduler)** 提供监控任务调度服务
> 采集任务管理,一次性任务和周期性任务的调度分发。
- **[warehouse](https://github.com/dromara/hertzbeat/tree/master/warehouse)** 提供监控数据仓储服务
> 采集指标结果数据管理,数据落盘,查询,计算统计。
- **[alerter](https://github.com/dromara/hertzbeat/tree/master/alerter)** 提供告警服务
> 告警计算触发,监控状态联动,告警配置,告警通知。
- **[web-app](https://github.com/dromara/hertzbeat/tree/master/web-app)** 提供可视化控制台页面
> 监控告警系统可视化控制台前端
- 💻**代码**:可以帮助社区完成一些任务、编写新的feature或者是修复一些bug;

- ⚠️**测试**:可以来参与测试代码的编写,包括了单元测试、集成测试、e2e测试;

![hertzBeat](https://cdn.jsdelivr.net/gh/dromara/hertzbeat@gh-pages/img/docs/hertzbeat-stru.svg)
- 📖**文档**:可以编写或完善文档,来帮助用户更好地了解和使用 HertzBeat;

## 如何贡献?
- 📝**博客**:可以撰写 HertzBeat 的相关文章,来帮助社区更好地推广;

我们不仅仅接收代码的贡献提交,您也可以通过提交文档的更新或者BUG的报告来参与社区贡献。
- 🤔**讨论**:可以参与 HertzBeat 新的feature的讨论,将您的想法跟 HertzBeat 融合;

如果是新的贡献者,请首先了解参考仓库提交Issues,提交Pull Requests如何工作。
- 💡**布道**:可以帮助宣传或推广 HertzBeat 社区,在 meetup 或 summit 中演讲;

https://github.com/dromara/hertzbeat/issues
https://github.com/dromara/hertzbeat/pulls
https://gitee.com/dromara/hertzbeat/issues
https://gitee.com/dromara/hertzbeat/pulls
- 💬**建议**:也可以对项目或者社区提出一些建议,促进社区的良性发展;

## 本地代码工程启动
更多贡献方式参见 [Contribution Types](https://allcontributors.org/docs/en/emoji-key)

此为前后端分离项目,本地代码启动需将后端 [manager](https://github.com/dromara/hertzbeat/tree/master/manager) 和前端 [web-app](https://github.com/dromara/hertzbeat/tree/master/web-app) 分别启动生效。
即便是小到错别字的修正我们也都非常欢迎 :)

### 后端启动
### 让 HertzBeat 运行起来

> 让 HertzBeat 的代码在您的开发工具上运行起来,并且能够断点调试。
> 此为前后端分离项目,本地代码启动需将后端 [manager](https://github.com/dromara/hertzbeat/tree/master/manager) 和前端 [web-app](https://github.com/dromara/hertzbeat/tree/master/web-app) 分别启动生效。

- 后端启动

1. 部署启动依赖服务`MYSQL`和`TDengine`数据库
2. 需要`maven3+``java8+`环境
2. 需要`maven3+`, `java8+`和`lombok`环境
3. 修改配置文件的依赖服务地址等信息-`manager/src/main/resources/application.yml`
4. 启动`manager`服务 `manager/src/main/java/com/usthe/manager/Manager.java`
4. 启动`springboot manager`服务 `manager/src/main/java/com/usthe/manager/Manager.java`

### 前端启动
- 前端启动

1. 需要nodejs npm环境
下载地址:https://nodejs.org/en/download
1. 需要`nodejs npm angular-cli`环境
2. 安装yarn `npm install -g yarn`
3. 在前端工程目录web-app下执行 `yarn install`
4. 全局安装angular-cli `npm install -g @angular/cli@12 --registry=https://registry.npm.taobao.org`
5. 待本地后端启动后,在web-app目录下启动本地前端 `ng serve --open`
6. 浏览器访问 localhost:4200 即可开始

## 加入交流
### 寻找任务

寻找您感兴趣的Issue!在我们的GitHub仓库和邮件列表中,我们经常会发布一些带有 good first issue 或者 status: volunteer wanted 标签的issue,这些issue都欢迎贡献者的帮助。
其中good first issue往往门槛较低、适合新手。

当然,如果您有好的想法,也可以直接在GitHub Discussion 中提出或者联系社区。

### 提交 Pull Request

1. 首先您需要 Fork 目标仓库 [hertzbeat repository](https://github.com/dromara/hertzbeat).
2. 然后 用git命令 将代码下载到本地:
```shell
git clone git@github.com:${YOUR_USERNAME}/hertzbeat.git #Recommended
```
3. 下载完成后,请参考目标仓库的入门指南或者 README 文件对项目进行初始化。
4. 接着,您可以参考如下命令进行代码的提交, 切换新的分支, 进行开发:
```shell
git checkout -b a-feature-branch #Recommended
```
5. 提交 commit , commit 描述信息需要符合约定格式: [module name or type name]feature or bugfix or doc: custom message.
```shell
git add <modified file/path>
git commit -m '[docs]feature: necessary instructions' #Recommended
```
6. 推送到远程仓库
```shell
git push origin a-feature-branch
```
7. 然后您就可以在 GitHub 上发起新的 PR (Pull Request)。

请注意 PR 的标题需要符合我们的规范,并且在 PR 中写上必要的说明,来方便 Committer 和其他贡献者进行代码审查。

### 等待PR代码被合并

在提交了 PR 后,Committer 或者社区的小伙伴们会对您提交的代码进行审查(Code Review),会提出一些修改建议,或者是进行一些讨论,请及时关注您的PR。

若后续需要改动,不需要发起一个新的 PR,在原有的分支上提交 commit 并推送到远程仓库后,PR会自动更新。

另外,我们的项目有比较规范和严格的 CI 检查流程,在提交 PR 之后会触发 CI,请注意是否通过 CI 检查。

最后,Committer 可以将 PR 合并入DEV主分支。

### 代码被合并后

在代码被合并后,您就可以在本地和远程仓库删除这个开发分支了:

```shell
git branch -d a-dev-branch
git push origin --delete a-dev-branch
```

在主分支上,您可以执行以下操作来同步上游仓库:

```shell
git remote add upstream https://github.com/dromara/hertzbeat.git #Bind the remote warehouse, if it has been executed, it does not need to be executed again
git checkout master
git pull upstream master
```

### 如何成为Committer?

通过上述步骤,您就是 HertzBeat 的贡献者了。重复前面的步骤,在社区中保持活跃,坚持下去,您就能成为 Committer!

### 加入讨论交流

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

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

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

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

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

微信公众号: `tancloudtech`

### 模块

- **[manager](https://github.com/dromara/hertzbeat/tree/master/manager)** 提供监控管理,系统管理基础服务
> 提供对监控的管理,监控应用配置的管理,系统用户租户后台管理等。
- **[collector](https://github.com/dromara/hertzbeat/tree/master/collector)** 提供监控数据采集服务
> 使用通用协议远程采集获取对端指标数据。
- **[warehouse](https://github.com/dromara/hertzbeat/tree/master/warehouse)** 提供监控数据仓储服务
> 采集指标结果数据管理,数据落盘,查询,计算统计。
- **[alerter](https://github.com/dromara/hertzbeat/tree/master/alerter)** 提供告警服务
> 告警计算触发,监控状态联动,告警配置,告警通知。
- **[web-app](https://github.com/dromara/hertzbeat/tree/master/web-app)** 提供可视化控制台页面
> 监控告警系统可视化控制台前端

[Github Discussion](https://github.com/dromara/hertzbeat/discussions)
加微信号 tan-cloud 拉您进微信交流群
加QQ群号 718618151 进QQ交流群, 验证信息: tancloud
微信公众号:tancloudtech
[Dromara社区网站](https://dromara.org/)
[HertzBeat用户网站](https://support.qq.com/products/379369)
![hertzBeat](https://cdn.jsdelivr.net/gh/dromara/hertzbeat@gh-pages/img/docs/hertzbeat-stru.svg)
10 changes: 9 additions & 1 deletion home/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ module.exports = {
position: 'left',
to: 'docs/others/private',
},
{
label: '贡献者指南',
position: 'left',
to: 'docs/others/contributing',
},
{
label: '项目看板',
position: 'left',
Expand Down Expand Up @@ -300,6 +305,9 @@ module.exports = {
],
themes: ['@docusaurus/theme-live-codeblock'],
scripts: [
'https://cdn.jsdelivr.net/gh/buttons/buttons.github.io/buttons.js'
{
src: 'https://cdn.jsdelivr.net/gh/buttons/buttons.github.io/buttons.js',
async: true
}
]
}
2 changes: 1 addition & 1 deletion home/i18n/en/code.json
Original file line number Diff line number Diff line change
Expand Up @@ -286,4 +286,4 @@
"message": "On this page",
"description": "The label used by the button on the collapsible TOC component"
}
}
}
10 changes: 9 additions & 1 deletion home/i18n/en/docusaurus-plugin-content-docs/current.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,13 @@
"sidebar.docs.category.告警通知配置": {
"message": "Alarm Notice Setting",
"description": "The label for category 告警通知配置 in sidebar docs"
},
"sidebar.docs.category.中间件": {
"message": "中间件",
"description": "The label for category 中间件 in sidebar docs"
},
"sidebar.docs.category.Others": {
"message": "Others",
"description": "The label for category Others in sidebar docs"
}
}
}
Loading

0 comments on commit 848a28d

Please sign in to comment.