@@ -40,12 +40,12 @@ import (
40
40
"github.com/prometheus/prometheus/tsdb"
41
41
"github.com/prometheus/prometheus/tsdb/agent"
42
42
"github.com/prometheus/prometheus/tsdb/wlog"
43
+ "gopkg.in/yaml.v2"
43
44
44
45
"github.com/thanos-io/objstore"
45
46
"github.com/thanos-io/objstore/client"
46
47
objstoretracing "github.com/thanos-io/objstore/tracing/opentracing"
47
48
"github.com/thanos-io/promql-engine/execution/parse"
48
- "gopkg.in/yaml.v2"
49
49
50
50
"github.com/thanos-io/thanos/pkg/alert"
51
51
v1 "github.com/thanos-io/thanos/pkg/api/rule"
@@ -54,6 +54,7 @@ import (
54
54
"github.com/thanos-io/thanos/pkg/component"
55
55
"github.com/thanos-io/thanos/pkg/discovery/dns"
56
56
"github.com/thanos-io/thanos/pkg/errutil"
57
+ "github.com/thanos-io/thanos/pkg/extannotations"
57
58
"github.com/thanos-io/thanos/pkg/extgrpc"
58
59
"github.com/thanos-io/thanos/pkg/extkingpin"
59
60
"github.com/thanos-io/thanos/pkg/extprom"
@@ -292,7 +293,7 @@ func newRuleMetrics(reg *prometheus.Registry) *RuleMetrics {
292
293
m .ruleEvalWarnings = factory .NewCounterVec (
293
294
prometheus.CounterOpts {
294
295
Name : "thanos_rule_evaluation_with_warnings_total" ,
295
- Help : "The total number of rule evaluation that were successful but had warnings which can indicate partial error." ,
296
+ Help : "The total number of rule evaluation that were successful but had non PromQL warnings which can indicate partial error." ,
296
297
}, []string {"strategy" },
297
298
)
298
299
m .ruleEvalWarnings .WithLabelValues (strings .ToLower (storepb .PartialResponseStrategy_ABORT .String ()))
@@ -940,6 +941,8 @@ func queryFuncCreator(
940
941
level .Error (logger ).Log ("err" , err , "query" , qs )
941
942
continue
942
943
}
944
+
945
+ warns = filterOutPromQLWarnings (warns , logger , qs )
943
946
if len (warns ) > 0 {
944
947
ruleEvalWarnings .WithLabelValues (strings .ToLower (partialResponseStrategy .String ())).Inc ()
945
948
// TODO(bwplotka): Propagate those to UI, probably requires changing rule manager code ):
@@ -971,12 +974,13 @@ func queryFuncCreator(
971
974
continue
972
975
}
973
976
974
- if len (result .Warnings ) > 0 {
977
+ warnings := make ([]string , 0 , len (result .Warnings ))
978
+ for _ , warn := range result .Warnings {
979
+ warnings = append (warnings , warn .Error ())
980
+ }
981
+ warnings = filterOutPromQLWarnings (warnings , logger , qs )
982
+ if len (warnings ) > 0 {
975
983
ruleEvalWarnings .WithLabelValues (strings .ToLower (partialResponseStrategy .String ())).Inc ()
976
- warnings := make ([]string , 0 , len (result .Warnings ))
977
- for _ , w := range result .Warnings {
978
- warnings = append (warnings , w .Error ())
979
- }
980
984
level .Warn (logger ).Log ("warnings" , strings .Join (warnings , ", " ), "query" , qs )
981
985
}
982
986
@@ -1082,3 +1086,16 @@ func validateTemplate(tmplStr string) error {
1082
1086
}
1083
1087
return nil
1084
1088
}
1089
+
1090
+ // Filter out PromQL related warnings from warning response and keep store related warnings only.
1091
+ func filterOutPromQLWarnings (warns []string , logger log.Logger , query string ) []string {
1092
+ storeWarnings := make ([]string , 0 , len (warns ))
1093
+ for _ , warn := range warns {
1094
+ if extannotations .IsPromQLAnnotation (warn ) {
1095
+ level .Warn (logger ).Log ("warning" , warn , "query" , query )
1096
+ continue
1097
+ }
1098
+ storeWarnings = append (storeWarnings , warn )
1099
+ }
1100
+ return storeWarnings
1101
+ }
0 commit comments