add QueryDataV2

This commit is contained in:
UlricQin 2020-08-25 15:29:23 +08:00
parent a72fa5b8dd
commit 2a79303241
2 changed files with 7 additions and 7 deletions

View File

@ -11,11 +11,11 @@ import (
"github.com/didi/nightingale/src/toolkits/stats"
)
type QueryDataReq struct {
queryData []dataobj.QueryData
func QueryData(c *gin.Context) {
// TODO 这里要改成老版本的实现
}
func QueryData(c *gin.Context) {
func QueryDataV2(c *gin.Context) {
stats.Counter.Set("data.api.qp10s", 1)
dataSource, err := backend.GetDataSourceFor("")
@ -25,9 +25,9 @@ func QueryData(c *gin.Context) {
return
}
var queryDataReq QueryDataReq
errors.Dangerous(c.ShouldBindJSON(&queryDataReq))
resp := dataSource.QueryData(queryDataReq.queryData)
var input []dataobj.QueryData
errors.Dangerous(c.ShouldBindJSON(&input))
resp := dataSource.QueryData(input)
render.Data(c, resp, nil)
}

View File

@ -32,7 +32,7 @@ func Config(r *gin.Engine) {
v2 := r.Group("/api/transfer/v2")
{
v2.POST("/data", QueryData)
v2.POST("/data", QueryDataV2)
}
pprof.Register(r, "/api/transfer/debug/pprof")