From 2012e294d10f81d7f408de123aceba24776e9823 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Fri, 10 Jul 2020 11:11:17 +0300 Subject: [PATCH] properly calculate readCalls --- lib/protoparser/csvimport/streamparser.go | 2 +- lib/protoparser/influx/streamparser.go | 2 +- lib/protoparser/vmimport/streamparser.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/protoparser/csvimport/streamparser.go b/lib/protoparser/csvimport/streamparser.go index dda5daef1..4222a968b 100644 --- a/lib/protoparser/csvimport/streamparser.go +++ b/lib/protoparser/csvimport/streamparser.go @@ -25,7 +25,6 @@ var ( // // callback shouldn't hold rows after returning. func ParseStream(req *http.Request, callback func(rows []Row) error) error { - readCalls.Inc() q := req.URL.Query() format := q.Get("format") cds, err := ParseColumnDescriptors(format) @@ -53,6 +52,7 @@ func ParseStream(req *http.Request, callback func(rows []Row) error) error { } func (ctx *streamContext) Read(r io.Reader, cds []ColumnDescriptor) bool { + readCalls.Inc() if ctx.err != nil { return false } diff --git a/lib/protoparser/influx/streamparser.go b/lib/protoparser/influx/streamparser.go index ddbe155da..a7b0a54ff 100644 --- a/lib/protoparser/influx/streamparser.go +++ b/lib/protoparser/influx/streamparser.go @@ -24,7 +24,6 @@ var ( // // callback shouldn't hold rows after returning. func ParseStream(r io.Reader, isGzipped bool, precision, db string, callback func(db string, rows []Row) error) error { - readCalls.Inc() if isGzipped { zr, err := common.GetGzipReader(r) if err != nil { @@ -62,6 +61,7 @@ func ParseStream(r io.Reader, isGzipped bool, precision, db string, callback fun } func (ctx *streamContext) Read(r io.Reader, tsMultiplier int64) bool { + readCalls.Inc() if ctx.err != nil { return false } diff --git a/lib/protoparser/vmimport/streamparser.go b/lib/protoparser/vmimport/streamparser.go index 97400a312..eb8c450fb 100644 --- a/lib/protoparser/vmimport/streamparser.go +++ b/lib/protoparser/vmimport/streamparser.go @@ -21,7 +21,6 @@ var maxLineLen = flag.Int("import.maxLineLen", 100*1024*1024, "The maximum lengt // // callback shouldn't hold rows after returning. func ParseStream(req *http.Request, callback func(rows []Row) error) error { - readCalls.Inc() r := req.Body if req.Header.Get("Content-Encoding") == "gzip" { zr, err := common.GetGzipReader(r) @@ -43,6 +42,7 @@ func ParseStream(req *http.Request, callback func(rows []Row) error) error { } func (ctx *streamContext) Read(r io.Reader) bool { + readCalls.Inc() if ctx.err != nil { return false }