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

[auto-pick-to-release-1.0]Upgrade gateway #57

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,15 @@ module.exports = {
],
"space-infix-ops": "error",
semi: 1,
<<<<<<< HEAD
'space-before-function-paren': ["error", {
"anonymous": "never",
"named": "never",
"asyncArrow": "always"
}],
=======
'space-before-function-paren': ["error", "never"],
>>>>>>> 8b2e53a (mod: fix issue & chore nebula-stats-exporter (#55))
'object-curly-spacing': ['error','always'],
'use-isnan': 'error',
'valid-typeof': 'off',
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
name: Dashboard tar Release
on:
<<<<<<< HEAD
release:
types:
- published
=======
push:
branches:
- nico-dev
>>>>>>> 8b2e53a (mod: fix issue & chore nebula-stats-exporter (#55))
jobs:
package:
name: build package
Expand All @@ -16,13 +22,20 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
<<<<<<< HEAD
ref: 'master'
=======
ref: 'nico-dev'
>>>>>>> 8b2e53a (mod: fix issue & chore nebula-stats-exporter (#55))
path: source/nebula-graph-dashboard
- uses: actions/checkout@v2
with:
repository: vesoft-inc/nebula-http-gateway
path: source/nebula-http-gateway
<<<<<<< HEAD
##ToDO: add nebula-stats-exporter、node-exporter and prometheus
=======
>>>>>>> 8b2e53a (mod: fix issue & chore nebula-stats-exporter (#55))
- uses: actions/setup-go@v2
with:
go-version: '^1.13.1'
Expand All @@ -32,8 +45,14 @@ jobs:
- name: ls
run: ls -a
- name: Package
<<<<<<< HEAD
run: bash ./source/nebula-graph-dashboard/scripts/package.sh ${{ secrets.GA_ID }}
- name: Upload to OSS
run: bash ./source/nebula-graph-dashboard/scripts/upload.sh ${{ secrets.OSS_ENDPOINT }} ${{ secrets.OSS_ID }} ${{ secrets.OSS_SECRET }} ${{ secrets.OSS_URL }}
=======
run: bash ./source/nebula-graph-dashboard/scripts/package.sh
- name: Upload to OSS
run: ls -a & ossutil64 -e ${{ secrets.OSS_ENDPOINT }} -i ${{ secrets.OSS_ID }} -k ${{ secrets.OSS_SECRET }} -f cp ./ ${{ secrets.OSS_URL }} --include "nebula-graph-dashboard-beta.tar.gz" --only-current-dir -r
>>>>>>> 8b2e53a (mod: fix issue & chore nebula-stats-exporter (#55))


86 changes: 86 additions & 0 deletions DEPLOY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<<<<<<< HEAD
# Nebula Graph Dashboard Production Guide(Linux)

## Environment
Expand Down Expand Up @@ -50,20 +51,79 @@ Attention: the file under these packages is compiled under Linux environment, ca
- location:in the same machine with nebula-graph-dashboard
- dependency:modify :`./vendors/prometheus/prometheus.yaml` according to node-exporter and nebula-stats-exporter service address
- Start:
=======
# Nebula Dashboard 部署文档(Linux)

## 下载
` wget https://oss-cdn.nebula-graph.com.cn/nebula-graph-dashboard/nebula-graph-dashboard-beta.tar.gz`

## 解压
`tar -xvf nebula-graph-dashboard-beta.tar.gz`


## 目录结构说明
根目录 nebula-graph-dashboard 下一共五个安装包
- nebula-graph-dashboard ------------------------- 监控平台服务
- nebula-stats-exporter --------------------- Nebula Graph指标采集服务
- node-exporter ----------------------------- 机器指标采集服务
- prometheus -------------------------------- 监控指标存储服务平台
- nebula-http-gateway


## 开始部署

1. 部署 node-exporter 服务采集机器指标
- 安装包:使用 `node-exporter`
- 部署位置:集群里每个需要监控节点机器均需要部署
- 启动方式:
```bash
// 把对应 node-exporter 包放到需要监控采集指标的机器上,启动采集服务
$ cd node-exporter
$ nohup ./node-exporter --web.listen-address=:9200 &
```
启动服务本机地址: http://127.0.0.1:9200

2. 部署服务 nebula-stats-exporter 采集nebula指标
- 安装包: `nebula-stats-exporter`
- 部署位置:与nebula-graph-dashboard部署在同一台机器即可
- 依赖配置: 需要根据nebula服务部署的节点地址来配 `config.yml`
启动方式:
```bash
$ cd nebula-stats-exporter
$ nohup ./nebula-stats-exporter --bare-metal --bare-metal-config=./config.yaml &
```
启动服务本机地址: http://127.0.0.1:9100

3. 部署服务 prometheus
- 安装包:`prometheus`
- 部署位置:与nebula-graph-dashboard部署在同一台机器即可
- 依赖配置:需要根据实际 node-exporter 和 nebula-stats-exporter 的服务ip地址,修改:`./vendors/prometheus/prometheus.yml`
- 启动方式:
>>>>>>> 8b2e53a (mod: fix issue & chore nebula-stats-exporter (#55))
```bash
$ cd prometheus
$ nohup ./prometheus --config.file=./prometheus.yaml &
```
<<<<<<< HEAD
Service address: http://127.0.0.1:9090

4. Nebula-http-gateway
- packages: `nebula-http-gateway`
- location:in the same machine with nebula-graph-dashboard
- Start:
=======
启动服务地址: http://127.0.0.1:9090

4. 部署 nebula-http-gateway
- 安装包: `nebula-http-gateway`
- 部署位置:与nebula-graph-dashboard部署在同一台机器即可
- 启动方式:
>>>>>>> 8b2e53a (mod: fix issue & chore nebula-stats-exporter (#55))
```bash
$ cd nebula-http-gateway
$ nohup ./nebula-httpd &
```
<<<<<<< HEAD
- Service address: http://127.0.0.1:8090

5. nebula-graph-dashboard
Expand All @@ -76,10 +136,18 @@ Attention: the file under these packages is compiled under Linux environment, ca
},
```
- Start:
=======
- 启动服务地址: http://127.0.0.1:8090

5. 部署 nebula-graph-dashboard
- 安装包: `nebula-graph-dashboard`
- 启动方式:
>>>>>>> 8b2e53a (mod: fix issue & chore nebula-stats-exporter (#55))
```bash
$ cd nebula-graph-dashboard
$ npm run start
```
<<<<<<< HEAD
- service address: http://127.0.0.1:7003

1. Open Nebula Graph Dashboard in browser
Expand All @@ -96,6 +164,24 @@ $ kill $(lsof -t -i :9090) # stop prometheus service
$ kill $(lsof -t -i :8090) # stop nebula-http-gateway
$ cd nebula-graph-dashboard
$ npm run stop # stop nebula-graph-dashboard
=======
- 启动服务地址: http://127.0.0.1:7003

6. 浏览器访问 Nebula Dashboard
访问 http://{{ip}}:7003


## 停止服务
目前先通过 `kill -9 pid` 的方式来关停服务:

```bash
$ kill -9 $(lsof -t -i :9200) # 停止 node-exporter 服务
$ kill -9 $(lsof -t -i :9100) # 停止 nebula-stats-exporter 服务
$ kill -9 $(lsof -t -i :9090) # 停止 prometheus 服务
$ kill -9 $(lsof -t -i :8090) # 停止 nebula-http-gateway
$ cd nebula-graph-dashboard
$ npm run stop # 停止 nebula-graph-dashboard
>>>>>>> 8b2e53a (mod: fix issue & chore nebula-stats-exporter (#55))
```


45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Nebula Graph Dashboard
<<<<<<< HEAD
Nebula Graph Dashboard is a tool that assists Nebula Graph in daily service monitoring and management

![](introduction.png)
Expand Down Expand Up @@ -111,3 +112,47 @@ If you plan to set up dashboard in production, refer to:[production guide](DEP

+ [中文](https://docs.nebula-graph.com.cn/2.5.0/nebula-dashboard/1.what-is-dashboard/)
+ [ENGLISH](https://docs.nebula-graph.io/2.5.0/nebula-dashboard/1.what-is-dashboard/)
=======

## 简介
用于 Nebula Graph 服务及机器监控

## 生产使用
参考:[安装部署指南](DEPLOY.md)

## 本地开发

### 环境准备
- node.js
- Linux

### 服务依赖
- [nebula-http-gateway](https://github.com/vesoft-inc/nebula-http-gateway) - nebula-graph 网关服务
需要配置启动8090的端口服务,将 [gateway.conf](./vendors/gateway.conf) 替换掉 gateway 项目中的 [app.conf](https://github.com/vesoft-inc/nebula-http-gateway/blob/master/conf/app.conf) 即可。

- [node-exporter](./vendors/node-exporter/) - 机器指标采集服务
启动命令:`./vendors/node-exporter/node-exporter --web.listen-address=:9200`

- [nebula-stats-exporter](./vendors/nebula-stats-exporter) - nebula graph 指标采集服务
从nebula服务中找到对应的metrics接口,文档可参考[Metrics Exporter](https://docs.nebula-graph.io/1.1/manual-EN/3.build-develop-and-administration/7.monitor/1.metrics-exposer/),修改 [nebula-stats-exporter](./vendors/nebula-stats-exporter/config.yaml)
比如:
```
version: v0.0.3
nebulaItems:
- instanceName: metad0 // 标识
endpointIP: 10.17.101.126 // 将其换成对应IP
endpointPort: 32839 // 找到对应metrics的端口号
componentType: metad // 确定当前填写metrics接口的类型
```
启动命令:`./vendors/nebula-stats-exporter/nebula-stats-exporter --bare-metal --bare-metal-config=./config.yaml`


- [prometheus](./vendors/prometheus/prometheus) - 监控指标存储服务
修改配置:需要根据实际部署的 node-exporter 和 nebula-stats-exporter 的服务ip,修改[prometheus.yaml](./vendors/prometheus/prometheus.yaml)

### 启动 nebula-graph-dashboard
```
$ npm install
$ npm run dev
```
>>>>>>> 8b2e53a (mod: fix issue & chore nebula-stats-exporter (#55))
18 changes: 18 additions & 0 deletions app/assets/components/Charts/LineChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ import { ChartCfg } from '@antv/g2/lib/interface';
export interface IProps {
renderChart: (chartInstance: Chart) => void;
options?: Partial<ChartCfg>
<<<<<<< HEAD
tickInterval?: number
baseLine?: number
yAxisMaximum?:number
isDefaultScale?: boolean
=======
baseLineNum?: number
>>>>>>> 8b2e53a (mod: fix issue & chore nebula-stats-exporter (#55))
}

class LineChart extends React.Component<IProps> {
Expand Down Expand Up @@ -77,25 +81,39 @@ class LineChart extends React.Component<IProps> {
}

renderChart = () => {
<<<<<<< HEAD
const { options, baseLine } = this.props;
=======
const { options, baseLineNum } = this.props;
>>>>>>> 8b2e53a (mod: fix issue & chore nebula-stats-exporter (#55))
this.chartInstance = new Chart({
container: this.chartRef.current,
autoFit: true,
padding: [20, 0, 0, 0],
...options,
});
<<<<<<< HEAD
if(baseLine){
this.chartInstance.annotation().line({
start: ['min', baseLine],
end: ['max', baseLine],
=======
if(baseLineNum){
this.chartInstance.annotation().line({
start: ['min', baseLineNum],
end: ['max', baseLineNum],
>>>>>>> 8b2e53a (mod: fix issue & chore nebula-stats-exporter (#55))
style: {
stroke: '#e6522b',
lineWidth: 1,
lineDash: [3, 3],
},
});
}
<<<<<<< HEAD
this.showScaleByBaseLine();
=======
>>>>>>> 8b2e53a (mod: fix issue & chore nebula-stats-exporter (#55))
this.chartInstance.interaction('brush');
this.props.renderChart(this.chartInstance);
this.chartInstance.render();
Expand Down
42 changes: 42 additions & 0 deletions app/assets/components/DashboardCard/LineCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,22 @@ import { Chart, Geometry } from '@antv/g2';
import { ILineChartMetric, IStatSingleItem } from '@assets/utils/interface';
import { configDetailChart } from '@assets/utils/chart/chart';
import { VALUE_TYPE } from '@assets/utils/promQL';
<<<<<<< HEAD
import { getMaxNumAndLength } from '@assets/utils/dashboard';
=======
import { getProperByteDesc } from '@assets/utils/dashboard';
>>>>>>> 8b2e53a (mod: fix issue & chore nebula-stats-exporter (#55))
import { Spin } from 'antd';
interface IProps {
data: ILineChartMetric[];
valueType: VALUE_TYPE;
sizes?: IStatSingleItem[]
loading: boolean;
<<<<<<< HEAD
baseLine?: number;
=======
baseLineNum?: number;
>>>>>>> 8b2e53a (mod: fix issue & chore nebula-stats-exporter (#55))
}

class LineCard extends React.Component<IProps> {
Expand Down Expand Up @@ -46,6 +54,7 @@ class LineCard extends React.Component<IProps> {
this.chartInstance.changeData(data);
}

<<<<<<< HEAD
render() {
const { loading, data, valueType, baseLine } = this.props;
const { maxNum, maxNumLen } = getMaxNumAndLength({
Expand All @@ -64,6 +73,39 @@ class LineCard extends React.Component<IProps> {
renderChart={this.renderLineChart}
options={{ padding: [20, 20, 60, 6 * maxNumLen + 30 ] }}
/>
=======
getMaxLength = () => {
const { data = [], valueType } = this.props;
const max = _.maxBy(data, item => item.value);
const maxNum = max ? max.value : 0;
const maxNumLen = maxNum.toString().length;

switch (valueType) {
case VALUE_TYPE.percentage:
return 5;
case VALUE_TYPE.byte:
case VALUE_TYPE.byteSecond:
const { value, unit } = getProperByteDesc(maxNum);
if (valueType === VALUE_TYPE.byteSecond) {
return unit.length + value.toString().length+2;
}
return unit.length + value.toString().length;
case VALUE_TYPE.numberSecond:
return maxNumLen + 2;
default:
return maxNumLen;
}
}

render() {
const { loading, baseLineNum } = this.props;
if (loading) {
return <Spin />;
}

return (
<LineChart baseLineNum={baseLineNum} renderChart={this.renderLineChart} options={{ padding: [20, 20, 60, 5 * this.getMaxLength() + 30 ] }} />
>>>>>>> 8b2e53a (mod: fix issue & chore nebula-stats-exporter (#55))
);
}
}
Expand Down
4 changes: 4 additions & 0 deletions app/assets/components/DashboardCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ class DashboardCard extends React.PureComponent<IProps> {
}

render() {
<<<<<<< HEAD
const { title, children, onConfigPanel } = this.props;
=======
const { title, children } = this.props;
>>>>>>> 8b2e53a (mod: fix issue & chore nebula-stats-exporter (#55))
return <div className="dashboard-card">
<div className="inner">
<div className="header">
Expand Down
Loading