Merge branch 'main' of github.com:ccfos/nightingale

This commit is contained in:
Ulric Qin 2022-07-29 17:35:49 +08:00
commit 8fe9e57c03
2 changed files with 9 additions and 0 deletions

View File

@ -12,6 +12,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/prometheus/common/model"
"github.com/prometheus/prometheus/prompb"
"github.com/toolkits/pkg/logger"
"github.com/didi/nightingale/v5/src/server/common"
"github.com/didi/nightingale/v5/src/server/config"
@ -156,6 +157,7 @@ func handleOpenTSDB(c *gin.Context) {
}
if err != nil {
logger.Debugf("opentsdb msg format error: %s", err.Error())
c.String(400, err.Error())
return
}
@ -170,12 +172,14 @@ func handleOpenTSDB(c *gin.Context) {
for i := 0; i < len(arr); i++ {
if err := arr[i].Clean(ts); err != nil {
logger.Debugf("opentsdb msg clean error: %s", err.Error())
fail++
continue
}
pt, err := arr[i].ToProm()
if err != nil {
logger.Debugf("opentsdb msg to tsdb error: %s", err.Error())
fail++
continue
}
@ -202,6 +206,10 @@ func handleOpenTSDB(c *gin.Context) {
idents.Idents.MSet(ids)
}
if fail > 0 {
logger.Debugf("opentsdb msg process error , msg is : %s", string(bs))
}
c.JSON(200, gin.H{
"succ": succ,
"fail": fail,

View File

@ -31,6 +31,7 @@ func loginPost(c *gin.Context) {
if config.C.LDAP.Enable {
user, err = models.LdapLogin(f.Username, f.Password)
if err != nil {
logger.Debugf("ldap login failed: %v username: %s", err, f.Username)
ginx.NewRender(c).Message(err)
return
}