feat: init NewOpenMetricsParser with skipCT true

Signed-off-by: Manik Rana <manikrana54@gmail.com>
This commit is contained in:
Manik Rana 2024-08-27 02:32:25 +05:30
parent c4052ba23d
commit 82064d42b8
2 changed files with 3 additions and 3 deletions

View file

@ -91,7 +91,7 @@ func New(b []byte, contentType string, parseClassicHistograms bool, st *labels.S
}
switch mediaType {
case "application/openmetrics-text":
return NewOpenMetricsParser(b, st), nil
return NewOpenMetricsParser(b, st, WithOMParserCTSeriesSkipped()), nil
case "application/vnd.google.protobuf":
return NewProtobufParser(b, parseClassicHistograms, st), nil
default:

View file

@ -699,7 +699,7 @@ func TestOpenMetricsParseErrors(t *testing.T) {
}
for i, c := range cases {
p := NewOpenMetricsParser([]byte(c.input), labels.NewSymbolTable())
p := NewOpenMetricsParser([]byte(c.input), labels.NewSymbolTable(), WithOMParserCTSeriesSkipped())
var err error
for err == nil {
_, err = p.Next()
@ -764,7 +764,7 @@ func TestOMNullByteHandling(t *testing.T) {
}
for i, c := range cases {
p := NewOpenMetricsParser([]byte(c.input), labels.NewSymbolTable())
p := NewOpenMetricsParser([]byte(c.input), labels.NewSymbolTable(), WithOMParserCTSeriesSkipped())
var err error
for err == nil {
_, err = p.Next()