mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-15 08:23:34 +01:00
lib/protoparser: properly update vm_protoparser_rows_read_total{type="promscrape"}
metric
This commit is contained in:
parent
a5e713b6e0
commit
a4c96d9e6d
@ -150,18 +150,18 @@ func (r *Row) unmarshal(s string, tagsPool []Tag, noEscapes bool) ([]Tag, error)
|
|||||||
var rowsReadScrape = metrics.NewCounter(`vm_protoparser_rows_read_total{type="promscrape"}`)
|
var rowsReadScrape = metrics.NewCounter(`vm_protoparser_rows_read_total{type="promscrape"}`)
|
||||||
|
|
||||||
func unmarshalRows(dst []Row, s string, tagsPool []Tag, noEscapes bool, errLogger func(s string)) ([]Row, []Tag) {
|
func unmarshalRows(dst []Row, s string, tagsPool []Tag, noEscapes bool, errLogger func(s string)) ([]Row, []Tag) {
|
||||||
|
dstLen := len(dst)
|
||||||
for len(s) > 0 {
|
for len(s) > 0 {
|
||||||
n := strings.IndexByte(s, '\n')
|
n := strings.IndexByte(s, '\n')
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
// The last line.
|
// The last line.
|
||||||
dst, tagsPool = unmarshalRow(dst, s, tagsPool, noEscapes, errLogger)
|
dst, tagsPool = unmarshalRow(dst, s, tagsPool, noEscapes, errLogger)
|
||||||
break
|
break
|
||||||
} else {
|
}
|
||||||
dst, tagsPool = unmarshalRow(dst, s[:n], tagsPool, noEscapes, errLogger)
|
dst, tagsPool = unmarshalRow(dst, s[:n], tagsPool, noEscapes, errLogger)
|
||||||
s = s[n+1:]
|
s = s[n+1:]
|
||||||
}
|
}
|
||||||
}
|
rowsReadScrape.Add(len(dst) - dstLen)
|
||||||
rowsReadScrape.Add(len(dst))
|
|
||||||
return dst, tagsPool
|
return dst, tagsPool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user