get rule node (#1042)
This commit is contained in:
parent
cbd416495c
commit
94847d9059
|
@ -92,6 +92,7 @@ func configRoute(r *gin.Engine, version string) {
|
|||
r.GET("/memory/target", targetGet)
|
||||
r.GET("/memory/user", userGet)
|
||||
r.GET("/memory/user-group", userGroupGet)
|
||||
r.GET("/memory/node/alert-rule", alertRuleNodeGet)
|
||||
|
||||
r.GET("/metrics", gin.WrapH(promhttp.Handler()))
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
|
||||
"github.com/didi/nightingale/v5/src/server/idents"
|
||||
"github.com/didi/nightingale/v5/src/server/memsto"
|
||||
"github.com/didi/nightingale/v5/src/server/naming"
|
||||
)
|
||||
|
||||
func alertRuleGet(c *gin.Context) {
|
||||
|
@ -43,3 +44,9 @@ func userGroupGet(c *gin.Context) {
|
|||
ug := memsto.UserGroupCache.GetByUserGroupId(id)
|
||||
c.JSON(200, gin.H{"id": id, "user_group": ug})
|
||||
}
|
||||
|
||||
func alertRuleNodeGet(c *gin.Context) {
|
||||
id := ginx.QueryStr(c, "id")
|
||||
node, _ := naming.HashRing.GetNode(id)
|
||||
c.JSON(200, gin.H{"id": id, "node": node})
|
||||
}
|
Loading…
Reference in New Issue