Skip to content

Commit

Permalink
Merge pull request #780 from pyrra-dev/dependabot/go_modules/github.c…
Browse files Browse the repository at this point in the history
…om/prometheus-operator/prometheus-operator/pkg/apis/monitoring-0.66.0

build(deps): bump github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring from 0.64.0 to 0.66.0
  • Loading branch information
metalmatze authored Jul 25, 2023
2 parents 9165f1c + b2db308 commit 03e2946
Show file tree
Hide file tree
Showing 5 changed files with 183 additions and 173 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/go-kit/log v0.2.1
github.com/oklog/run v1.1.0
github.com/polarsignals/connect-go-prometheus v0.0.0-20221202180953-626537f1f6bc
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.64.0
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.66.0
github.com/prometheus/client_golang v1.16.0
github.com/prometheus/common v0.44.0
github.com/prometheus/prometheus v0.45.0
Expand Down Expand Up @@ -83,7 +83,7 @@ require (
k8s.io/component-base v0.27.2 // indirect
k8s.io/klog/v2 v2.100.1 // indirect
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect
k8s.io/utils v0.0.0-20230308161112-d77c459e9343 // indirect
k8s.io/utils v0.0.0-20230505201702-9f6742963106 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
)
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/polarsignals/connect-go-prometheus v0.0.0-20221202180953-626537f1f6bc h1:ypHSwa6DZ9nWeBPSW153Z28RbOef/PKTeNDiagHN4To=
github.com/polarsignals/connect-go-prometheus v0.0.0-20221202180953-626537f1f6bc/go.mod h1:sSI7kLoXZJRaxAofkQvoPRh9d2FU/GCFgIMj7HlptFo=
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.64.0 h1:bqFOzWYCuSZEcuFx/ez8DFW+fqGiUEATrgezynCjpP4=
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.64.0/go.mod h1:cfNgxpCPGyIydmt3HcwDqKDt0nYdlGRhzftl+DZH7WA=
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.66.0 h1:PPW01FLVjJHMNcbAL1DDD9EZceSQKMOU/VpK0irrxrI=
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.66.0/go.mod h1:KZHvrby65G+rA4V/vMTUXDV22TI+GgLIrCigYClpjzk=
github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8=
github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
Expand Down Expand Up @@ -366,8 +366,8 @@ k8s.io/klog/v2 v2.100.1 h1:7WCHKK6K8fNhTqfBhISHQ97KrnJNFZMcQvKp7gP/tmg=
k8s.io/klog/v2 v2.100.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f h1:2kWPakN3i/k81b0gvD5C5FJ2kxm1WrQFanWchyKuqGg=
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f/go.mod h1:byini6yhqGC14c3ebc/QwanvYwhuMWF6yz2F8uwW8eg=
k8s.io/utils v0.0.0-20230308161112-d77c459e9343 h1:m7tbIjXGcGIAtpmQr7/NAi7RsWoW3E7Zcm4jI1HicTc=
k8s.io/utils v0.0.0-20230308161112-d77c459e9343/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
k8s.io/utils v0.0.0-20230505201702-9f6742963106 h1:EObNQ3TW2D+WptiYXlApGNLVy0zm/JIBVY9i+M4wpAU=
k8s.io/utils v0.0.0-20230505201702-9f6742963106/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
sigs.k8s.io/controller-runtime v0.15.0 h1:ML+5Adt3qZnMSYxZ7gAverBLNPSMQEibtzAgp0UPojU=
sigs.k8s.io/controller-runtime v0.15.0/go.mod h1:7ngYvp1MLT+9GeZ+6lH3LOlcHkp/+tzA/fmHa4iq9kk=
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
Expand Down
27 changes: 16 additions & 11 deletions kubernetes/controllers/servicelevelobjective_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func Test_makePrometheusRule(t *testing.T) {
Groups: []monitoringv1.RuleGroup{
{
Name: "http-increase",
Interval: "2m30s",
Interval: monitoringDuration("2m30s"),
Rules: []monitoringv1.Rule{
{
Record: "http_requests:increase4w",
Expand All @@ -99,7 +99,7 @@ func Test_makePrometheusRule(t *testing.T) {
{
Alert: "SLOMetricAbsent",
Expr: intstr.FromString(`absent(http_requests_total{job="app"}) == 1`),
For: "2m",
For: monitoringDuration("2m"),
Annotations: map[string]string{
"description": "foo",
},
Expand All @@ -114,7 +114,7 @@ func Test_makePrometheusRule(t *testing.T) {
},
{
Name: "http",
Interval: "30s",
Interval: monitoringDuration("30s"),
Rules: []monitoringv1.Rule{
{
Record: "http_requests:burnrate5m",
Expand Down Expand Up @@ -154,28 +154,28 @@ func Test_makePrometheusRule(t *testing.T) {
{
Alert: "ErrorBudgetBurn",
Expr: intstr.FromString(`http_requests:burnrate5m{job="app",slo="http"} > (14 * (1-0.995)) and http_requests:burnrate1h{job="app",slo="http"} > (14 * (1-0.995))`),
For: "2m",
For: monitoringDuration("2m0s"),
Labels: map[string]string{"severity": "critical", "job": "app", "long": "1h", "slo": "http", "short": "5m", "team": "foo", "exhaustion": "2d"},
Annotations: map[string]string{"description": "foo"},
},
{
Alert: "ErrorBudgetBurn",
Expr: intstr.FromString(`http_requests:burnrate30m{job="app",slo="http"} > (7 * (1-0.995)) and http_requests:burnrate6h{job="app",slo="http"} > (7 * (1-0.995))`),
For: "15m",
For: monitoringDuration("15m0s"),
Labels: map[string]string{"severity": "critical", "job": "app", "long": "6h", "slo": "http", "short": "30m", "team": "foo", "exhaustion": "4d"},
Annotations: map[string]string{"description": "foo"},
},
{
Alert: "ErrorBudgetBurn",
Expr: intstr.FromString(`http_requests:burnrate2h{job="app",slo="http"} > (2 * (1-0.995)) and http_requests:burnrate1d{job="app",slo="http"} > (2 * (1-0.995))`),
For: "1h",
For: monitoringDuration("1h0m0s"),
Labels: map[string]string{"severity": "warning", "job": "app", "long": "1d", "slo": "http", "short": "2h", "team": "foo", "exhaustion": "2w"},
Annotations: map[string]string{"description": "foo"},
},
{
Alert: "ErrorBudgetBurn",
Expr: intstr.FromString(`http_requests:burnrate6h{job="app",slo="http"} > (1 * (1-0.995)) and http_requests:burnrate4d{job="app",slo="http"} > (1 * (1-0.995))`),
For: "3h",
For: monitoringDuration("3h0m0s"),
Labels: map[string]string{"severity": "warning", "job": "app", "long": "4d", "slo": "http", "short": "6h", "team": "foo", "exhaustion": "4w"},
Annotations: map[string]string{"description": "foo"},
},
Expand Down Expand Up @@ -266,7 +266,7 @@ func Test_makeConfigMap(t *testing.T) {
description: foo
expr: http_requests:burnrate5m{job="app",slo="http"} > (14 * (1-0.995)) and http_requests:burnrate1h{job="app",slo="http"}
> (14 * (1-0.995))
for: 2m
for: 2m0s
labels:
exhaustion: 2d
job: app
Expand All @@ -280,7 +280,7 @@ func Test_makeConfigMap(t *testing.T) {
description: foo
expr: http_requests:burnrate30m{job="app",slo="http"} > (7 * (1-0.995)) and http_requests:burnrate6h{job="app",slo="http"}
> (7 * (1-0.995))
for: 15m
for: 15m0s
labels:
exhaustion: 4d
job: app
Expand All @@ -294,7 +294,7 @@ func Test_makeConfigMap(t *testing.T) {
description: foo
expr: http_requests:burnrate2h{job="app",slo="http"} > (2 * (1-0.995)) and http_requests:burnrate1d{job="app",slo="http"}
> (2 * (1-0.995))
for: 1h
for: 1h0m0s
labels:
exhaustion: 2w
job: app
Expand All @@ -308,7 +308,7 @@ func Test_makeConfigMap(t *testing.T) {
description: foo
expr: http_requests:burnrate6h{job="app",slo="http"} > (1 * (1-0.995)) and http_requests:burnrate4d{job="app",slo="http"}
> (1 * (1-0.995))
for: 3h
for: 3h0m0s
labels:
exhaustion: 4w
job: app
Expand Down Expand Up @@ -378,3 +378,8 @@ func Test_makeConfigMap(t *testing.T) {
})
}
}

func monitoringDuration(d string) *monitoringv1.Duration {
md := monitoringv1.Duration(d)
return &md
}
37 changes: 21 additions & 16 deletions slo/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (o Objective) Burnrates() (monitoringv1.RuleGroup, error) {
if o.Alerting.Disabled {
return monitoringv1.RuleGroup{
Name: sloName,
Interval: "30s", // TODO: Increase or decrease based on availability target
Interval: monitoringDuration("30s"), // TODO: Increase or decrease based on availability target
Rules: rules,
}, nil
}
Expand Down Expand Up @@ -140,7 +140,7 @@ func (o Objective) Burnrates() (monitoringv1.RuleGroup, error) {
w.Factor,
strconv.FormatFloat(o.Target, 'f', -1, 64),
)),
For: monitoringv1.Duration(model.Duration(w.For).String()),
For: monitoringDuration(w.For.String()),
Labels: alertLabels,
Annotations: alertAnnotations,
}
Expand Down Expand Up @@ -176,7 +176,7 @@ func (o Objective) Burnrates() (monitoringv1.RuleGroup, error) {
if o.Alerting.Disabled {
return monitoringv1.RuleGroup{
Name: sloName,
Interval: "30s", // TODO: Increase or decrease based on availability target
Interval: monitoringDuration("30s"), // TODO: Increase or decrease based on availability target
Rules: rules,
}, nil
}
Expand Down Expand Up @@ -228,7 +228,7 @@ func (o Objective) Burnrates() (monitoringv1.RuleGroup, error) {
w.Factor,
strconv.FormatFloat(o.Target, 'f', -1, 64),
)),
For: monitoringv1.Duration(model.Duration(w.For).String()),
For: monitoringDuration(model.Duration(w.For).String()),
Labels: alertLabels,
Annotations: alertAnnotations,
}
Expand Down Expand Up @@ -264,7 +264,7 @@ func (o Objective) Burnrates() (monitoringv1.RuleGroup, error) {
if o.Alerting.Disabled {
return monitoringv1.RuleGroup{
Name: sloName,
Interval: "30s", // TODO: Increase or decrease based on availability target
Interval: monitoringDuration("30s"), // TODO: Increase or decrease based on availability target
Rules: rules,
}, nil
}
Expand Down Expand Up @@ -316,7 +316,7 @@ func (o Objective) Burnrates() (monitoringv1.RuleGroup, error) {
w.Factor,
strconv.FormatFloat(o.Target, 'f', -1, 64),
)),
For: monitoringv1.Duration(model.Duration(w.For).String()),
For: monitoringDuration(model.Duration(w.For).String()),
Labels: alertLabels,
Annotations: alertAnnotations,
}
Expand Down Expand Up @@ -352,7 +352,7 @@ func (o Objective) Burnrates() (monitoringv1.RuleGroup, error) {
if o.Alerting.Disabled {
return monitoringv1.RuleGroup{
Name: sloName,
Interval: "30s", // TODO: Increase or decrease based on availability target
Interval: monitoringDuration("30s"), // TODO: Increase or decrease based on availability target
Rules: rules,
}, nil
}
Expand Down Expand Up @@ -404,7 +404,7 @@ func (o Objective) Burnrates() (monitoringv1.RuleGroup, error) {
w.Factor,
strconv.FormatFloat(o.Target, 'f', -1, 64),
)),
For: monitoringv1.Duration(model.Duration(w.For).String()),
For: monitoringDuration(model.Duration(w.For).String()),
Labels: alertLabels,
Annotations: alertAnnotations,
}
Expand All @@ -415,7 +415,7 @@ func (o Objective) Burnrates() (monitoringv1.RuleGroup, error) {
// We only get here if alerting was not disabled
return monitoringv1.RuleGroup{
Name: sloName,
Interval: "30s", // TODO: Increase or decrease based on availability target
Interval: monitoringDuration("30s"), // TODO: Increase or decrease based on availability target
Rules: rules,
}, nil
}
Expand Down Expand Up @@ -712,7 +712,7 @@ func (o Objective) IncreaseRules() (monitoringv1.RuleGroup, error) {
rules = append(rules, monitoringv1.Rule{
Alert: "SLOMetricAbsent",
Expr: intstr.FromString(expr.String()),
For: monitoringv1.Duration(model.Duration(
For: monitoringDuration(model.Duration(
(time.Duration(o.Window) / (28 * 24 * (60 / 2))).Round(time.Minute),
).String()),
Labels: alertLabels,
Expand Down Expand Up @@ -751,7 +751,7 @@ func (o Objective) IncreaseRules() (monitoringv1.RuleGroup, error) {
rules = append(rules, monitoringv1.Rule{
Alert: "SLOMetricAbsent",
Expr: intstr.FromString(expr.String()),
For: monitoringv1.Duration(model.Duration(
For: monitoringDuration(model.Duration(
(time.Duration(o.Window) / (28 * 24 * (60 / 2))).Round(time.Minute),
).String()),
Labels: alertLabels,
Expand Down Expand Up @@ -860,7 +860,7 @@ func (o Objective) IncreaseRules() (monitoringv1.RuleGroup, error) {
rules = append(rules, monitoringv1.Rule{
Alert: "SLOMetricAbsent",
Expr: intstr.FromString(expr.String()),
For: monitoringv1.Duration(model.Duration(
For: monitoringDuration(model.Duration(
(time.Duration(o.Window) / (28 * 24 * (60 / 2))).Round(time.Minute),
).String()),
Labels: alertLabels,
Expand All @@ -887,7 +887,7 @@ func (o Objective) IncreaseRules() (monitoringv1.RuleGroup, error) {
rules = append(rules, monitoringv1.Rule{
Alert: "SLOMetricAbsent",
Expr: intstr.FromString(expr.String()),
For: monitoringv1.Duration(model.Duration(
For: monitoringDuration(model.Duration(
(time.Duration(o.Window) / (28 * 24 * (60 / 2))).Round(time.Minute),
).String()),
Labels: alertLabelsLe,
Expand Down Expand Up @@ -1040,7 +1040,7 @@ func (o Objective) IncreaseRules() (monitoringv1.RuleGroup, error) {
rules = append(rules, monitoringv1.Rule{
Alert: "SLOMetricAbsent",
Expr: intstr.FromString(expr.String()),
For: monitoringv1.Duration(model.Duration(
For: monitoringDuration(model.Duration(
(time.Duration(o.Window) / (28 * 24 * (60 / 2))).Round(time.Minute),
).String()),
Labels: alertLabels,
Expand Down Expand Up @@ -1074,7 +1074,7 @@ func (o Objective) IncreaseRules() (monitoringv1.RuleGroup, error) {

return monitoringv1.RuleGroup{
Name: sloName + "-increase",
Interval: monitoringv1.Duration(interval.String()),
Interval: monitoringDuration(interval.String()),
Rules: rules,
}, nil
}
Expand Down Expand Up @@ -1400,7 +1400,12 @@ func (o Objective) GenericRules() (monitoringv1.RuleGroup, error) {

return monitoringv1.RuleGroup{
Name: sloName + "-generic",
Interval: "30s",
Interval: monitoringDuration("30s"),
Rules: rules,
}, nil
}

func monitoringDuration(d string) *monitoringv1.Duration {
md := monitoringv1.Duration(d)
return &md
}
Loading

0 comments on commit 03e2946

Please sign in to comment.