Merge branch 'master' into feature/docker
This commit is contained in:
commit
cc7c280229
|
@ -15,7 +15,10 @@ Nightingale user manual: [https://n9e.didiyun.com/](https://n9e.didiyun.com/)
|
||||||
mkdir -p $GOPATH/src/github.com/didi
|
mkdir -p $GOPATH/src/github.com/didi
|
||||||
cd $GOPATH/src/github.com/didi
|
cd $GOPATH/src/github.com/didi
|
||||||
git clone https://github.com/didi/nightingale.git
|
git clone https://github.com/didi/nightingale.git
|
||||||
cd nightingale && ./control build
|
cd nightingale
|
||||||
|
# export env[GOPROXY] if your network is not good
|
||||||
|
# export GOPROXY=https://mirrors.aliyun.com/goproxy/
|
||||||
|
./control build
|
||||||
```
|
```
|
||||||
|
|
||||||
## Quick Start (need install docker for [mac](https://docs.docker.com/docker-for-mac/install/)/[win](https://docs.docker.com/docker-for-windows/install/))
|
## Quick Start (need install docker for [mac](https://docs.docker.com/docker-for-mac/install/)/[win](https://docs.docker.com/docker-for-windows/install/))
|
||||||
|
|
|
@ -15,7 +15,10 @@ Nightingale是一套衍生自Open-Falcon的互联网监控解决方案,融入
|
||||||
mkdir -p $GOPATH/src/github.com/didi
|
mkdir -p $GOPATH/src/github.com/didi
|
||||||
cd $GOPATH/src/github.com/didi
|
cd $GOPATH/src/github.com/didi
|
||||||
git clone https://github.com/didi/nightingale.git
|
git clone https://github.com/didi/nightingale.git
|
||||||
cd nightingale && ./control build
|
cd nightingale
|
||||||
|
# 如果网络环境不好可以尝试aliyun的mirror
|
||||||
|
# export GOPROXY=https://mirrors.aliyun.com/goproxy/
|
||||||
|
./control build
|
||||||
```
|
```
|
||||||
|
|
||||||
## 团队
|
## 团队
|
||||||
|
|
3
control
3
control
|
@ -141,8 +141,7 @@ build_one()
|
||||||
|
|
||||||
build()
|
build()
|
||||||
{
|
{
|
||||||
export GO111MODULE=on
|
export GO111MODULE=on
|
||||||
export GOPROXY=https://mod.gokit.info
|
|
||||||
|
|
||||||
mod=$1
|
mod=$1
|
||||||
if [ "x${mod}" = "x" ]; then
|
if [ "x${mod}" = "x" ]; then
|
||||||
|
|
|
@ -24,6 +24,17 @@ type QueryDataForUI struct {
|
||||||
Comparisons []int64 `json:"comparisons"` //环比多少时间
|
Comparisons []int64 `json:"comparisons"` //环比多少时间
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type QueryDataForUIResp struct {
|
||||||
|
Start int64 `json:"start"`
|
||||||
|
End int64 `json:"end"`
|
||||||
|
Endpoint string `json:"endpoint"`
|
||||||
|
Counter string `json:"counter"`
|
||||||
|
DsType string `json:"dstype"`
|
||||||
|
Step int `json:"step"`
|
||||||
|
Values []*RRDData `json:"values"`
|
||||||
|
Comparison int64 `json:"comparison"`
|
||||||
|
}
|
||||||
|
|
||||||
type QueryDataResp struct {
|
type QueryDataResp struct {
|
||||||
Data []*TsdbQueryResponse
|
Data []*TsdbQueryResponse
|
||||||
Msg string
|
Msg string
|
||||||
|
|
|
@ -46,18 +46,50 @@ func QueryData(c *gin.Context) {
|
||||||
func QueryDataForUI(c *gin.Context) {
|
func QueryDataForUI(c *gin.Context) {
|
||||||
stats.Counter.Set("data.ui.qp10s", 1)
|
stats.Counter.Set("data.ui.qp10s", 1)
|
||||||
var input dataobj.QueryDataForUI
|
var input dataobj.QueryDataForUI
|
||||||
|
var respData []*dataobj.QueryDataForUIResp
|
||||||
errors.Dangerous(c.ShouldBindJSON(&input))
|
errors.Dangerous(c.ShouldBindJSON(&input))
|
||||||
|
start := input.Start
|
||||||
|
end := input.End
|
||||||
|
|
||||||
resp := backend.FetchDataForUI(input)
|
resp := backend.FetchDataForUI(input)
|
||||||
|
for _, d := range resp {
|
||||||
|
data := &dataobj.QueryDataForUIResp{
|
||||||
|
Start: d.Start,
|
||||||
|
End: d.End,
|
||||||
|
Endpoint: d.Endpoint,
|
||||||
|
Counter: d.Counter,
|
||||||
|
DsType: d.DsType,
|
||||||
|
Step: d.Step,
|
||||||
|
Values: d.Values,
|
||||||
|
}
|
||||||
|
respData = append(respData, data)
|
||||||
|
}
|
||||||
|
|
||||||
if len(input.Comparisons) > 1 {
|
if len(input.Comparisons) > 1 {
|
||||||
for i := 1; i < len(input.Comparisons); i++ {
|
for i := 1; i < len(input.Comparisons); i++ {
|
||||||
input.Start = input.Start - input.Comparisons[i]
|
comparison := input.Comparisons[i]
|
||||||
input.End = input.End - input.Comparisons[i]
|
input.Start = start - comparison
|
||||||
|
input.End = end - comparison
|
||||||
res := backend.FetchDataForUI(input)
|
res := backend.FetchDataForUI(input)
|
||||||
resp = append(resp, res...)
|
for _, d := range res {
|
||||||
|
for j := range d.Values {
|
||||||
|
d.Values[j].Timestamp += comparison
|
||||||
|
}
|
||||||
|
|
||||||
|
data := &dataobj.QueryDataForUIResp{
|
||||||
|
Start: d.Start,
|
||||||
|
End: d.End,
|
||||||
|
Endpoint: d.Endpoint,
|
||||||
|
Counter: d.Counter,
|
||||||
|
DsType: d.DsType,
|
||||||
|
Step: d.Step,
|
||||||
|
Values: d.Values,
|
||||||
|
Comparison: comparison,
|
||||||
|
}
|
||||||
|
respData = append(respData, data)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
render.Data(c, resp, nil)
|
render.Data(c, respData, nil)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue