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
|
||||
cd $GOPATH/src/github.com/didi
|
||||
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/))
|
||||
|
|
|
@ -15,7 +15,10 @@ Nightingale是一套衍生自Open-Falcon的互联网监控解决方案,融入
|
|||
mkdir -p $GOPATH/src/github.com/didi
|
||||
cd $GOPATH/src/github.com/didi
|
||||
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()
|
||||
{
|
||||
export GO111MODULE=on
|
||||
export GOPROXY=https://mod.gokit.info
|
||||
export GO111MODULE=on
|
||||
|
||||
mod=$1
|
||||
if [ "x${mod}" = "x" ]; then
|
||||
|
|
|
@ -24,6 +24,17 @@ type QueryDataForUI struct {
|
|||
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 {
|
||||
Data []*TsdbQueryResponse
|
||||
Msg string
|
||||
|
|
|
@ -46,18 +46,50 @@ func QueryData(c *gin.Context) {
|
|||
func QueryDataForUI(c *gin.Context) {
|
||||
stats.Counter.Set("data.ui.qp10s", 1)
|
||||
var input dataobj.QueryDataForUI
|
||||
|
||||
var respData []*dataobj.QueryDataForUIResp
|
||||
errors.Dangerous(c.ShouldBindJSON(&input))
|
||||
start := input.Start
|
||||
end := input.End
|
||||
|
||||
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 {
|
||||
for i := 1; i < len(input.Comparisons); i++ {
|
||||
input.Start = input.Start - input.Comparisons[i]
|
||||
input.End = input.End - input.Comparisons[i]
|
||||
comparison := input.Comparisons[i]
|
||||
input.Start = start - comparison
|
||||
input.End = end - comparison
|
||||
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