Compare commits
6 Commits
feature#li
...
fix#cache
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c4d3d80b0 | ||
|
|
4ce0698834 | ||
|
|
6c69da92f6 | ||
|
|
84c1f6b348 | ||
|
|
4ebf408349 | ||
|
|
5b33ac687e |
3
.github/FUNDING.yml
vendored
Normal file
3
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
custom: ['https://hertzbeat.com/docs/others/sponsor']
|
||||
31
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
31
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**Used Version**
|
||||
the version , tag or branch used
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
8
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
8
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
blank_issues_enabled: true
|
||||
contact_links:
|
||||
- name: Community Support
|
||||
url: https://github.com/dromara/hertzbeat/discussions
|
||||
about: Please ask and answer questions here.
|
||||
- name: Security Bug Bounty
|
||||
url: https://github.com/dromara/hertzbeat/issues
|
||||
about: Please report security vulnerabilities here.
|
||||
10
.github/ISSUE_TEMPLATE/custom.md
vendored
Normal file
10
.github/ISSUE_TEMPLATE/custom.md
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
name: Custom issue template
|
||||
about: Describe this issue template's purpose here.
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
|
||||
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
67
.github/workflows/codeql-analysis.yml
vendored
Normal file
67
.github/workflows/codeql-analysis.yml
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# We have attempted to detect the languages in your repository. Please check
|
||||
# the `language` matrix defined below to confirm you have the correct set of
|
||||
# supported CodeQL languages.
|
||||
#
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ master ]
|
||||
schedule:
|
||||
- cron: '21 13 * * 4'
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'java' ]
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
||||
# Learn more:
|
||||
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v1
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
||||
12
.github/workflows/issues-translator.yml
vendored
Normal file
12
.github/workflows/issues-translator.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
name: 'issues-translator'
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
issues:
|
||||
types: [opened]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: tomsun28/issues-translate-action@v2.6
|
||||
24
.github/workflows/maven-build.yml
vendored
Normal file
24
.github/workflows/maven-build.yml
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
# 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: Java CI with Maven
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 1.8
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 1.8
|
||||
- name: Build with Maven
|
||||
run: mvn -B package --file pom.xml
|
||||
62
CONTRIBUTING.md
Normal file
62
CONTRIBUTING.md
Normal file
@@ -0,0 +1,62 @@
|
||||
参与贡献
|
||||
=======================================
|
||||
|
||||
非常欢迎参与项目贡献,我们致力于维护一个互相帮助的快乐社区。
|
||||
|
||||
### 模块
|
||||
|
||||
- **[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)** 提供可视化控制台页面
|
||||
> 监控告警系统可视化控制台前端
|
||||
|
||||

|
||||
|
||||
## 如何贡献?
|
||||
|
||||
我们不仅仅接收代码的贡献提交,您也可以通过提交文档的更新或者BUG的报告来参与社区贡献。
|
||||
|
||||
如果是新的贡献者,请首先了解参考仓库提交Issues,提交Pull Requests如何工作。
|
||||
|
||||
https://github.com/dromara/hertzbeat/issues
|
||||
https://github.com/dromara/hertzbeat/pulls
|
||||
https://gitee.com/dromara/hertzbeat/issues
|
||||
https://gitee.com/dromara/hertzbeat/pulls
|
||||
|
||||
## 本地代码工程启动
|
||||
|
||||
此为前后端分离项目,本地代码启动需将后端[manager](manager)和前端[web-app](web-app)分别启动生效。
|
||||
|
||||
### 后端启动
|
||||
|
||||
1. 部署启动依赖服务`MYSQL`和`TDengine`数据库
|
||||
2. 需要`maven3+`和`java8+`环境
|
||||
3. 修改配置文件的依赖服务地址等信息-`manager/src/main/resources/application.yml`
|
||||
4. 启动`manager`服务 `manager/src/main/java/com/usthe/manager/Manager.java`
|
||||
|
||||
### 前端启动
|
||||
|
||||
1. 需要nodejs npm环境
|
||||
下载地址:https://nodejs.org/en/download
|
||||
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 即可开始
|
||||
|
||||
## 加入交流
|
||||
|
||||
[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)
|
||||
@@ -95,6 +95,14 @@
|
||||
|
||||
详细步骤参考 [通过安装包安装HertzBeat](https://hertzbeat.com/docs/start/package-deploy)
|
||||
|
||||
##### 本地代码启动
|
||||
1. 此为前后端分离项目,本地代码调试需要分别启动后端工程manager和前端工程web-app
|
||||
2. 后端:需要`maven3+`和`java8+`环境,修改YML配置信息并启动manager服务
|
||||
3. 前端:需要`nodejs npm angular-cli`环境,待本地后端启动后,在web-app目录下启动 `ng serve --open`
|
||||
4. 浏览器访问 localhost:4200 即可开始
|
||||
|
||||
详细步骤参考 [参与贡献之本地代码启动](CONTRIBUTING.md)
|
||||
|
||||
**HAVE FUN**
|
||||
|
||||
## 💬 社区交流
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.usthe.collector.collect.common.cache;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* 缓存key唯一标识符
|
||||
@@ -10,6 +11,7 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@ToString
|
||||
public class CacheIdentifier {
|
||||
|
||||
private String ip;
|
||||
|
||||
@@ -21,9 +21,9 @@ import java.util.concurrent.TimeUnit;
|
||||
public class CommonCache {
|
||||
|
||||
/**
|
||||
* 默认缓存时间 10minute
|
||||
* 默认缓存时间 800s
|
||||
*/
|
||||
private static final long DEFAULT_CACHE_TIMEOUT = 10 * 60 * 1000L;
|
||||
private static final long DEFAULT_CACHE_TIMEOUT = 800 * 1000L;
|
||||
|
||||
/**
|
||||
* 默认最大缓存数量
|
||||
@@ -173,9 +173,11 @@ public class CommonCache {
|
||||
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);
|
||||
return Optional.empty();
|
||||
}
|
||||
if (cacheTime[0] + cacheTime[1] < System.currentTimeMillis()) {
|
||||
log.warn("[cache] is timeout, key {}.", key);
|
||||
timeoutMap.remove(key);
|
||||
cacheMap.remove(key);
|
||||
return Optional.empty();
|
||||
|
||||
@@ -134,7 +134,7 @@ public class JdbcCommonCollect extends AbstractCollect {
|
||||
// 设置查询最大行数1000行
|
||||
statement.setMaxRows(1000);
|
||||
JdbcConnect jdbcConnect = new JdbcConnect(connection);
|
||||
CommonCache.getInstance().addCache(identifier, jdbcConnect, 10000L);
|
||||
CommonCache.getInstance().addCache(identifier, jdbcConnect);
|
||||
return statement;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<h1 align="center">HertzBeat</h1>
|
||||
|
||||
> 前端工程
|
||||
|
||||
**面向开发者,易用友好的高性能监控云服务**
|
||||
**面向开发者,易用友好的监控告警系统**
|
||||
|
||||
## 本地启动
|
||||
## 前端本地启动
|
||||
|
||||
### npm 方式
|
||||
1. 需要nodejs npm环境
|
||||
@@ -21,13 +19,13 @@
|
||||
4. 全局安装angular-cli `npm install -g @angular/cli@12 --registry=https://registry.npm.taobao.org`
|
||||
5. 待本地后端启动后,在web-app目录下启动本地前端 `ng serve --open`
|
||||
|
||||
## 编译打包
|
||||
## hertzbeat 编译打包
|
||||
|
||||
web-app目录下执行
|
||||
1. web-app目录下执行
|
||||
|
||||
```ng build --prod --base-href /console/```
|
||||
|
||||
manager目录下执行
|
||||
2. manager目录下执行
|
||||
|
||||
```mvn package```
|
||||
|
||||
|
||||
@@ -28,11 +28,11 @@
|
||||
</button>
|
||||
<button nz-button nzType="primary" (click)="onEnableManageMonitors()">
|
||||
<i nz-icon nzType="up-circle" nzTheme="outline"></i>
|
||||
启用纳管
|
||||
启用监控
|
||||
</button>
|
||||
<button nz-button nzType="primary" (click)="onCancelManageMonitors()">
|
||||
<i nz-icon nzType="down-circle" nzTheme="outline"></i>
|
||||
取消纳管
|
||||
取消监控
|
||||
</button>
|
||||
<button nz-button nzType="primary" (click)="sync()" nz-tooltip nzTooltipTitle="刷新">
|
||||
<i nz-icon nzType="sync" nzTheme="outline"></i>
|
||||
@@ -109,10 +109,10 @@
|
||||
<button nz-button nzType="primary" (click)="onDeleteOneMonitor(data.id)" nz-tooltip nzTooltipTitle="删除监控">
|
||||
<i nz-icon nzType="delete" nzTheme="outline"></i>
|
||||
</button>
|
||||
<button nz-button nzType="primary" (click)="onEnableManageOneMonitor(data.id)" nz-tooltip nzTooltipTitle="启用纳管">
|
||||
<button nz-button nzType="primary" (click)="onEnableManageOneMonitor(data.id)" nz-tooltip nzTooltipTitle="启用监控">
|
||||
<i nz-icon nzType="up-circle" nzTheme="outline"></i>
|
||||
</button>
|
||||
<button nz-button nzType="primary" (click)="onCancelManageOneMonitor(data.id)" nz-tooltip nzTooltipTitle="取消纳管">
|
||||
<button nz-button nzType="primary" (click)="onCancelManageOneMonitor(data.id)" nz-tooltip nzTooltipTitle="取消监控">
|
||||
<i nz-icon nzType="down-circle" nzTheme="outline"></i>
|
||||
</button>
|
||||
</td>
|
||||
|
||||
@@ -154,7 +154,7 @@ export class MonitorListComponent implements OnInit {
|
||||
return;
|
||||
}
|
||||
this.modal.confirm({
|
||||
nzTitle: '请确认是否批量取消纳管!',
|
||||
nzTitle: '请确认是否批量取消监控!',
|
||||
nzOkText: '确定',
|
||||
nzCancelText: '取消',
|
||||
nzOkDanger: true,
|
||||
@@ -167,7 +167,7 @@ export class MonitorListComponent implements OnInit {
|
||||
let monitors = new Set<number>();
|
||||
monitors.add(monitorId);
|
||||
this.modal.confirm({
|
||||
nzTitle: '请确认是否取消纳管!',
|
||||
nzTitle: '请确认是否取消监控!',
|
||||
nzOkText: '确定',
|
||||
nzCancelText: '取消',
|
||||
nzOkDanger: true,
|
||||
@@ -182,28 +182,28 @@ export class MonitorListComponent implements OnInit {
|
||||
message => {
|
||||
cancelManage$.unsubscribe();
|
||||
if (message.code === 0) {
|
||||
this.notifySvc.success('取消纳管成功!', '');
|
||||
this.notifySvc.success('取消监控成功!', '');
|
||||
this.loadMonitorTable();
|
||||
} else {
|
||||
this.tableLoading = false;
|
||||
this.notifySvc.error('取消纳管失败!', message.msg);
|
||||
this.notifySvc.error('取消监控失败!', message.msg);
|
||||
}
|
||||
},
|
||||
error => {
|
||||
this.tableLoading = false;
|
||||
cancelManage$.unsubscribe();
|
||||
this.notifySvc.error('取消纳管失败!', error.msg);
|
||||
this.notifySvc.error('取消监控失败!', error.msg);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
onEnableManageMonitors() {
|
||||
if (this.checkedMonitorIds == null || this.checkedMonitorIds.size === 0) {
|
||||
this.notifySvc.warning('未选中任何待启用纳管项!', '');
|
||||
this.notifySvc.warning('未选中任何待启用监控项!', '');
|
||||
return;
|
||||
}
|
||||
this.modal.confirm({
|
||||
nzTitle: '请确认是否批量启用纳管!',
|
||||
nzTitle: '请确认是否批量启用监控!',
|
||||
nzOkText: '确定',
|
||||
nzCancelText: '取消',
|
||||
nzOkDanger: true,
|
||||
@@ -216,7 +216,7 @@ export class MonitorListComponent implements OnInit {
|
||||
let monitors = new Set<number>();
|
||||
monitors.add(monitorId);
|
||||
this.modal.confirm({
|
||||
nzTitle: '请确认是否启用纳管!',
|
||||
nzTitle: '请确认是否启用监控!',
|
||||
nzOkText: '确定',
|
||||
nzCancelText: '取消',
|
||||
nzOkDanger: true,
|
||||
@@ -231,17 +231,17 @@ export class MonitorListComponent implements OnInit {
|
||||
message => {
|
||||
enableManage$.unsubscribe();
|
||||
if (message.code === 0) {
|
||||
this.notifySvc.success('启用纳管成功!', '');
|
||||
this.notifySvc.success('启用监控成功!', '');
|
||||
this.loadMonitorTable();
|
||||
} else {
|
||||
this.tableLoading = false;
|
||||
this.notifySvc.error('启用纳管失败!', message.msg);
|
||||
this.notifySvc.error('启用监控失败!', message.msg);
|
||||
}
|
||||
},
|
||||
error => {
|
||||
this.tableLoading = false;
|
||||
enableManage$.unsubscribe();
|
||||
this.notifySvc.error('启用纳管失败!', error.msg);
|
||||
this.notifySvc.error('启用监控失败!', error.msg);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user