mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-01-30 15:22:07 +00:00
add vm_protoparser_rows_read_total metrics to promscrape (#624)
* add vm_protoparser_rows_read_total metrics to promscrape move vm_protoparser_rows_read_total for promscrape to better place move vm_protoparser_rows_read_total for promscrape to better place * remove possibility of infinity loop at prometheus parser
This commit is contained in:
parent
207e93b50d
commit
a5e713b6e0
1 changed files with 8 additions and 3 deletions
|
@ -147,16 +147,21 @@ func (r *Row) unmarshal(s string, tagsPool []Tag, noEscapes bool) ([]Tag, error)
|
|||
return tagsPool, nil
|
||||
}
|
||||
|
||||
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) {
|
||||
for len(s) > 0 {
|
||||
n := strings.IndexByte(s, '\n')
|
||||
if n < 0 {
|
||||
// The last line.
|
||||
return unmarshalRow(dst, s, tagsPool, noEscapes, errLogger)
|
||||
dst, tagsPool = unmarshalRow(dst, s, tagsPool, noEscapes, errLogger)
|
||||
break
|
||||
} else {
|
||||
dst, tagsPool = unmarshalRow(dst, s[:n], tagsPool, noEscapes, errLogger)
|
||||
s = s[n+1:]
|
||||
}
|
||||
dst, tagsPool = unmarshalRow(dst, s[:n], tagsPool, noEscapes, errLogger)
|
||||
s = s[n+1:]
|
||||
}
|
||||
rowsReadScrape.Add(len(dst))
|
||||
return dst, tagsPool
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue