You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
422 B
25 lines
422 B
4 years ago
|
package http
|
||
|
|
||
|
import (
|
||
|
"github.com/gin-gonic/gin"
|
||
|
"github.com/prometheus/prometheus/promql/parser"
|
||
|
|
||
|
"github.com/didi/nightingale/v5/vos"
|
||
|
)
|
||
|
|
||
|
func checkPromeQl(c *gin.Context) {
|
||
|
|
||
|
ql := c.Query("promql")
|
||
|
_, err := parser.ParseExpr(ql)
|
||
|
respD := &vos.PromQlCheckResp{}
|
||
|
isCorrect := true
|
||
|
if err != nil {
|
||
|
|
||
|
isCorrect = false
|
||
|
respD.ParseError = err.Error()
|
||
|
}
|
||
|
|
||
|
respD.QlCorrect = isCorrect
|
||
|
renderData(c, respD, nil)
|
||
|
}
|