fixed lint issues

This commit is contained in:
Andrii Chubatiuk 2024-10-16 13:19:45 +03:00
parent c3463ce0d2
commit f0dd01cf9e
3 changed files with 5 additions and 3 deletions

View file

@ -10,11 +10,11 @@ import (
)
func TestGetCommonLabelFilters(t *testing.T) {
f := func(metrics, contentType prometheus.ContentType, lfsExpected string) {
f := func(metrics string, contentType prometheus.ContentType, lfsExpected string) {
t.Helper()
var tss []*timeseries
var rows prometheus.Rows
rows.UnmarshalWithErrLogger(metrics, contentType.String(), func(errStr string) {
rows.UnmarshalWithErrLogger(metrics, contentType, func(errStr string) {
t.Fatalf("unexpected error when parsing %s: %s", metrics, errStr)
})
for _, row := range rows.Rows {

View file

@ -242,7 +242,7 @@ foo{vmrange="1...2"} 0 123`,
func promMetricsToTimeseries(s string) []*timeseries {
var rows prometheus.Rows
rows.UnmarshalWithErrLogger(s, "", func(errStr string) {
rows.UnmarshalWithErrLogger(s, prometheus.TextHeader, func(errStr string) {
panic(fmt.Errorf("cannot parse %q: %s", s, errStr))
})
var tss []*timeseries

View file

@ -15,6 +15,7 @@ import (
"github.com/valyala/fastjson/fastfloat"
)
// ParseContentType parses content type header value to enum, which identifies a format of ingested data
func ParseContentType(contentType string) ContentType {
if contentType != "" && strings.Contains(contentType, "application/vnd.google.protobuf") {
return ProtoHeader
@ -22,6 +23,7 @@ func ParseContentType(contentType string) ContentType {
return TextHeader
}
// ContentType enum, which defines a type of intested data
type ContentType int
func (ct ContentType) String() string {