Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[hertzbeat] upgrade springboot version 2.4.13 to 2.7.4 #316

Merged
merged 15 commits into from
Oct 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,24 @@
"contributions": [
"doc"
]
},
{
"login": "SxLiuYu",
"name": "SxLiuYu",
"avatar_url": "https://avatars.githubusercontent.com/u/95198625?v=4",
"profile": "https://github.com/SxLiuYu",
"contributions": [
"bug"
]
},
{
"login": "all-contributors",
"name": "All Contributors",
"avatar_url": "https://avatars.githubusercontent.com/u/46410174?v=4",
"profile": "https://allcontributors.org",
"contributions": [
"doc"
]
}
],
"contributorsPerLine": 7
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ name: "CodeQL"

on:
push:
branches: [ master ]
branches: [ master, dev ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
branches: [ master, dev ]
schedule:
- cron: '21 13 * * 4'

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/maven-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: Java CI with Maven

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

jobs:
build:
Expand Down
63 changes: 34 additions & 29 deletions README.md

Large diffs are not rendered by default.

63 changes: 34 additions & 29 deletions README_CN.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions alerter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@
</dependency>
<!-- swagger -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<scope>provided</scope>
</dependency>
<!-- 表达式计算 -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
import com.usthe.common.entity.alerter.AlertDefineMonitorBind;
import com.usthe.alert.service.AlertDefineService;
import com.usthe.common.entity.dto.Message;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
Expand All @@ -48,7 +48,7 @@
* @author tom
* @date 2021/12/9 10:32
*/
@Api(tags = "Alert Define API | 告警定义管理API")
@Tag(name = "Alert Define API | 告警定义管理API")
@RestController
@RequestMapping(path = "/api/alert/define", produces = {APPLICATION_JSON_VALUE})
public class AlertDefineController {
Expand All @@ -57,7 +57,7 @@ public class AlertDefineController {
private AlertDefineService alertDefineService;

@PostMapping
@ApiOperation(value = "新增告警定义", notes = "新增一个告警定义")
@Operation(summary = "新增告警定义", description = "新增一个告警定义")
public ResponseEntity<Message<Void>> addNewAlertDefine(@Valid @RequestBody AlertDefine alertDefine) {
// 校验请求数据
alertDefineService.validate(alertDefine, false);
Expand All @@ -66,7 +66,7 @@ public ResponseEntity<Message<Void>> addNewAlertDefine(@Valid @RequestBody Alert
}

@PutMapping
@ApiOperation(value = "修改告警定义", notes = "修改一个已存在告警定义")
@Operation(summary = "修改告警定义", description = "修改一个已存在告警定义")
public ResponseEntity<Message<Void>> modifyAlertDefine(@Valid @RequestBody AlertDefine alertDefine) {
// 校验请求数据
alertDefineService.validate(alertDefine, true);
Expand All @@ -75,9 +75,9 @@ public ResponseEntity<Message<Void>> modifyAlertDefine(@Valid @RequestBody Alert
}

@GetMapping(path = "/{id}")
@ApiOperation(value = "查询告警定义", notes = "根据告警定义ID获取告警定义信息")
@Operation(summary = "查询告警定义", description = "根据告警定义ID获取告警定义信息")
public ResponseEntity<Message<AlertDefine>> getAlertDefine(
@ApiParam(value = "告警定义ID", example = "6565463543") @PathVariable("id") long id) {
@Parameter(description = "告警定义ID", example = "6565463543") @PathVariable("id") long id) {
// 获取监控信息
AlertDefine alertDefine = alertDefineService.getAlertDefine(id);
Message.MessageBuilder<AlertDefine> messageBuilder = Message.builder();
Expand All @@ -90,27 +90,27 @@ public ResponseEntity<Message<AlertDefine>> getAlertDefine(
}

@DeleteMapping(path = "/{id}")
@ApiOperation(value = "删除告警定义", notes = "根据告警定义ID删除告警定义,告警定义不存在也是删除成功")
@Operation(summary = "删除告警定义", description = "根据告警定义ID删除告警定义,告警定义不存在也是删除成功")
public ResponseEntity<Message<Void>> deleteAlertDefine(
@ApiParam(value = "告警定义ID", example = "6565463543") @PathVariable("id") long id) {
@Parameter(description = "告警定义ID", example = "6565463543") @PathVariable("id") long id) {
// 删除告警定义不存在或删除成功都返回成功
alertDefineService.deleteAlertDefine(id);
return ResponseEntity.ok(new Message<>("Delete success"));
}

@PostMapping(path = "/{alertDefineId}/monitors")
@ApiOperation(value = "应用告警定义与监控关联", notes = "应用指定告警定义与监控关联关系")
@Operation(summary = "应用告警定义与监控关联", description = "应用指定告警定义与监控关联关系")
public ResponseEntity<Message<Void>> applyAlertDefineMonitorsBind(
@ApiParam(value = "告警定义ID", example = "6565463543") @PathVariable("alertDefineId") long alertDefineId,
@Parameter(description = "告警定义ID", example = "6565463543") @PathVariable("alertDefineId") long alertDefineId,
@RequestBody List<AlertDefineMonitorBind> alertDefineMonitorBinds) {
alertDefineService.applyBindAlertDefineMonitors(alertDefineId, alertDefineMonitorBinds);
return ResponseEntity.ok(new Message<>("Apply success"));
}

@GetMapping(path = "/{alertDefineId}/monitors")
@ApiOperation(value = "应用告警定义与监控关联", notes = "应用指定告警定义与监控关联关系")
@Operation(summary = "应用告警定义与监控关联", description = "应用指定告警定义与监控关联关系")
public ResponseEntity<Message<List<AlertDefineMonitorBind>>> getAlertDefineMonitorsBind(
@ApiParam(value = "告警定义ID", example = "6565463543") @PathVariable("alertDefineId") long alertDefineId) {
@Parameter(description = "告警定义ID", example = "6565463543") @PathVariable("alertDefineId") long alertDefineId) {
List<AlertDefineMonitorBind> defineBinds = alertDefineService.getBindAlertDefineMonitors(alertDefineId);
defineBinds = defineBinds.stream().filter(item -> item.getMonitor() != null).collect(Collectors.toList());
return ResponseEntity.ok(new Message<>(defineBinds));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
import com.usthe.common.entity.alerter.AlertDefine;
import com.usthe.alert.service.AlertDefineService;
import com.usthe.common.entity.dto.Message;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
Expand All @@ -48,7 +48,7 @@
* @author tom
* @date 2021/12/9 10:32
*/
@Api(tags = "Alert Define Batch API | 告警定义管理API")
@Tag(name = "Alert Define Batch API | 告警定义管理API")
@RestController
@RequestMapping(path = "/api/alert/defines", produces = {APPLICATION_JSON_VALUE})
public class AlertDefinesController {
Expand All @@ -57,14 +57,14 @@ public class AlertDefinesController {
private AlertDefineService alertDefineService;

@GetMapping
@ApiOperation(value = "查询告警定义列表", notes = "根据查询过滤项获取告警定义信息列表")
@Operation(summary = "查询告警定义列表", description = "根据查询过滤项获取告警定义信息列表")
public ResponseEntity<Message<Page<AlertDefine>>> getAlertDefines(
@ApiParam(value = "告警定义ID", example = "6565463543") @RequestParam(required = false) List<Long> ids,
@ApiParam(value = "告警定义级别", example = "6565463543") @RequestParam(required = false) Byte priority,
@ApiParam(value = "排序字段,默认id", example = "id") @RequestParam(defaultValue = "id") String sort,
@ApiParam(value = "排序方式,asc:升序,desc:降序", example = "desc") @RequestParam(defaultValue = "desc") String order,
@ApiParam(value = "列表当前分页", example = "0") @RequestParam(defaultValue = "0") int pageIndex,
@ApiParam(value = "列表分页数量", example = "8") @RequestParam(defaultValue = "8") int pageSize) {
@Parameter(description = "告警定义ID", example = "6565463543") @RequestParam(required = false) List<Long> ids,
@Parameter(description = "告警定义级别", example = "6565463543") @RequestParam(required = false) Byte priority,
@Parameter(description = "排序字段,默认id", example = "id") @RequestParam(defaultValue = "id") String sort,
@Parameter(description = "排序方式,asc:升序,desc:降序", example = "desc") @RequestParam(defaultValue = "desc") String order,
@Parameter(description = "列表当前分页", example = "0") @RequestParam(defaultValue = "0") int pageIndex,
@Parameter(description = "列表分页数量", example = "8") @RequestParam(defaultValue = "8") int pageSize) {

Specification<AlertDefine> specification = (root, query, criteriaBuilder) -> {
List<Predicate> andList = new ArrayList<>();
Expand All @@ -91,9 +91,9 @@ public ResponseEntity<Message<Page<AlertDefine>>> getAlertDefines(
}

@DeleteMapping
@ApiOperation(value = "批量删除告警定义", notes = "根据告警定义ID列表批量删除告警定义")
@Operation(summary = "批量删除告警定义", description = "根据告警定义ID列表批量删除告警定义")
public ResponseEntity<Message<Void>> deleteAlertDefines(
@ApiParam(value = "告警定义IDs", example = "6565463543") @RequestParam(required = false) List<Long> ids
@Parameter(description = "告警定义IDs", example = "6565463543") @RequestParam(required = false) List<Long> ids
) {
if (ids != null && !ids.isEmpty()) {
alertDefineService.deleteAlertDefines(new HashSet<>(ids));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import com.usthe.alert.service.AlertService;
import com.usthe.common.entity.dto.AlertReport;
import com.usthe.common.entity.dto.Message;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
Expand All @@ -48,7 +48,7 @@
* @author tom
* @date 2021/12/9 10:32
*/
@Api(tags = "Alarm Manage Batch API | 告警批量管理API")
@Tag(name = "Alarm Manage Batch API | 告警批量管理API")
@RestController
@RequestMapping(path = "/api/alerts", produces = {APPLICATION_JSON_VALUE})
public class AlertsController {
Expand All @@ -57,17 +57,17 @@ public class AlertsController {
private AlertService alertService;

@GetMapping
@ApiOperation(value = "Get a list of alarm information based on query filter items", notes = "根据查询过滤项获取告警信息列表")
@Operation(summary = "Get a list of alarm information based on query filter items", description = "根据查询过滤项获取告警信息列表")
public ResponseEntity<Message<Page<Alert>>> getAlerts(
@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) {
@Parameter(description = "Alarm ID List | 告警IDS", example = "6565466456") @RequestParam(required = false) List<Long> ids,
@Parameter(description = "Alarm monitor object ID | 告警监控对象ID", example = "6565463543") @RequestParam(required = false) Long monitorId,
@Parameter(description = "Alarm level | 告警级别", example = "6565463543") @RequestParam(required = false) Byte priority,
@Parameter(description = "Alarm Status | 告警状态", example = "6565463543") @RequestParam(required = false) Byte status,
@Parameter(description = "Alarm content fuzzy query | 告警内容模糊查询", example = "linux") @RequestParam(required = false) String content,
@Parameter(description = "Sort field, default id | 排序字段,默认id", example = "name") @RequestParam(defaultValue = "id") String sort,
@Parameter(description = "Sort Type | 排序方式,asc:升序,desc:降序", example = "desc") @RequestParam(defaultValue = "desc") String order,
@Parameter(description = "List current page | 列表当前分页", example = "0") @RequestParam(defaultValue = "0") int pageIndex,
@Parameter(description = "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 @@ -106,9 +106,9 @@ public ResponseEntity<Message<Page<Alert>>> getAlerts(
}

@DeleteMapping
@ApiOperation(value = "Delete alarms in batches", notes = "根据告警ID列表批量删除告警")
@Operation(summary = "Delete alarms in batches", description = "根据告警ID列表批量删除告警")
public ResponseEntity<Message<Void>> deleteAlerts(
@ApiParam(value = "Alarm List ID | 告警IDs", example = "6565463543") @RequestParam(required = false) List<Long> ids) {
@Parameter(description = "Alarm List ID | 告警IDs", example = "6565463543") @RequestParam(required = false) List<Long> ids) {
if (ids != null && !ids.isEmpty()) {
alertService.deleteAlerts(new HashSet<>(ids));
}
Expand All @@ -117,18 +117,18 @@ public ResponseEntity<Message<Void>> deleteAlerts(
}

@DeleteMapping("/clear")
@ApiOperation(value = "Delete alarms in batches", notes = "清空所有告警信息")
@Operation(summary = "Delete alarms in batches", description = "清空所有告警信息")
public ResponseEntity<Message<Void>> clearAllAlerts() {
alertService.clearAlerts();
Message<Void> message = new Message<>();
return ResponseEntity.ok(message);
}

@PutMapping(path = "/status/{status}")
@ApiOperation(value = "Batch modify alarm status, set read and unread", notes = "批量修改告警状态,设置已读未读")
@Operation(summary = "Batch modify alarm status, set read and unread", description = "批量修改告警状态,设置已读未读")
public ResponseEntity<Message<Void>> applyAlertDefinesStatus(
@ApiParam(value = "Alarm status value | 告警状态值", example = "0") @PathVariable Byte status,
@ApiParam(value = "Alarm List IDS | 告警IDS", example = "6565463543") @RequestParam(required = false) List<Long> ids) {
@Parameter(description = "Alarm status value | 告警状态值", example = "0") @PathVariable Byte status,
@Parameter(description = "Alarm List IDS | 告警IDS", example = "6565463543") @RequestParam(required = false) List<Long> ids) {
if (ids != null && status != null && !ids.isEmpty()) {
alertService.editAlertStatus(status, ids);
}
Expand All @@ -137,15 +137,15 @@ public ResponseEntity<Message<Void>> applyAlertDefinesStatus(
}

@GetMapping(path = "/summary")
@ApiOperation(value = "Get alarm statistics", notes = "获取告警统计信息")
@Operation(summary = "Get alarm statistics", description = "获取告警统计信息")
public ResponseEntity<Message<AlertSummary>> getAlertsSummary() {
AlertSummary alertSummary = alertService.getAlertsSummary();
Message<AlertSummary> message = new Message<>(alertSummary);
return ResponseEntity.ok(message);
}

@PostMapping("/report")
@ApiOperation(value = "对外上报告警信息 接口", notes = "对外 新增一个告警")
@Operation(summary = "对外上报告警信息 接口", description = "对外 新增一个告警")
public ResponseEntity<Message<Void>> addNewAlertReport(@Valid @RequestBody AlertReport alertReport) {
// 校验请求数据 TODO
alertService.addNewAlertReport(alertReport);
Expand Down
Loading