Skip to content

Commit

Permalink
server: Correct server input parsing metric
Browse files Browse the repository at this point in the history
The metric was using `metrics.RegoQueryParse` but it isn't actually
doing the query parse there. It is parsing the input document.

Signed-off-by: Patrick East <[email protected]>
  • Loading branch information
patrick-east committed Dec 18, 2019
1 parent feaf745 commit 051c3b8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@ func (s *Server) v1DataGet(w http.ResponseWriter, r *http.Request) {
includeInstrumentation := getBoolParam(r.URL, types.ParamInstrumentV1, true)
provenance := getBoolParam(r.URL, types.ParamProvenanceV1, true)

m.Timer(metrics.RegoQueryParse).Start()
m.Timer(metrics.RegoInputParse).Start()

inputs := r.URL.Query()[types.ParamInputV1]

Expand All @@ -1048,8 +1048,6 @@ func (s *Server) v1DataGet(w http.ResponseWriter, r *http.Request) {
}
}

m.Timer(metrics.RegoQueryParse).Stop()

var goInput *interface{}
if input != nil {
x, err := ast.JSON(input)
Expand All @@ -1060,6 +1058,8 @@ func (s *Server) v1DataGet(w http.ResponseWriter, r *http.Request) {
goInput = &x
}

m.Timer(metrics.RegoInputParse).Stop()

// Prepare for query.
txn, err := s.store.NewTransaction(ctx)
if err != nil {
Expand Down Expand Up @@ -1231,7 +1231,7 @@ func (s *Server) v1DataPost(w http.ResponseWriter, r *http.Request) {
partial := getBoolParam(r.URL, types.ParamPartialV1, true)
provenance := getBoolParam(r.URL, types.ParamProvenanceV1, true)

m.Timer(metrics.RegoQueryParse).Start()
m.Timer(metrics.RegoInputParse).Start()

input, err := readInputPostV1(r)
if err != nil {
Expand All @@ -1249,7 +1249,7 @@ func (s *Server) v1DataPost(w http.ResponseWriter, r *http.Request) {
goInput = &x
}

m.Timer(metrics.RegoQueryParse).Stop()
m.Timer(metrics.RegoInputParse).Stop()

txn, err := s.store.NewTransaction(ctx)
if err != nil {
Expand Down

0 comments on commit 051c3b8

Please sign in to comment.