Fix linting and failing tests
CI / Go tests (push) Has been cancelled Details
CI / More Go tests (push) Has been cancelled Details
CI / Go tests with previous Go version (push) Has been cancelled Details
CI / UI tests (push) Has been cancelled Details
CI / Go tests on Windows (push) Has been cancelled Details
CI / Mixins tests (push) Has been cancelled Details
CI / Build Prometheus for common architectures (0) (push) Has been cancelled Details
CI / Build Prometheus for common architectures (1) (push) Has been cancelled Details
CI / Build Prometheus for common architectures (2) (push) Has been cancelled Details
CI / Build Prometheus for all architectures (0) (push) Has been cancelled Details
CI / Build Prometheus for all architectures (1) (push) Has been cancelled Details
CI / Build Prometheus for all architectures (10) (push) Has been cancelled Details
CI / Build Prometheus for all architectures (11) (push) Has been cancelled Details
CI / Build Prometheus for all architectures (2) (push) Has been cancelled Details
CI / Build Prometheus for all architectures (3) (push) Has been cancelled Details
CI / Build Prometheus for all architectures (4) (push) Has been cancelled Details
CI / Build Prometheus for all architectures (5) (push) Has been cancelled Details
CI / Build Prometheus for all architectures (6) (push) Has been cancelled Details
CI / Build Prometheus for all architectures (7) (push) Has been cancelled Details
CI / Build Prometheus for all architectures (8) (push) Has been cancelled Details
CI / Build Prometheus for all architectures (9) (push) Has been cancelled Details
CI / Check generated parser (push) Has been cancelled Details
CI / golangci-lint (push) Has been cancelled Details
CI / fuzzing (push) Has been cancelled Details
CI / codeql (push) Has been cancelled Details
CI / Report status of build Prometheus for all architectures (push) Has been cancelled Details
CI / Publish main branch artifacts (push) Has been cancelled Details
CI / Publish release artefacts (push) Has been cancelled Details
CI / Publish UI on npm Registry (push) Has been cancelled Details

Signed-off-by: Carrie Edwards <edwrdscarrie@gmail.com>
This commit is contained in:
Carrie Edwards 2025-07-08 14:13:37 -07:00
parent 9f9e408405
commit c13c6bc1f5
2 changed files with 10 additions and 14 deletions

View File

@ -3659,7 +3659,7 @@ func TestTypeUnitMismatchAnnotations(t *testing.T) {
typeAndUnitLabelsEnabled: true,
expectedWarningAnnotations: []string{},
expectedInfoAnnotations: []string{
`PromQL info: mismatched type or unit metadata "series"`,
`PromQL info: mismatched type or unit metadata for metric "series"`,
},
},
"info annotation when mismatched unit": {
@ -3671,7 +3671,7 @@ func TestTypeUnitMismatchAnnotations(t *testing.T) {
typeAndUnitLabelsEnabled: true,
expectedWarningAnnotations: []string{},
expectedInfoAnnotations: []string{
`PromQL info: mismatched type or unit metadata "series"`,
`PromQL info: mismatched type or unit metadata for metric "series"`,
},
},
"info annotation when mismatched type and unit": {
@ -3683,7 +3683,7 @@ func TestTypeUnitMismatchAnnotations(t *testing.T) {
typeAndUnitLabelsEnabled: true,
expectedWarningAnnotations: []string{},
expectedInfoAnnotations: []string{
`PromQL info: mismatched type or unit metadata "series"`,
`PromQL info: mismatched type or unit metadata for metric "series"`,
},
},
"no info annotation when type is unknown": {

View File

@ -90,11 +90,8 @@ func (s *typeAndUnitMismatchSeriesSet) Next() bool {
typ: mType,
unit: mUnit,
}
} else {
if s.prev.typ != mType || s.prev.unit != mUnit {
// Skip annotation if either type is "unknown" - this allows unknown to coexist with known types
} else if s.prev.typ != mType || s.prev.unit != mUnit {
if s.prev.typ == "unknown" || mType == "unknown" {
// Update to the known type if we have one
if s.prev.typ == "unknown" && mType != "unknown" {
s.prev.typ = mType
s.prev.unit = mUnit
@ -103,7 +100,6 @@ func (s *typeAndUnitMismatchSeriesSet) Next() bool {
s.annotations.Add(fmt.Errorf("%w for metric %q", annotations.MismatchedTypeOrUnitInfo, metric))
}
}
}
return true
}