From 60dd48c9eb657044773ba4c0e47a766384c118e6 Mon Sep 17 00:00:00 2001 From: BigFish <736759290@qq.com> Date: Thu, 17 Dec 2020 05:36:20 +0800 Subject: [PATCH] lib/protoparser/prometheus/parser.go (#970) fix parse timestamp error if there are some whitespaces after timestamp --- lib/protoparser/prometheus/parser.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/protoparser/prometheus/parser.go b/lib/protoparser/prometheus/parser.go index 9938ba2292..a56491ddbc 100644 --- a/lib/protoparser/prometheus/parser.go +++ b/lib/protoparser/prometheus/parser.go @@ -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)