lib/protoparser/prometheus/parser.go (#970)

fix parse timestamp error if there are some whitespaces after timestamp
This commit is contained in:
BigFish 2020-12-17 05:36:20 +08:00 committed by GitHub
parent 2a1550f341
commit 27f0261257
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -166,6 +166,8 @@ func (r *Row) unmarshal(s string, tagsPool []Tag, noEscapes bool) ([]Tag, error)
// There is no timestamp - just a whitespace after the value.
return tagsPool, nil
}
// There are some whitespaces after timestamp
s = skipTrailingWhitespace(s)
ts, err := fastfloat.Parse(s)
if err != nil {
return tagsPool, fmt.Errorf("cannot parse timestamp %q: %w", s, err)