mirror of
https://github.com/zhengkai/orca.git
synced 2026-02-04 15:02:26 +08:00
fix es hash
This commit is contained in:
@@ -2,6 +2,7 @@ package core
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"project/es"
|
||||
"project/metrics"
|
||||
@@ -13,7 +14,7 @@ import (
|
||||
"github.com/zhengkai/zu"
|
||||
)
|
||||
|
||||
func doMetrics(ab []byte, cached bool, r *http.Request, reqBytes int) {
|
||||
func doMetrics(ab []byte, cached bool, r *http.Request, req *pb.Req) {
|
||||
|
||||
rspBytes := len(ab)
|
||||
metrics.RspBytes(rspBytes)
|
||||
@@ -60,9 +61,10 @@ func doMetrics(ab []byte, cached bool, r *http.Request, reqBytes int) {
|
||||
Ip: sip,
|
||||
Model: o.Model,
|
||||
Key: key,
|
||||
ReqBytes: uint32(reqBytes),
|
||||
ReqBytes: uint32(len(req.Body)),
|
||||
RspBytes: uint32(rspBytes),
|
||||
Ts: zu.MS(),
|
||||
Hash: fmt.Sprintf(`%x`, req.Hash()),
|
||||
}
|
||||
go es.Insert(d)
|
||||
}
|
||||
|
||||
@@ -36,5 +36,5 @@ func (c *Core) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Add(`Content-Type`, `application/json`)
|
||||
w.Write(ab)
|
||||
|
||||
go doMetrics(ab, cached, r, len(p.Body))
|
||||
go doMetrics(ab, cached, r, p)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user