@@ -11,7 +11,7 @@ import (
1111 "github.com/cloudflare/pint/internal/diags"
1212 "github.com/cloudflare/pint/internal/discovery"
1313 "github.com/cloudflare/pint/internal/parser"
14- "github.com/cloudflare/pint/internal/parser/utils "
14+ "github.com/cloudflare/pint/internal/parser/source "
1515)
1616
1717const (
@@ -57,12 +57,12 @@ func (c FragileCheck) Reporter() string {
5757
5858func (c FragileCheck ) Check (_ context.Context , entry * discovery.Entry , _ []* discovery.Entry ) (problems []Problem ) {
5959 expr := entry .Rule .Expr ()
60- if expr .SyntaxError != nil {
60+ if expr .SyntaxError () != nil {
6161 return nil
6262 }
6363
6464 if entry .Rule .AlertingRule != nil {
65- for _ , src := range utils . LabelsSource ( expr .Value . Value , expr . Query . Expr ) {
65+ for _ , src := range expr .Source ( ) {
6666 problems = append (problems , c .checkTopK (expr , src )... )
6767 problems = append (problems , c .checkPartialData (expr , src , entry .Rule .AlertingRule .For )... )
6868 }
@@ -71,11 +71,11 @@ func (c FragileCheck) Check(_ context.Context, entry *discovery.Entry, _ []*disc
7171 return problems
7272}
7373
74- func (c FragileCheck ) checkTopK (expr parser.PromQLExpr , src utils .Source ) (problems []Problem ) {
75- if src .Type != utils .AggregateSource {
74+ func (c FragileCheck ) checkTopK (expr * parser.PromQLExpr , src source .Source ) (problems []Problem ) {
75+ if src .Type != source .AggregateSource {
7676 return problems
7777 }
78- if src .FixedLabels && len (src .TransformedLabels (utils .PossibleLabel )) == 0 {
78+ if src .FixedLabels && len (src .TransformedLabels (source .PossibleLabel )) == 0 {
7979 return problems
8080 }
8181 if ! slices .Contains ([]string {"topk" , "bottomk" , "limit" , "limit_ratio" }, src .Operation ()) {
@@ -101,8 +101,8 @@ func (c FragileCheck) checkTopK(expr parser.PromQLExpr, src utils.Source) (probl
101101 return problems
102102}
103103
104- func (c FragileCheck ) checkPartialData (expr parser.PromQLExpr , src utils .Source , forVal * parser.YamlNode ) (problems []Problem ) {
105- if src .Type != utils .AggregateSource {
104+ func (c FragileCheck ) checkPartialData (expr * parser.PromQLExpr , src source .Source , forVal * parser.YamlNode ) (problems []Problem ) {
105+ if src .Type != source .AggregateSource {
106106 return problems
107107 }
108108 if ! src .IsConditional {
@@ -118,7 +118,7 @@ func (c FragileCheck) checkPartialData(expr parser.PromQLExpr, src utils.Source,
118118
119119 for _ , j := range src .Joins {
120120 // Only look for joins that are aggregations.
121- if j .Src .Type != utils .AggregateSource {
121+ if j .Src .Type != source .AggregateSource {
122122 continue
123123 }
124124 // Ignore joins that are not conditional and instead are used to add labels.
0 commit comments