Merge branch 'master' of github.com:didi/nightingale
This commit is contained in:
commit
1f88b72dba
|
@ -107,8 +107,8 @@ func ProcCollect(p *models.ProcCollect) {
|
||||||
}
|
}
|
||||||
|
|
||||||
procNumItem := core.GaugeValue("proc.num", cnt, p.Tags)
|
procNumItem := core.GaugeValue("proc.num", cnt, p.Tags)
|
||||||
procFdItem := core.GaugeValue("proc.uptime", uptime, p.Tags)
|
procUptimeItem := core.GaugeValue("proc.uptime", uptime, p.Tags)
|
||||||
procUptimeItem := core.GaugeValue("proc.fdnum", fdNum, p.Tags)
|
procFdItem := core.GaugeValue("proc.fdnum", fdNum, p.Tags)
|
||||||
memUsedItem := core.GaugeValue("proc.mem.used", memory*1024, p.Tags)
|
memUsedItem := core.GaugeValue("proc.mem.used", memory*1024, p.Tags)
|
||||||
ioReadItem := core.GaugeValue("proc.io.read.bytes", ioRead, p.Tags)
|
ioReadItem := core.GaugeValue("proc.io.read.bytes", ioRead, p.Tags)
|
||||||
ioWriteItem := core.GaugeValue("proc.io.write.bytes", ioWrite, p.Tags)
|
ioWriteItem := core.GaugeValue("proc.io.write.bytes", ioWrite, p.Tags)
|
||||||
|
|
|
@ -172,6 +172,7 @@ func Config(r *gin.Engine) {
|
||||||
v1.GET("/node/:id", nodeGet)
|
v1.GET("/node/:id", nodeGet)
|
||||||
v1.GET("/node/:id/projs", v1treeUntilProjectGetsByNid)
|
v1.GET("/node/:id/projs", v1treeUntilProjectGetsByNid)
|
||||||
v1.GET("/tree/projs", v1TreeUntilProjectGets)
|
v1.GET("/tree/projs", v1TreeUntilProjectGets)
|
||||||
|
v1.GET("/tree", v1TreeUntilTypGets)
|
||||||
|
|
||||||
// 外部系统推送一些操作日志过来,RDB统一存储,实际用MQ会更好一些
|
// 外部系统推送一些操作日志过来,RDB统一存储,实际用MQ会更好一些
|
||||||
v1.POST("/resoplogs", v1OperationLogResPost)
|
v1.POST("/resoplogs", v1OperationLogResPost)
|
||||||
|
|
|
@ -160,6 +160,35 @@ func v1TreeUntilProjectGets(c *gin.Context) {
|
||||||
renderData(c, oks, err)
|
renderData(c, oks, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func v1TreeUntilTypGets(c *gin.Context) {
|
||||||
|
username := queryStr(c, "username")
|
||||||
|
cate := queryStr(c, "cate")
|
||||||
|
onlyCate := queryInt(c, "onlyCate", 0)
|
||||||
|
pid := queryInt64(c, "pid", -1)
|
||||||
|
user, err := models.UserGet("username=?", username)
|
||||||
|
dangerous(err)
|
||||||
|
|
||||||
|
oks, err := models.TreeUntilTypGetByUser(user, cate)
|
||||||
|
dangerous(err)
|
||||||
|
|
||||||
|
var ret []models.Node
|
||||||
|
for _, node := range oks {
|
||||||
|
//指定了父节点,不是想要的父节点
|
||||||
|
if pid != -1 && node.Pid != pid {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
//指定了节点类型,不是想要的节点类型
|
||||||
|
if onlyCate != 0 && node.Cate != cate {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = append(ret, node)
|
||||||
|
}
|
||||||
|
|
||||||
|
renderData(c, ret, err)
|
||||||
|
}
|
||||||
|
|
||||||
// 这个方法,展示的树只到organization
|
// 这个方法,展示的树只到organization
|
||||||
func treeUntilOrganizationGets(c *gin.Context) {
|
func treeUntilOrganizationGets(c *gin.Context) {
|
||||||
me := loginUser(c)
|
me := loginUser(c)
|
||||||
|
|
Loading…
Reference in New Issue