chore: use textparse interface to set om options

Signed-off-by: Manik Rana <manikrana54@gmail.com>
This commit is contained in:
Manik Rana 2024-08-27 21:06:40 +05:30
parent 3de6bffae7
commit 0caaa96206

View file

@ -61,17 +61,13 @@ const (
var symbolTable = labels.NewSymbolTable() var symbolTable = labels.NewSymbolTable()
func fuzzParseMetricWithContentType(in []byte, contentType string) int { func fuzzParseMetricWithContentType(in []byte, contentType string) int {
p, warning := textparse.New(in, contentType, false, symbolTable) p, warning := textparse.New(in, contentType, false, false, symbolTable)
if warning != nil { if warning != nil {
// An invalid content type is being passed, which should not happen // An invalid content type is being passed, which should not happen
// in this context. // in this context.
panic(warning) panic(warning)
} }
if contentType == "application/openmetrics-text" {
p = textparse.NewOpenMetricsParser(in, symbolTable)
}
var err error var err error
for { for {
_, err = p.Next() _, err = p.Next()