update prometheus dependencies (#5520)
Signed-off-by: junot <junotxiang@kubesphere.io>
This commit is contained in:
@@ -855,7 +855,7 @@ func parseToPrometheusRule(rule *v2alpha1.PostableAlertingRule) *promresourcesv1
|
||||
return &promresourcesv1.Rule{
|
||||
Alert: rule.Name,
|
||||
Expr: intstr.FromString(rule.Query),
|
||||
For: rule.Duration,
|
||||
For: promresourcesv1.Duration(rule.Duration),
|
||||
Labels: rule.Labels,
|
||||
Annotations: rule.Annotations,
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
promlabels "github.com/prometheus/prometheus/pkg/labels"
|
||||
promlabels "github.com/prometheus/prometheus/model/labels"
|
||||
"github.com/prometheus/prometheus/promql/parser"
|
||||
promrules "github.com/prometheus/prometheus/rules"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
|
||||
@@ -23,7 +23,7 @@ import (
|
||||
"github.com/prometheus-community/prom-label-proxy/injectproxy"
|
||||
promresourcesv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
|
||||
prommodel "github.com/prometheus/common/model"
|
||||
promlabels "github.com/prometheus/prometheus/pkg/labels"
|
||||
promlabels "github.com/prometheus/prometheus/model/labels"
|
||||
"github.com/prometheus/prometheus/promql/parser"
|
||||
"github.com/prometheus/prometheus/rules"
|
||||
"k8s.io/klog/v2"
|
||||
@@ -64,7 +64,7 @@ func InjectExprNamespaceLabel(expr, namespace string) (string, error) {
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if err = injectproxy.NewEnforcer(&promlabels.Matcher{
|
||||
if err = injectproxy.NewEnforcer(false, &promlabels.Matcher{
|
||||
Type: promlabels.MatchEqual,
|
||||
Name: "namespace",
|
||||
Value: namespace,
|
||||
@@ -96,10 +96,10 @@ func GenResourceRuleIdIgnoreFormat(group string, rule *promresourcesv1.Rule) str
|
||||
klog.Warning(errors.Wrapf(err, "invalid alerting rule(%s)", rule.Alert))
|
||||
query = rule.Expr.String()
|
||||
}
|
||||
duration, err := FormatDuration(rule.For)
|
||||
duration, err := FormatDuration(string(rule.For))
|
||||
if err != nil {
|
||||
klog.Warning(errors.Wrapf(err, "invalid alerting rule(%s)", rule.Alert))
|
||||
duration = rule.For
|
||||
duration = string(rule.For)
|
||||
}
|
||||
|
||||
lbls := make(map[string]string)
|
||||
@@ -282,7 +282,7 @@ func getAlertingRuleStatus(resRule *ResourceRuleItem, epRule *alerting.AlertingR
|
||||
Id: resRule.Id,
|
||||
Name: resRule.Rule.Alert,
|
||||
Query: resRule.Rule.Expr.String(),
|
||||
Duration: resRule.Rule.For,
|
||||
Duration: string(resRule.Rule.For),
|
||||
Labels: resRule.Rule.Labels,
|
||||
Annotations: resRule.Rule.Annotations,
|
||||
},
|
||||
|
||||
@@ -18,7 +18,7 @@ package expressions
|
||||
|
||||
import (
|
||||
"github.com/prometheus-community/prom-label-proxy/injectproxy"
|
||||
"github.com/prometheus/prometheus/pkg/labels"
|
||||
"github.com/prometheus/prometheus/model/labels"
|
||||
"github.com/prometheus/prometheus/promql/parser"
|
||||
)
|
||||
|
||||
@@ -32,7 +32,7 @@ func labelReplace(input, ns string) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
err = injectproxy.NewEnforcer(&labels.Matcher{
|
||||
err = injectproxy.NewEnforcer(false, &labels.Matcher{
|
||||
Type: labels.MatchEqual,
|
||||
Name: "namespace",
|
||||
Value: ns,
|
||||
|
||||
Reference in New Issue
Block a user