优化
This commit is contained in:
parent
07d0102803
commit
0cce4ee276
@ -25,15 +25,6 @@ type ReportController struct {
|
|||||||
BaseController
|
BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
var parserPool *parser.Pool
|
|
||||||
|
|
||||||
func init(){
|
|
||||||
var err error
|
|
||||||
parserPool,err = parser.NewParserPool("fastjson")
|
|
||||||
if err!=nil{
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//上报接口
|
//上报接口
|
||||||
func (this ReportController) ReportAction(ctx *fasthttp.RequestCtx) {
|
func (this ReportController) ReportAction(ctx *fasthttp.RequestCtx) {
|
||||||
@ -101,9 +92,10 @@ func (this ReportController) ReportAction(ctx *fasthttp.RequestCtx) {
|
|||||||
|
|
||||||
if reportService.IsDebugUser(debug, xwlDistinctId, tableId) {
|
if reportService.IsDebugUser(debug, xwlDistinctId, tableId) {
|
||||||
kafkaData := duck.GetkafkaData()
|
kafkaData := duck.GetkafkaData()
|
||||||
pool := parserPool.Get()
|
|
||||||
defer parserPool.Put(pool)
|
pp := parser.FastjsonParser{}
|
||||||
metric, debugErr := pool.Parse(body)
|
|
||||||
|
metric, debugErr := pp.Parse(kafkaData.ReqData)
|
||||||
|
|
||||||
if debugErr != nil {
|
if debugErr != nil {
|
||||||
logs.Logger.Error("parser.ParseKafkaData ", zap.Error(err))
|
logs.Logger.Error("parser.ParseKafkaData ", zap.Error(err))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user