diff --git a/.github/workflows/helmrelease.yaml b/.github/workflows/helmrelease.yaml index 6f14d301..6b4622fa 100644 --- a/.github/workflows/helmrelease.yaml +++ b/.github/workflows/helmrelease.yaml @@ -6,6 +6,7 @@ on: - main paths: - "deploy/kubernetes/helm/**" + workflow_dispatch: jobs: release: @@ -27,7 +28,7 @@ jobs: version: v3.7.1 - name: Run chart-releaser - uses: helm/chart-releaser-action@v1.4.1 + uses: helm/chart-releaser-action@v1.6.0 with: charts_dir: deploy/kubernetes/helm env: diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e24d724..62299484 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,32 @@ ## [Unreleased] +## [v0.13.1] - 2024-10-31 + +- Update Mockery from 2.14.0 to 2.46.3 +- Run `make go-gen` +- Run `make kube-gen` +- Run `make examples-gen` +- Bump Helm Chart version from 0.8.1 to 0.8.2 +- Bump image version from v0.13.0 to v0.13.1 + +## [v0.13.0] - 2024-10-31 + +- Fix buildvcs issues with test scripts +- Bump golang version from 1.19.3 to 1.23 +- Bump golangci-lint version from 1.50.0 to 1.61.0 +- Bump helm-chart-releaser action from v1.4.1 to v1.6.0 +- Ran `go mod tidy` +- Update test cases for new info labels +- Remove info labels from K8sMeta spec +- Custom labels for `sloth_slo_info{}` metric [#4](https://github.com/linode-obs/sloth/pull/4) +- Bump Helm Chart version +- disable buildvcs [#8](https://github.com/linode-obs/sloth/pull/8) + +## [v0.12.0] - 2023-07-03 + +- Custom rule_group intervals for all recording rule types or a global default. + ## [v0.11.0] - 2022-10-22 ### Changed @@ -162,7 +188,9 @@ - Support raw query based SLI. - Kubernetes (prometheus-operator) CRD generation support. -[unreleased]: https://github.com/slok/sloth/compare/v0.11.0...HEAD +[unreleased]: https://github.com/linode-obs/sloth/compare/v0.13.0...HEAD +[v0.13.0]: https://github.com/slok/sloth/compare/v0.12.0...v0.13.0 +[v0.12.0]: https://github.com/slok/sloth/compare/v0.11.0...v0.12.0 [v0.11.0]: https://github.com/slok/sloth/compare/v0.10.0...v0.11.0 [v0.10.0]: https://github.com/slok/sloth/compare/v0.9.0...v0.10.0 [v0.9.0]: https://github.com/slok/sloth/compare/v0.8.0...v0.9.0 diff --git a/README.md b/README.md index bbcafe10..189962ec 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,9 @@ slos: description: "Common SLO based on availability for HTTP request responses." labels: category: availability + # These labels only apply to the `sloth_slo_info{}` metric - they are `string: string` typed. + infoLabels: + foo: "bar" sli: events: error_query: sum(rate(http_request_duration_seconds_count{job="myservice",code=~"(5..|429)"}[{{.window}}])) diff --git a/cmd/sloth/commands/generate.go b/cmd/sloth/commands/generate.go index 2d5c24ae..50d28aa5 100644 --- a/cmd/sloth/commands/generate.go +++ b/cmd/sloth/commands/generate.go @@ -39,11 +39,12 @@ type generateCommand struct { sliPluginsPaths []string sloPeriodWindowsPath string sloPeriod string + infoLabels map[string]string } // NewGenerateCommand returns the generate command. func NewGenerateCommand(app *kingpin.Application) Command { - c := &generateCommand{extraLabels: map[string]string{}} + c := &generateCommand{extraLabels: map[string]string{}, infoLabels: map[string]string{}} cmd := app.Command("generate", "Generates Prometheus SLOs.") cmd.Flag("input", "SLO spec input file path or directory (if directory is used, slos will be discovered recursively and out must be a directory).").Short('i').StringVar(&c.slosInput) cmd.Flag("out", "Generated rules output file path or directory. If `-` it will use stdout (if input is a directory this must be a directory).").Default("-").Short('o').StringVar(&c.slosOut) diff --git a/cmd/sloth/commands/k8scontroller.go b/cmd/sloth/commands/k8scontroller.go index 5b0ffbff..b132b332 100644 --- a/cmd/sloth/commands/k8scontroller.go +++ b/cmd/sloth/commands/k8scontroller.go @@ -53,6 +53,7 @@ const ( type kubeControllerCommand struct { extraLabels map[string]string + infoLabels map[string]string workers int kubeConfig string kubeContext string @@ -73,7 +74,7 @@ type kubeControllerCommand struct { // NewKubeControllerCommand returns the Kubernetes controller command. func NewKubeControllerCommand(app *kingpin.Application) Command { - c := &kubeControllerCommand{extraLabels: map[string]string{}} + c := &kubeControllerCommand{extraLabels: map[string]string{}, infoLabels: map[string]string{}} cmd := app.Command("kubernetes-controller", "Runs Sloth in Kubernetes controller/operator mode.") cmd.Alias("controller") cmd.Alias("k8s-controller") diff --git a/deploy/kubernetes/helm/sloth/Chart.yaml b/deploy/kubernetes/helm/sloth/Chart.yaml index b1250cfc..095d93bc 100644 --- a/deploy/kubernetes/helm/sloth/Chart.yaml +++ b/deploy/kubernetes/helm/sloth/Chart.yaml @@ -2,6 +2,6 @@ apiVersion: v2 name: sloth description: Base chart for Sloth. type: application -home: https://github.com/slok/sloth +home: https://github.com/linode-obs/sloth kubeVersion: ">= 1.19.0-0" -version: 0.7.0 +version: 0.8.2 diff --git a/deploy/kubernetes/helm/sloth/crds/sloth.slok.dev_prometheusservicelevels.yaml b/deploy/kubernetes/helm/sloth/crds/sloth.slok.dev_prometheusservicelevels.yaml index 7283e667..107ee882 100644 --- a/deploy/kubernetes/helm/sloth/crds/sloth.slok.dev_prometheusservicelevels.yaml +++ b/deploy/kubernetes/helm/sloth/crds/sloth.slok.dev_prometheusservicelevels.yaml @@ -148,6 +148,11 @@ spec: description: description: Description is the description of the SLO. type: string + infoLabels: + additionalProperties: + type: string + description: Info labels added to the `sloth_slo_info` metric + type: object labels: additionalProperties: type: string diff --git a/deploy/kubernetes/helm/sloth/tests/testdata/output/deployment_custom.yaml b/deploy/kubernetes/helm/sloth/tests/testdata/output/deployment_custom.yaml index 1b7b0ff1..d741d3bd 100644 --- a/deploy/kubernetes/helm/sloth/tests/testdata/output/deployment_custom.yaml +++ b/deploy/kubernetes/helm/sloth/tests/testdata/output/deployment_custom.yaml @@ -39,7 +39,7 @@ spec: runAsUser: 100 containers: - name: sloth - image: slok/sloth-test:v1.42.42 + image: linode-obs/sloth-test:v1.42.42 args: - kubernetes-controller - --resync-interval=17m diff --git a/deploy/kubernetes/helm/sloth/tests/testdata/output/deployment_custom_no_extras.yaml b/deploy/kubernetes/helm/sloth/tests/testdata/output/deployment_custom_no_extras.yaml index c2d4ab0d..3601fe22 100644 --- a/deploy/kubernetes/helm/sloth/tests/testdata/output/deployment_custom_no_extras.yaml +++ b/deploy/kubernetes/helm/sloth/tests/testdata/output/deployment_custom_no_extras.yaml @@ -39,7 +39,7 @@ spec: runAsUser: 100 containers: - name: sloth - image: slok/sloth-test:v1.42.42 + image: linode-obs/sloth-test:v1.42.42 args: - kubernetes-controller - --resync-interval=17m diff --git a/deploy/kubernetes/helm/sloth/tests/testdata/output/deployment_custom_slo_config.yaml b/deploy/kubernetes/helm/sloth/tests/testdata/output/deployment_custom_slo_config.yaml index 6dbd8b11..8cb9444b 100644 --- a/deploy/kubernetes/helm/sloth/tests/testdata/output/deployment_custom_slo_config.yaml +++ b/deploy/kubernetes/helm/sloth/tests/testdata/output/deployment_custom_slo_config.yaml @@ -40,7 +40,7 @@ spec: runAsUser: 100 containers: - name: sloth - image: slok/sloth-test:v1.42.42 + image: linode-obs/sloth-test:v1.42.42 args: - kubernetes-controller - --resync-interval=17m diff --git a/deploy/kubernetes/helm/sloth/tests/testdata/output/deployment_default.yaml b/deploy/kubernetes/helm/sloth/tests/testdata/output/deployment_default.yaml index 2d19c3a5..9425fd59 100644 --- a/deploy/kubernetes/helm/sloth/tests/testdata/output/deployment_default.yaml +++ b/deploy/kubernetes/helm/sloth/tests/testdata/output/deployment_default.yaml @@ -32,7 +32,7 @@ spec: serviceAccountName: sloth containers: - name: sloth - image: ghcr.io/slok/sloth:v0.11.0 + image: ghcr.io/linode-obs/sloth:v0.13.1 args: - kubernetes-controller - --sli-plugins-path=/plugins diff --git a/deploy/kubernetes/helm/sloth/tests/values_test.go b/deploy/kubernetes/helm/sloth/tests/values_test.go index bbfcc51e..9345af41 100644 --- a/deploy/kubernetes/helm/sloth/tests/values_test.go +++ b/deploy/kubernetes/helm/sloth/tests/values_test.go @@ -13,7 +13,7 @@ func customValues() msi { }, "image": msi{ - "repository": "slok/sloth-test", + "repository": "linode-obs/sloth-test", "tag": "v1.42.42", }, diff --git a/deploy/kubernetes/helm/sloth/values.yaml b/deploy/kubernetes/helm/sloth/values.yaml index 8c8b309d..357b83fe 100644 --- a/deploy/kubernetes/helm/sloth/values.yaml +++ b/deploy/kubernetes/helm/sloth/values.yaml @@ -1,8 +1,8 @@ labels: {} image: - repository: ghcr.io/slok/sloth - tag: v0.11.0 + repository: ghcr.io/linode-obs/sloth + tag: v0.13.1 # -- Container resources: requests and limits for CPU, Memory resources: diff --git a/deploy/kubernetes/raw/sloth-with-common-plugins.yaml b/deploy/kubernetes/raw/sloth-with-common-plugins.yaml index 21de1723..dfd0a983 100644 --- a/deploy/kubernetes/raw/sloth-with-common-plugins.yaml +++ b/deploy/kubernetes/raw/sloth-with-common-plugins.yaml @@ -85,7 +85,7 @@ spec: serviceAccountName: sloth containers: - name: sloth - image: ghcr.io/slok/sloth:v0.11.0 + image: ghcr.io/linode-obs/sloth:v0.13.1 args: - kubernetes-controller - --sli-plugins-path=/plugins diff --git a/deploy/kubernetes/raw/sloth.yaml b/deploy/kubernetes/raw/sloth.yaml index 458928f3..84476298 100644 --- a/deploy/kubernetes/raw/sloth.yaml +++ b/deploy/kubernetes/raw/sloth.yaml @@ -85,7 +85,7 @@ spec: serviceAccountName: sloth containers: - name: sloth - image: ghcr.io/slok/sloth:v0.11.0 + image: ghcr.io/linode-obs/sloth:v0.13.1 args: - kubernetes-controller ports: diff --git a/docker/dev/Dockerfile b/docker/dev/Dockerfile index d5a9cc4e..53a5c9c4 100644 --- a/docker/dev/Dockerfile +++ b/docker/dev/Dockerfile @@ -1,9 +1,9 @@ -FROM golang:1.19.3 +FROM golang:1.23 LABEL org.opencontainers.image.source https://github.com/slok/sloth -ARG GOLANGCI_LINT_VERSION="1.50.0" -ARG MOCKERY_VERSION="2.14.0" +ARG GOLANGCI_LINT_VERSION="1.61.0" +ARG MOCKERY_VERSION="2.46.3" ARG GOMARKDOC_VERSION="0.4.1" ARG HELM_VERSION="3.10.0" ARG ostype=Linux diff --git a/docker/prod/Dockerfile b/docker/prod/Dockerfile index dacf5ac0..94052233 100644 --- a/docker/prod/Dockerfile +++ b/docker/prod/Dockerfile @@ -1,7 +1,7 @@ -# Set also `ARCH` ARG here so we can use it on all the `FROM`s. +# Set also `ARCH` ARG here so we can use it on all the `FROM`s. ARG ARCH -FROM golang:1.19.3-alpine as build-stage +FROM golang:1.23-alpine as build-stage LABEL org.opencontainers.image.source https://github.com/slok/sloth @@ -26,10 +26,10 @@ RUN ./scripts/build/bin/build-raw.sh # Although we are on an specific architecture (normally linux/amd64) our go binary has been built for # ${ARCH} specific architecture. -# To make portable our building process we base our final image on that same architecture as the binary +# To make portable our building process we base our final image on that same architecture as the binary # to obtain a resulting ${ARCH} image independently where we are building this image. FROM gcr.io/distroless/static:nonroot-${ARCH} COPY --from=build-stage /src/bin/sloth /usr/local/bin/sloth -ENTRYPOINT ["/usr/local/bin/sloth"] \ No newline at end of file +ENTRYPOINT ["/usr/local/bin/sloth"] diff --git a/examples/_gen/custom_rule_group_interval.yml b/examples/_gen/custom_rule_group_interval.yml new file mode 100644 index 00000000..d780edc3 --- /dev/null +++ b/examples/_gen/custom_rule_group_interval.yml @@ -0,0 +1,242 @@ + +--- +# Code generated by Sloth (dev): https://github.com/slok/sloth. +# DO NOT EDIT. + +groups: +- name: sloth-slo-sli-recordings-myapp-cpu-availability + interval: 4m + rules: + - record: slo:sli_error:ratio_rate5m + expr: | + (sum( + rate(node_cpu_seconds_total{mode="softirq"}[5m]) + ) + ) + / + (sum( + rate(node_cpu_seconds_total[5m]) + ) + ) + labels: + cmd: examplesgen.sh + owner: myteam + sloth_id: myapp-cpu-availability + sloth_service: myapp + sloth_slo: cpu-availability + sloth_window: 5m + - record: slo:sli_error:ratio_rate30m + expr: | + (sum( + rate(node_cpu_seconds_total{mode="softirq"}[30m]) + ) + ) + / + (sum( + rate(node_cpu_seconds_total[30m]) + ) + ) + labels: + cmd: examplesgen.sh + owner: myteam + sloth_id: myapp-cpu-availability + sloth_service: myapp + sloth_slo: cpu-availability + sloth_window: 30m + - record: slo:sli_error:ratio_rate1h + expr: | + (sum( + rate(node_cpu_seconds_total{mode="softirq"}[1h]) + ) + ) + / + (sum( + rate(node_cpu_seconds_total[1h]) + ) + ) + labels: + cmd: examplesgen.sh + owner: myteam + sloth_id: myapp-cpu-availability + sloth_service: myapp + sloth_slo: cpu-availability + sloth_window: 1h + - record: slo:sli_error:ratio_rate2h + expr: | + (sum( + rate(node_cpu_seconds_total{mode="softirq"}[2h]) + ) + ) + / + (sum( + rate(node_cpu_seconds_total[2h]) + ) + ) + labels: + cmd: examplesgen.sh + owner: myteam + sloth_id: myapp-cpu-availability + sloth_service: myapp + sloth_slo: cpu-availability + sloth_window: 2h + - record: slo:sli_error:ratio_rate6h + expr: | + (sum( + rate(node_cpu_seconds_total{mode="softirq"}[6h]) + ) + ) + / + (sum( + rate(node_cpu_seconds_total[6h]) + ) + ) + labels: + cmd: examplesgen.sh + owner: myteam + sloth_id: myapp-cpu-availability + sloth_service: myapp + sloth_slo: cpu-availability + sloth_window: 6h + - record: slo:sli_error:ratio_rate1d + expr: | + (sum( + rate(node_cpu_seconds_total{mode="softirq"}[1d]) + ) + ) + / + (sum( + rate(node_cpu_seconds_total[1d]) + ) + ) + labels: + cmd: examplesgen.sh + owner: myteam + sloth_id: myapp-cpu-availability + sloth_service: myapp + sloth_slo: cpu-availability + sloth_window: 1d + - record: slo:sli_error:ratio_rate3d + expr: | + (sum( + rate(node_cpu_seconds_total{mode="softirq"}[3d]) + ) + ) + / + (sum( + rate(node_cpu_seconds_total[3d]) + ) + ) + labels: + cmd: examplesgen.sh + owner: myteam + sloth_id: myapp-cpu-availability + sloth_service: myapp + sloth_slo: cpu-availability + sloth_window: 3d + - record: slo:sli_error:ratio_rate30d + expr: | + sum_over_time(slo:sli_error:ratio_rate5m{sloth_id="myapp-cpu-availability", sloth_service="myapp", sloth_slo="cpu-availability"}[30d]) + / ignoring (sloth_window) + count_over_time(slo:sli_error:ratio_rate5m{sloth_id="myapp-cpu-availability", sloth_service="myapp", sloth_slo="cpu-availability"}[30d]) + labels: + cmd: examplesgen.sh + owner: myteam + sloth_id: myapp-cpu-availability + sloth_service: myapp + sloth_slo: cpu-availability + sloth_window: 30d +- name: sloth-slo-meta-recordings-myapp-cpu-availability + interval: 2m + rules: + - record: slo:objective:ratio + expr: vector(0.9998999999999999) + labels: + cmd: examplesgen.sh + owner: myteam + sloth_id: myapp-cpu-availability + sloth_service: myapp + sloth_slo: cpu-availability + - record: slo:error_budget:ratio + expr: vector(1-0.9998999999999999) + labels: + cmd: examplesgen.sh + owner: myteam + sloth_id: myapp-cpu-availability + sloth_service: myapp + sloth_slo: cpu-availability + - record: slo:time_period:days + expr: vector(30) + labels: + cmd: examplesgen.sh + owner: myteam + sloth_id: myapp-cpu-availability + sloth_service: myapp + sloth_slo: cpu-availability + - record: slo:current_burn_rate:ratio + expr: | + slo:sli_error:ratio_rate5m{sloth_id="myapp-cpu-availability", sloth_service="myapp", sloth_slo="cpu-availability"} + / on(sloth_id, sloth_slo, sloth_service) group_left + slo:error_budget:ratio{sloth_id="myapp-cpu-availability", sloth_service="myapp", sloth_slo="cpu-availability"} + labels: + cmd: examplesgen.sh + owner: myteam + sloth_id: myapp-cpu-availability + sloth_service: myapp + sloth_slo: cpu-availability + - record: slo:period_burn_rate:ratio + expr: | + slo:sli_error:ratio_rate30d{sloth_id="myapp-cpu-availability", sloth_service="myapp", sloth_slo="cpu-availability"} + / on(sloth_id, sloth_slo, sloth_service) group_left + slo:error_budget:ratio{sloth_id="myapp-cpu-availability", sloth_service="myapp", sloth_slo="cpu-availability"} + labels: + cmd: examplesgen.sh + owner: myteam + sloth_id: myapp-cpu-availability + sloth_service: myapp + sloth_slo: cpu-availability + - record: slo:period_error_budget_remaining:ratio + expr: 1 - slo:period_burn_rate:ratio{sloth_id="myapp-cpu-availability", sloth_service="myapp", + sloth_slo="cpu-availability"} + labels: + cmd: examplesgen.sh + owner: myteam + sloth_id: myapp-cpu-availability + sloth_service: myapp + sloth_slo: cpu-availability + - record: sloth_slo_info + expr: vector(1) + labels: + cmd: examplesgen.sh + owner: myteam + sloth_id: myapp-cpu-availability + sloth_mode: cli-gen-prom + sloth_objective: "99.99" + sloth_service: myapp + sloth_slo: cpu-availability + sloth_spec: prometheus/v1 + sloth_version: dev +- name: sloth-slo-alerts-myapp-cpu-availability + interval: 2m + rules: + - alert: MyServiceHighErrorRate + expr: | + ( + max(slo:sli_error:ratio_rate5m{sloth_id="myapp-cpu-availability", sloth_service="myapp", sloth_slo="cpu-availability"} > (14.4 * 0.00010000000000005117)) without (sloth_window) + and + max(slo:sli_error:ratio_rate1h{sloth_id="myapp-cpu-availability", sloth_service="myapp", sloth_slo="cpu-availability"} > (14.4 * 0.00010000000000005117)) without (sloth_window) + ) + or + ( + max(slo:sli_error:ratio_rate30m{sloth_id="myapp-cpu-availability", sloth_service="myapp", sloth_slo="cpu-availability"} > (6 * 0.00010000000000005117)) without (sloth_window) + and + max(slo:sli_error:ratio_rate6h{sloth_id="myapp-cpu-availability", sloth_service="myapp", sloth_slo="cpu-availability"} > (6 * 0.00010000000000005117)) without (sloth_window) + ) + labels: + category: availability + routing_key: myteam + severity: pageteam + sloth_severity: page + annotations: + summary: High error rate on 'myservice' requests responses + title: (page) {{$labels.sloth_service}} {{$labels.sloth_slo}} SLO error budget + burn rate is too fast. diff --git a/examples/custom_rule_group_interval.yml b/examples/custom_rule_group_interval.yml new file mode 100644 index 00000000..94cfc461 --- /dev/null +++ b/examples/custom_rule_group_interval.yml @@ -0,0 +1,43 @@ +# This example shows how you can adjust the Prometheus rule_group interval for expensive SLOs +# https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule_group +# The SLO SLI measures the rate of CPU seconds spent performing softirqs +# +# `sloth generate -i ./examples/custom_rule_group_interval.yml` +# +version: "prometheus/v1" +service: "myapp" +labels: + owner: "myteam" +slos: + - name: "cpu-availability" + objective: 99.99 + description: "Example, expensive SLO. Recording rules will run every 2 minutes." + # alternative way of specifying interval for all three sets of rules + # interval: + # all: "5m" + interval: # all of these are different sets of rule groups sloth can make + slierror: "4m" + metadata: "2m" + alert: "2m" + sli: + events: + error_query: | + sum( + rate(node_cpu_seconds_total{mode="softirq"}[{{.window}}]) + ) + total_query: | + sum( + rate(node_cpu_seconds_total[{{.window}}]) + ) + alerting: + name: MyServiceHighErrorRate + labels: + category: "availability" + annotations: + summary: "High error rate on 'myservice' requests responses" + page_alert: + labels: + severity: pageteam + routing_key: myteam + ticket_alert: + disable: true diff --git a/go.mod b/go.mod index 3bf52b60..b68dd63a 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/slok/sloth -go 1.19 +go 1.23 require ( github.com/OpenSLO/oslo v0.2.2-0.20210629193748-b882029ce777 diff --git a/go.sum b/go.sum index 75a16d6d..f5e2f253 100644 --- a/go.sum +++ b/go.sum @@ -46,6 +46,7 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/Azure/azure-sdk-for-go v65.0.0+incompatible h1:HzKLt3kIwMm4KeJYTdx9EbjRYTySD/t8i1Ee/W5EGXw= +github.com/Azure/azure-sdk-for-go v65.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs= github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest/autorest v0.11.28 h1:ndAExarwr5Y+GaHE6VCaY1kyS/HwwGGyuimVhWsHOEM= @@ -59,7 +60,9 @@ github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935 github.com/Azure/go-autorest/autorest/mocks v0.4.2 h1:PGN4EDXnuQbojHbU0UWoNvmu9AGVwYHG9/fkDYhtAfw= github.com/Azure/go-autorest/autorest/mocks v0.4.2/go.mod h1:Vy7OitM9Kei0i1Oj+LvyAWMXJHeKH1MVlzFugfVrmyU= github.com/Azure/go-autorest/autorest/to v0.4.0 h1:oXVqrxakqqV1UZdSazDOPOLvOIz+XA683u8EctwboHk= +github.com/Azure/go-autorest/autorest/to v0.4.0/go.mod h1:fE8iZBn7LQR7zH/9XU2NcPR4o9jEImooCeWJcYV/zLE= github.com/Azure/go-autorest/autorest/validation v0.3.1 h1:AgyqjAd94fwNAoTjl/WQXg4VvFeRFpO+UhNyRXqF1ac= +github.com/Azure/go-autorest/autorest/validation v0.3.1/go.mod h1:yhLgjC0Wda5DYXl6JAsWyUe4KVNffhoDhG0zVzUMo3E= github.com/Azure/go-autorest/logger v0.2.1 h1:IG7i4p/mDa2Ce4TRyAO8IHnVhAVF3RFU+ZtXWSmf4Tg= github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo= @@ -67,6 +70,7 @@ github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBp github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/Microsoft/go-winio v0.5.1 h1:aPJp2QD7OOrhO5tQXqQoGSJc+DjDtWTGLOmNyAm6FgY= +github.com/Microsoft/go-winio v0.5.1/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/OpenSLO/oslo v0.2.2-0.20210629193748-b882029ce777 h1:Qoh0NZ1TnWjxP6P3xh2w6IqDn/m85NzTSyRZ8UMXra0= github.com/OpenSLO/oslo v0.2.2-0.20210629193748-b882029ce777/go.mod h1:oNu7jsjtXU8ct/VR0znkvBpNvlOSuc5sN/z82Vrkycs= @@ -82,6 +86,7 @@ github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kd github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-metrics v0.3.10 h1:FR+drcQStOe+32sYyJYyZ7FIdgoGGBnwLl+flodp8Uo= +github.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aws/aws-sdk-go v1.38.35/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= github.com/aws/aws-sdk-go v1.44.128 h1:X34pX5t0LIZXjBY11yf9JKMP3c1aZgirh+5PjtaZyJ4= @@ -107,6 +112,7 @@ github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnht github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20220314180256-7f1daf1720fc h1:PYXxkRUBGUMa5xgMVMDl62vEklZvKpVaxQeN9ie7Hfk= +github.com/cncf/xds/go v0.0.0-20220314180256-7f1daf1720fc/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -122,10 +128,15 @@ github.com/dennwc/varint v1.0.0/go.mod h1:hnItb35rvZvJrbTALZtY/iQfDs48JKRG1RPpgz github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/digitalocean/godo v1.88.0 h1:SAEdw63xOMmzlwCeCWjLH1GcyDPUjbSAR1Bh7VELxzc= +github.com/digitalocean/godo v1.88.0/go.mod h1:NRpFznZFvhHjBoqZAaOD3khVzsJ3EibzKqFL4R60dmA= github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug= +github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v20.10.21+incompatible h1:UTLdBmHk3bEY+w8qeO5KttOhy6OmXWsl/FEet9Uswog= +github.com/docker/docker v20.10.21+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= +github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/edsrzf/mmap-go v1.1.0 h1:6EUwBLQ/Mcr1EYLE4Tn1VdW1A4ckqCQWZBw8Hr0kjpQ= github.com/edsrzf/mmap-go v1.1.0/go.mod h1:19H/e8pUPLicwkyNgOykDXkJ9F0MHE+Z52B8EIth78Q= @@ -139,15 +150,19 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.10.3 h1:xdCVXxEe0Y3FQith+0cj2irwZudqGYvecuLB1HtdexY= +github.com/envoyproxy/go-control-plane v0.10.3/go.mod h1:fJJn/j26vwOu972OllsvAgJJM//w9BV6Fxbg2LuVd34= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.6.13 h1:TvDcILLkjuZV3ER58VkBmncKsLUBqBDxra/XctCzuMM= +github.com/envoyproxy/protoc-gen-validate v0.6.13/go.mod h1:qEySVqXrEugbHKvmhI8ZqtQi75/RHSSRNpffvB4I6Bw= github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U= github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= +github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/flowstack/go-jsonschema v0.1.1/go.mod h1:yL7fNggx1o8rm9RlgXv7hTBWxdBM0rVwpMwimd3F3N0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= +github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -189,8 +204,10 @@ github.com/go-playground/validator/v10 v10.6.1/go.mod h1:xm76BBt941f7yWdGnI2DVPF github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ= github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= github.com/go-resty/resty/v2 v2.1.1-0.20191201195748-d7b97669fe48 h1:JVrqSeQfdhYRFk24TvhTZWU0q8lfCojxZQFi3Ou7+uY= +github.com/go-resty/resty/v2 v2.1.1-0.20191201195748-d7b97669fe48/go.mod h1:dZGr0i9PLlaaTD4H/hoZIDjQ+r6xq8mgbRzHZf7f2J8= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-zookeeper/zk v1.0.3 h1:7M2kwOsc//9VeeFiPtf+uSJlVpU66x9Ba5+8XK7/TDg= +github.com/go-zookeeper/zk v1.0.3/go.mod h1:nOB03cncLtlp4t+UAkGSV+9beXP/akpekBwL+UX1Qcw= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= @@ -254,6 +271,7 @@ github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= +github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -283,9 +301,11 @@ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= github.com/gophercloud/gophercloud v1.0.0 h1:9nTGx0jizmHxDobe4mck89FyQHVyA3CaXLIUSGJjP9k= +github.com/gophercloud/gophercloud v1.0.0/go.mod h1:Q8fZtyi5zZxPS/j9aj3sSxtvj41AdQMDwyo1myduD5c= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grafana/regexp v0.0.0-20221005093135-b4c2bcb0a4b6 h1:A3dhViTeFDSQcGOXuUi6ukCQSMyDtDISBp2z6OOo2YM= github.com/grafana/regexp v0.0.0-20221005093135-b4c2bcb0a4b6/go.mod h1:M5qHK+eWfAv8VR/265dIuEpL3fNfeC21tXXp9itM24A= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= @@ -294,19 +314,26 @@ github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/api v1.15.3 h1:WYONYL2rxTXtlekAqblR2SCdJsizMDIj/uXb5wNy9zU= +github.com/hashicorp/consul/api v1.15.3/go.mod h1:/g/qgcoBcEXALCNZgRRisyTW0nY86++L0KbeAMXYCeY= github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/cronexpr v1.1.1 h1:NJZDd87hGXjoZBdvyCF9mX4DCq5Wy7+A/w+A7q0wn6c= +github.com/hashicorp/cronexpr v1.1.1/go.mod h1:P4wA0KBl9C5q2hABiMO7cp6jcIg96CDh1Efb3g1PWA4= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-hclog v0.14.1 h1:nQcJDQwIAGnmoUWp8ubocEX40cCml/17YkF6csQLReU= +github.com/hashicorp/go-hclog v0.14.1/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.3.0 h1:8exGP7ego3OmkfksihtSouGMZ+hQrhxx+FVELeXpVPE= +github.com/hashicorp/go-immutable-radix v1.3.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-retryablehttp v0.7.1 h1:sUiuQAnLlbvmExtFQs72iFW/HXeUn8Z1aJLQ4LJJbTQ= +github.com/hashicorp/go-retryablehttp v0.7.1/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc= +github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= @@ -315,20 +342,25 @@ github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= +github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/nomad/api v0.0.0-20221102143410-8a95f1239005 h1:jKwXhVS4F7qk0g8laz+Anz0g/6yaSJ3HqmSAuSNLUcA= +github.com/hashicorp/nomad/api v0.0.0-20221102143410-8a95f1239005/go.mod h1:vgJmrz4Bz9E1cR/uy70oP9udUJKFRkcEYHlHTp4nFwI= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hashicorp/serf v0.9.7 h1:hkdgbqizGQHuU5IPqYM1JdSMV8nKfpuOnZYXssk9muY= +github.com/hashicorp/serf v0.9.7/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= github.com/hetznercloud/hcloud-go v1.35.3 h1:WCmFAhLRooih2QHAsbCbEdpIHnshQQmrPqsr3rHE1Ow= +github.com/hetznercloud/hcloud-go v1.35.3/go.mod h1:mepQwR6va27S3UQthaEPGS86jtzSY9xWL1e9dyxXpgA= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/ionos-cloud/sdk-go/v6 v6.1.3 h1:vb6yqdpiqaytvreM0bsn2pXw+1YDvEk2RKSmBAQvgDQ= +github.com/ionos-cloud/sdk-go/v6 v6.1.3/go.mod h1:Ox3W0iiEz0GHnfY9e5LmAxwklsxguuNFEUSu0gVRTME= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= @@ -352,6 +384,7 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvW github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kolo/xmlrpc v0.0.0-20220921171641-a4b6fa1dd06b h1:udzkj9S/zlT5X367kqJis0QP7YMxobob6zhzq6Yre00= +github.com/kolo/xmlrpc v0.0.0-20220921171641-a4b6fa1dd06b/go.mod h1:pcaDhQK0/NJZEvtCO0qQPPropqV0sJOJ6YW7X+9kRwM= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= @@ -368,6 +401,7 @@ github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgx github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/linode/linodego v1.9.3 h1:+lxNZw4avRxhCqGjwfPgQ2PvMT+vOL0OMsTdzixR7hQ= +github.com/linode/linodego v1.9.3/go.mod h1:h6AuFR/JpqwwM/vkj7s8KV3iGN8/jxn+zc437F8SZ8w= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= @@ -375,13 +409,16 @@ github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0 github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.1.50 h1:DQUfb9uc6smULcREF09Uc+/Gd46YWqJd5DbpPE9xkcA= +github.com/miekg/dns v1.1.50/go.mod h1:e3IlAVfNqAllflbibAZEWOXOQ+Ynzk/dDozDxY7XnME= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= @@ -392,6 +429,7 @@ github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0Qu github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -410,10 +448,15 @@ github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo/v2 v2.1.6 h1:Fx2POJZfKRQcM1pH49qSZiYeu319wji004qX+GDovrU= +github.com/onsi/ginkgo/v2 v2.1.6/go.mod h1:MEH45j8TBi6u9BMogfbp0stKC5cdGjumZj5Y7AG4VIk= github.com/onsi/gomega v1.20.1 h1:PA/3qinGoukvymdIDV8pii6tiZgC8kbmJO6Z5+b002Q= +github.com/onsi/gomega v1.20.1/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= +github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/ovh/go-ovh v1.1.0 h1:bHXZmw8nTgZin4Nv7JuaLs0KG5x54EQR7migYTd1zrk= +github.com/ovh/go-ovh v1.1.0/go.mod h1:AxitLZ5HBRPyUd+Zl60Ajaag+rNTdVXWIkzfrVuTXWA= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= @@ -473,6 +516,7 @@ github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6po github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/scaleway/scaleway-sdk-go v1.0.0-beta.9 h1:0roa6gXKgyta64uqh52AQG3wzZXH21unn+ltzQSXML0= +github.com/scaleway/scaleway-sdk-go v1.0.0-beta.9/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= @@ -517,6 +561,7 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1 github.com/traefik/yaegi v0.14.3 h1:LqA0k8DKwvRMc+msfQjNusphHJc+r6WC5tZU5TmUFOM= github.com/traefik/yaegi v0.14.3/go.mod h1:AVRxhaI2G+nUsaM1zyktzwXn69G3t/AuTDrCiTds9p0= github.com/vultr/govultr/v2 v2.17.2 h1:gej/rwr91Puc/tgh+j33p/BLR16UrIPnSr+AIwYWZQs= +github.com/vultr/govultr/v2 v2.17.2/go.mod h1:ZFOKGWmgjytfyjeyAdhQlSWwTjh2ig+X49cAp50dzXI= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= @@ -597,6 +642,7 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0 h1:b9gGHsz9/HhJ3HF5DHQytPpuwocVTChQJK3AvoLRD5I= +golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -814,6 +860,7 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.2.0 h1:G6AHpWxTMGY1KyEYoAQ5WTtIekUUvDNjan3ugu60JvE= +golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -911,6 +958,7 @@ google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEc google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c h1:QgY/XxIAIeccR+Ca/rDdKubLIU9rcJ3xfy1DC/Wd2Oo= +google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c/go.mod h1:CGI5F/G+E5bKwmfYo09AXuVN4dD894kIKUFmVbP2/Fo= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -937,6 +985,7 @@ google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnD google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY= +google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -965,6 +1014,7 @@ gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.66.6 h1:LATuAqN/shcYAOkv3wl2L4rkaKqkcgTBQjOyYDvcPKI= +gopkg.in/ini.v1 v1.66.6/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/internal/k8sprometheus/k8sprometheusmock/prometheus_rules_ensurer.go b/internal/k8sprometheus/k8sprometheusmock/prometheus_rules_ensurer.go index f8995be0..b243ff9b 100644 --- a/internal/k8sprometheus/k8sprometheusmock/prometheus_rules_ensurer.go +++ b/internal/k8sprometheus/k8sprometheusmock/prometheus_rules_ensurer.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.14.0. DO NOT EDIT. +// Code generated by mockery v2.46.3. DO NOT EDIT. package k8sprometheusmock @@ -19,6 +19,10 @@ type PrometheusRulesEnsurer struct { func (_m *PrometheusRulesEnsurer) EnsurePrometheusRule(ctx context.Context, pr *v1.PrometheusRule) error { ret := _m.Called(ctx, pr) + if len(ret) == 0 { + panic("no return value specified for EnsurePrometheusRule") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, *v1.PrometheusRule) error); ok { r0 = rf(ctx, pr) @@ -29,13 +33,12 @@ func (_m *PrometheusRulesEnsurer) EnsurePrometheusRule(ctx context.Context, pr * return r0 } -type mockConstructorTestingTNewPrometheusRulesEnsurer interface { +// NewPrometheusRulesEnsurer creates a new instance of PrometheusRulesEnsurer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewPrometheusRulesEnsurer(t interface { mock.TestingT Cleanup(func()) -} - -// NewPrometheusRulesEnsurer creates a new instance of PrometheusRulesEnsurer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewPrometheusRulesEnsurer(t mockConstructorTestingTNewPrometheusRulesEnsurer) *PrometheusRulesEnsurer { +}) *PrometheusRulesEnsurer { mock := &PrometheusRulesEnsurer{} mock.Mock.Test(t) diff --git a/internal/k8sprometheus/kubernetes.go b/internal/k8sprometheus/kubernetes.go index 75a0fb83..2061e8fa 100644 --- a/internal/k8sprometheus/kubernetes.go +++ b/internal/k8sprometheus/kubernetes.go @@ -173,6 +173,9 @@ var prometheusServiceLevelFakes = []runtime.Object{ Labels: map[string]string{ "slo01k1": "slo01v1", }, + InfoLabels: map[string]string{ + "foo": "bar", + }, SLI: slothv1.SLI{Events: &slothv1.SLIEvents{ ErrorQuery: `sum(rate(http_request_duration_seconds_count{job="myservice",code=~"(5..|429)"}[{{.window}}]))`, TotalQuery: `sum(rate(http_request_duration_seconds_count{job="myservice"}[{{.window}}]))`, diff --git a/internal/k8sprometheus/model_test.go b/internal/k8sprometheus/model_test.go index 25686e22..2b9a29bb 100644 --- a/internal/k8sprometheus/model_test.go +++ b/internal/k8sprometheus/model_test.go @@ -44,6 +44,9 @@ func getGoodSLO(name string) prometheus.SLO { "owner": "myteam", "category": "test", }, + InfoLabels: map[string]string{ + "foo": "bar", + }, PageAlertMeta: prometheus.AlertMeta{ Disable: false, Name: "testAlert", diff --git a/internal/k8sprometheus/spec.go b/internal/k8sprometheus/spec.go index d2226435..375f854a 100644 --- a/internal/k8sprometheus/spec.go +++ b/internal/k8sprometheus/spec.go @@ -101,6 +101,7 @@ func mapSpecToModel(ctx context.Context, defaultWindowPeriod time.Duration, plug TimeWindow: defaultWindowPeriod, Objective: specSLO.Objective, Labels: mergeLabels(spec.Labels, specSLO.Labels), + InfoLabels: specSLO.InfoLabels, PageAlertMeta: prometheus.AlertMeta{Disable: true}, TicketAlertMeta: prometheus.AlertMeta{Disable: true}, } diff --git a/internal/k8sprometheus/spec_test.go b/internal/k8sprometheus/spec_test.go index 5734c524..3c21e382 100644 --- a/internal/k8sprometheus/spec_test.go +++ b/internal/k8sprometheus/spec_test.go @@ -234,6 +234,8 @@ spec: - name: "slo1" labels: category: test + infoLabels: + foo: bar objective: 99.99999 description: "This is a test." sli: @@ -299,6 +301,9 @@ spec: "owner": "myteam", "category": "test", }, + InfoLabels: map[string]string{ + "foo": "bar", + }, PageAlertMeta: prometheus.AlertMeta{ Disable: false, Name: "testAlert", diff --git a/internal/prometheus/model.go b/internal/prometheus/model.go index f2ac02c1..77e711ed 100644 --- a/internal/prometheus/model.go +++ b/internal/prometheus/model.go @@ -39,16 +39,21 @@ type AlertMeta struct { // SLO represents a service level objective configuration. type SLO struct { - ID string `validate:"required,name"` - Name string `validate:"required,name"` - Description string - Service string `validate:"required,name"` - SLI SLI `validate:"required"` - TimeWindow time.Duration `validate:"required"` - Objective float64 `validate:"gt=0,lte=100"` - Labels map[string]string `validate:"dive,keys,prom_label_key,endkeys,required,prom_label_value"` - PageAlertMeta AlertMeta - TicketAlertMeta AlertMeta + ID string `validate:"required,name"` + Name string `validate:"required,name"` + Description string + Service string `validate:"required,name"` + RuleGroupInterval time.Duration `validate:"time"` + SLIErrorRulesInterval time.Duration `validate:"time"` + MetadataRulesInterval time.Duration `validate:"time"` + AlertRulesInterval time.Duration `validate:"time"` + SLI SLI `validate:"required"` + TimeWindow time.Duration `validate:"required"` + Objective float64 `validate:"gt=0,lte=100"` + Labels map[string]string `validate:"dive,keys,prom_label_key,endkeys,required,prom_label_value"` + PageAlertMeta AlertMeta + TicketAlertMeta AlertMeta + InfoLabels map[string]string `validate:"dive,keys,prom_label_key,endkeys,required,prom_label_value"` } type SLOGroup struct { @@ -86,6 +91,7 @@ var modelSpecValidate = func() *validator.Validate { mustRegisterValidation(v, "name", validateName) mustRegisterValidation(v, "required_if_enabled", validateRequiredEnabledAlertName) mustRegisterValidation(v, "template_vars", validateTemplateVars) + mustRegisterValidation(v, "time", validateTime) v.RegisterStructValidation(validateOneSLI, SLI{}) v.RegisterStructValidation(validateSLOGroup, SLOGroup{}) v.RegisterStructValidation(validateSLIEvents, SLIEvents{}) @@ -181,6 +187,18 @@ func validateName(fl validator.FieldLevel) bool { return nameRegexp.MatchString(s) } +// validateTime implements validator.CustomTypeFunc by validating +// a time duration. +func validateTime(fl validator.FieldLevel) bool { + s, ok := fl.Field().Interface().(time.Duration) + if !ok { + return false + } + + _, err := time.ParseDuration(s.String()) + return err == nil +} + func validateRequiredEnabledAlertName(fl validator.FieldLevel) bool { alertMeta, ok := fl.Parent().Interface().(AlertMeta) if !ok { diff --git a/internal/prometheus/prometheusmock/file_manager.go b/internal/prometheus/prometheusmock/file_manager.go index 703008ed..8fbb5557 100644 --- a/internal/prometheus/prometheusmock/file_manager.go +++ b/internal/prometheus/prometheusmock/file_manager.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.14.0. DO NOT EDIT. +// Code generated by mockery v2.46.3. DO NOT EDIT. package prometheusmock @@ -19,7 +19,15 @@ type FileManager struct { func (_m *FileManager) FindFiles(ctx context.Context, root string, matcher *regexp.Regexp) ([]string, error) { ret := _m.Called(ctx, root, matcher) + if len(ret) == 0 { + panic("no return value specified for FindFiles") + } + var r0 []string + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, *regexp.Regexp) ([]string, error)); ok { + return rf(ctx, root, matcher) + } if rf, ok := ret.Get(0).(func(context.Context, string, *regexp.Regexp) []string); ok { r0 = rf(ctx, root, matcher) } else { @@ -28,7 +36,6 @@ func (_m *FileManager) FindFiles(ctx context.Context, root string, matcher *rege } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, string, *regexp.Regexp) error); ok { r1 = rf(ctx, root, matcher) } else { @@ -42,7 +49,15 @@ func (_m *FileManager) FindFiles(ctx context.Context, root string, matcher *rege func (_m *FileManager) ReadFile(ctx context.Context, path string) ([]byte, error) { ret := _m.Called(ctx, path) + if len(ret) == 0 { + panic("no return value specified for ReadFile") + } + var r0 []byte + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) ([]byte, error)); ok { + return rf(ctx, path) + } if rf, ok := ret.Get(0).(func(context.Context, string) []byte); ok { r0 = rf(ctx, path) } else { @@ -51,7 +66,6 @@ func (_m *FileManager) ReadFile(ctx context.Context, path string) ([]byte, error } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { r1 = rf(ctx, path) } else { @@ -61,13 +75,12 @@ func (_m *FileManager) ReadFile(ctx context.Context, path string) ([]byte, error return r0, r1 } -type mockConstructorTestingTNewFileManager interface { +// NewFileManager creates a new instance of FileManager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewFileManager(t interface { mock.TestingT Cleanup(func()) -} - -// NewFileManager creates a new instance of FileManager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewFileManager(t mockConstructorTestingTNewFileManager) *FileManager { +}) *FileManager { mock := &FileManager{} mock.Mock.Test(t) diff --git a/internal/prometheus/recording_rules.go b/internal/prometheus/recording_rules.go index b9f4a6c4..d8447076 100644 --- a/internal/prometheus/recording_rules.go +++ b/internal/prometheus/recording_rules.go @@ -205,6 +205,15 @@ const MetadataRecordingRulesGenerator = metadataRecordingRulesGenerator(false) func (m metadataRecordingRulesGenerator) GenerateMetadataRecordingRules(ctx context.Context, info info.Info, slo SLO, alerts alert.MWMBAlertGroup) ([]rulefmt.Rule, error) { labels := mergeLabels(slo.GetSLOIDPromLabels(), slo.Labels) + infoLabels := mergeLabels(labels, map[string]string{ + sloVersionLabelName: info.Version, + sloModeLabelName: string(info.Mode), + sloSpecLabelName: info.Spec, + sloObjectiveLabelName: strconv.FormatFloat(slo.Objective, 'f', -1, 64), + }) + + infoLabels = mergeLabels(infoLabels, slo.InfoLabels) + // Metatada Recordings. const ( metricSLOObjectiveRatio = "slo:objective:ratio" @@ -293,12 +302,7 @@ func (m metadataRecordingRulesGenerator) GenerateMetadataRecordingRules(ctx cont { Record: metricSLOInfo, Expr: `vector(1)`, - Labels: mergeLabels(labels, map[string]string{ - sloVersionLabelName: info.Version, - sloModeLabelName: string(info.Mode), - sloSpecLabelName: info.Spec, - sloObjectiveLabelName: strconv.FormatFloat(slo.Objective, 'f', -1, 64), - }), + Labels: infoLabels, }, } diff --git a/internal/prometheus/recording_rules_test.go b/internal/prometheus/recording_rules_test.go index 6e518d78..13809926 100644 --- a/internal/prometheus/recording_rules_test.go +++ b/internal/prometheus/recording_rules_test.go @@ -527,6 +527,9 @@ func TestGenerateMetaRecordingRules(t *testing.T) { Labels: map[string]string{ "kind": "test", }, + InfoLabels: map[string]string{ + "foo": "bar", + }, }, alertGroup: getAlertGroup(), expRules: []rulefmt.Rule{ @@ -608,6 +611,7 @@ slo:error_budget:ratio{sloth_id="test", sloth_service="test-svc", sloth_slo="tes "sloth_mode": "test", "sloth_spec": "test/v1", "sloth_objective": "99.9", + "foo": "bar", }, }, }, diff --git a/internal/prometheus/spec.go b/internal/prometheus/spec.go index 1935aa38..807c23b8 100644 --- a/internal/prometheus/spec.go +++ b/internal/prometheus/spec.go @@ -68,16 +68,22 @@ func (y YAMLSpecLoader) LoadSpec(ctx context.Context, data []byte) (*SLOGroup, e func (y YAMLSpecLoader) mapSpecToModel(ctx context.Context, spec prometheusv1.Spec) (*SLOGroup, error) { models := make([]SLO, 0, len(spec.SLOs)) for _, specSLO := range spec.SLOs { + slo := SLO{ - ID: fmt.Sprintf("%s-%s", spec.Service, specSLO.Name), - Name: specSLO.Name, - Description: specSLO.Description, - Service: spec.Service, - TimeWindow: y.windowPeriod, - Objective: specSLO.Objective, - Labels: mergeLabels(spec.Labels, specSLO.Labels), - PageAlertMeta: AlertMeta{Disable: true}, - TicketAlertMeta: AlertMeta{Disable: true}, + ID: fmt.Sprintf("%s-%s", spec.Service, specSLO.Name), + RuleGroupInterval: specSLO.Interval.RuleGroupInterval, + SLIErrorRulesInterval: specSLO.Interval.SLIErrorRulesInterval, + MetadataRulesInterval: specSLO.Interval.MetadataRulesInterval, + AlertRulesInterval: specSLO.Interval.AlertRulesInterval, + Name: specSLO.Name, + Description: specSLO.Description, + Service: spec.Service, + TimeWindow: y.windowPeriod, + Objective: specSLO.Objective, + Labels: mergeLabels(spec.Labels, specSLO.Labels), + PageAlertMeta: AlertMeta{Disable: true}, + TicketAlertMeta: AlertMeta{Disable: true}, + InfoLabels: specSLO.InfoLabels, } // Set SLIs. diff --git a/internal/prometheus/spec_test.go b/internal/prometheus/spec_test.go index 8c33a4fd..74f31778 100644 --- a/internal/prometheus/spec_test.go +++ b/internal/prometheus/spec_test.go @@ -137,6 +137,8 @@ labels: slos: - name: "slo-test" objective: 99 + infoLabels: + foo: bar sli: plugin: id: test_plugin @@ -156,6 +158,7 @@ slos: Service: "test-svc", TimeWindow: 30 * 24 * time.Hour, Labels: map[string]string{"gk1": "gv1"}, + InfoLabels: map[string]string{"foo": "bar"}, SLI: prometheus.SLI{ Raw: &prometheus.SLIRaw{ ErrorRatioQuery: `plugin_raw_expr{service="test-svc",slo="slo-test",objective="99.000000",gk1="gv1",k1="v1",k2="true"}`, @@ -178,6 +181,8 @@ labels: slos: - name: "slo-test" objective: 99 + infoLabels: + foo: bar sli: raw: error_ratio_query: test_expr_ratio_2 @@ -194,6 +199,7 @@ slos: Service: "test-svc", TimeWindow: 28 * 24 * time.Hour, Labels: map[string]string{"gk1": "gv1"}, + InfoLabels: map[string]string{"foo": "bar"}, SLI: prometheus.SLI{ Raw: &prometheus.SLIRaw{ ErrorRatioQuery: `test_expr_ratio_2`, @@ -217,6 +223,8 @@ slos: - name: "slo1" labels: category: test + infoLabels: + foo: bar objective: 99.99 description: "This is a test." sli: @@ -244,6 +252,8 @@ slos: - name: "slo2" labels: category: test2 + infoLabels: + foo: bar objective: 99.9 sli: raw: @@ -272,6 +282,7 @@ slos: "owner": "myteam", "category": "test", }, + InfoLabels: map[string]string{"foo": "bar"}, PageAlertMeta: prometheus.AlertMeta{ Disable: false, Name: "testAlert", @@ -314,6 +325,7 @@ slos: "owner": "myteam", "category": "test2", }, + InfoLabels: map[string]string{"foo": "bar"}, PageAlertMeta: prometheus.AlertMeta{Disable: true}, TicketAlertMeta: prometheus.AlertMeta{Disable: true}, }, diff --git a/internal/prometheus/storage.go b/internal/prometheus/storage.go index 9b37ca92..1e42de6f 100644 --- a/internal/prometheus/storage.go +++ b/internal/prometheus/storage.go @@ -49,24 +49,89 @@ func (i IOWriterGroupedRulesYAMLRepo) StoreSLOs(ctx context.Context, slos []Stor ruleGroups := ruleGroupsYAMLv2{} for _, slo := range slos { if len(slo.Rules.SLIErrorRecRules) > 0 { - ruleGroups.Groups = append(ruleGroups.Groups, ruleGroupYAMLv2{ + + group := ruleGroupYAMLv2{ Name: fmt.Sprintf("sloth-slo-sli-recordings-%s", slo.SLO.ID), Rules: slo.Rules.SLIErrorRecRules, - }) + } + + var ruleGroupIntervalDuration prommodel.Duration + var err error + + switch { + case slo.SLO.SLIErrorRulesInterval.String() != "0s": + ruleGroupIntervalDuration, err = prommodel.ParseDuration(slo.SLO.SLIErrorRulesInterval.String()) + if err != nil { + return fmt.Errorf("could not parse rule_group interval duration for alerts %w", err) + } + group.RuleGroupInterval = ruleGroupIntervalDuration + case slo.SLO.RuleGroupInterval.String() != "0s": + ruleGroupIntervalDuration, err = prommodel.ParseDuration(slo.SLO.RuleGroupInterval.String()) + if err != nil { + return fmt.Errorf("could not parse default ('all') rule_group interval duration %w", err) + } + group.RuleGroupInterval = ruleGroupIntervalDuration + + } + + ruleGroups.Groups = append(ruleGroups.Groups, group) } if len(slo.Rules.MetadataRecRules) > 0 { - ruleGroups.Groups = append(ruleGroups.Groups, ruleGroupYAMLv2{ + + group := ruleGroupYAMLv2{ Name: fmt.Sprintf("sloth-slo-meta-recordings-%s", slo.SLO.ID), Rules: slo.Rules.MetadataRecRules, - }) + } + + var ruleGroupIntervalDuration prommodel.Duration + var err error + + switch { + case slo.SLO.MetadataRulesInterval.String() != "0s": + ruleGroupIntervalDuration, err = prommodel.ParseDuration(slo.SLO.MetadataRulesInterval.String()) + if err != nil { + return fmt.Errorf("could not parse rule_group interval duration for alerts %w", err) + } + group.RuleGroupInterval = ruleGroupIntervalDuration + + case slo.SLO.RuleGroupInterval.String() != "0s": + ruleGroupIntervalDuration, err = prommodel.ParseDuration(slo.SLO.RuleGroupInterval.String()) + if err != nil { + return fmt.Errorf("could not parse default ('all') rule_group interval duration %w", err) + } + group.RuleGroupInterval = ruleGroupIntervalDuration + } + + ruleGroups.Groups = append(ruleGroups.Groups, group) } if len(slo.Rules.AlertRules) > 0 { - ruleGroups.Groups = append(ruleGroups.Groups, ruleGroupYAMLv2{ + + group := ruleGroupYAMLv2{ Name: fmt.Sprintf("sloth-slo-alerts-%s", slo.SLO.ID), Rules: slo.Rules.AlertRules, - }) + } + + var ruleGroupIntervalDuration prommodel.Duration + var err error + + switch { + case slo.SLO.AlertRulesInterval.String() != "0s": + ruleGroupIntervalDuration, err = prommodel.ParseDuration(slo.SLO.AlertRulesInterval.String()) + if err != nil { + return fmt.Errorf("could not parse rule_group interval duration for alerts %w", err) + } + group.RuleGroupInterval = ruleGroupIntervalDuration + case slo.SLO.RuleGroupInterval.String() != "0s": + ruleGroupIntervalDuration, err = prommodel.ParseDuration(slo.SLO.RuleGroupInterval.String()) + if err != nil { + return fmt.Errorf("could not parse default ('all') rule_group interval duration %w", err) + } + group.RuleGroupInterval = ruleGroupIntervalDuration + } + + ruleGroups.Groups = append(ruleGroups.Groups, group) } } @@ -112,7 +177,7 @@ type ruleGroupsYAMLv2 struct { } type ruleGroupYAMLv2 struct { - Name string `yaml:"name"` - Interval prommodel.Duration `yaml:"interval,omitempty"` - Rules []rulefmt.Rule `yaml:"rules"` + Name string `yaml:"name"` + RuleGroupInterval prommodel.Duration `yaml:"interval,omitempty"` + Rules []rulefmt.Rule `yaml:"rules"` } diff --git a/internal/prometheus/storage_test.go b/internal/prometheus/storage_test.go index 545c692b..b550b2a0 100644 --- a/internal/prometheus/storage_test.go +++ b/internal/prometheus/storage_test.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "testing" + "time" "github.com/prometheus/prometheus/model/rulefmt" "github.com/stretchr/testify/assert" @@ -12,7 +13,29 @@ import ( "github.com/slok/sloth/internal/prometheus" ) +func parseDuration(durationStr string, t *testing.T) time.Duration { + duration, err := time.ParseDuration(durationStr) + if err != nil { + t.Errorf("could not parse duration: %v", err) + return 0 + } + return duration +} + func TestIOWriterGroupedRulesYAMLRepoStore(t *testing.T) { + // set intervals ahead of time + ruleGroupInterval := parseDuration("2m", t) + // 0s = default/blank + ruleGroupIntervalBlank := parseDuration("0s", t) + // A/B for multiple group test + ruleGroupIntervalA := parseDuration("3m", t) + ruleGroupIntervalB := parseDuration("1h", t) + // for individual settings + sliErrorRulesInterval := parseDuration("4m", t) + metadataRulesInterval := parseDuration("5m", t) + alertRulesInterval := parseDuration("6m", t) + // need test for mix of rulegroupinterval and individual + tests := map[string]struct { slos []prometheus.StorageSLO expYAML string @@ -30,10 +53,11 @@ func TestIOWriterGroupedRulesYAMLRepoStore(t *testing.T) { expErr: true, }, - "Having a single SLI recording rule should render correctly.": { + "Having a single SLI recording rule with the generic rule_group interval should render correctly.": { + slos: []prometheus.StorageSLO{ { - SLO: prometheus.SLO{ID: "test1"}, + SLO: prometheus.SLO{ID: "test1", RuleGroupInterval: ruleGroupInterval}, Rules: prometheus.SLORules{ SLIErrorRecRules: []rulefmt.Rule{ { @@ -52,6 +76,7 @@ func TestIOWriterGroupedRulesYAMLRepoStore(t *testing.T) { groups: - name: sloth-slo-sli-recordings-test1 + interval: 2m rules: - record: test:record expr: test-expr @@ -91,7 +116,7 @@ groups: "Having a single SLO alert rule should render correctly.": { slos: []prometheus.StorageSLO{ { - SLO: prometheus.SLO{ID: "test1"}, + SLO: prometheus.SLO{ID: "test1", RuleGroupInterval: ruleGroupInterval}, Rules: prometheus.SLORules{ AlertRules: []rulefmt.Rule{ { @@ -111,6 +136,7 @@ groups: groups: - name: sloth-slo-alerts-test1 + interval: 2m rules: - alert: testAlert expr: test-expr @@ -120,11 +146,40 @@ groups: test-annot: one `, }, + "Having a single a blank or empty rule_group interval render correctly.": { + slos: []prometheus.StorageSLO{ + { + SLO: prometheus.SLO{ID: "test1", RuleGroupInterval: ruleGroupIntervalBlank}, + Rules: prometheus.SLORules{ + SLIErrorRecRules: []rulefmt.Rule{ + { + Record: "test:record", + Expr: "test-expr", + Labels: map[string]string{"test-label": "one"}, + }, + }, + }, + }, + }, + expYAML: ` +--- +# Code generated by Sloth (dev): https://github.com/slok/sloth. +# DO NOT EDIT. + +groups: +- name: sloth-slo-sli-recordings-test1 + rules: + - record: test:record + expr: test-expr + labels: + test-label: one +`, + }, "Having a multiple SLO alert and recording rules should render correctly.": { slos: []prometheus.StorageSLO{ { - SLO: prometheus.SLO{ID: "testa"}, + SLO: prometheus.SLO{ID: "testa", RuleGroupInterval: ruleGroupIntervalA}, Rules: prometheus.SLORules{ SLIErrorRecRules: []rulefmt.Rule{ { @@ -167,7 +222,7 @@ groups: }, }, { - SLO: prometheus.SLO{ID: "testb"}, + SLO: prometheus.SLO{ID: "testb", RuleGroupInterval: ruleGroupIntervalB}, Rules: prometheus.SLORules{ SLIErrorRecRules: []rulefmt.Rule{ { @@ -201,6 +256,7 @@ groups: groups: - name: sloth-slo-sli-recordings-testa + interval: 3m rules: - record: test:record-a1 expr: test-expr-a1 @@ -211,6 +267,7 @@ groups: labels: test-label: a-2 - name: sloth-slo-meta-recordings-testa + interval: 3m rules: - record: test:record-a3 expr: test-expr-a3 @@ -221,6 +278,7 @@ groups: labels: test-label: a-4 - name: sloth-slo-alerts-testa + interval: 3m rules: - alert: testAlertA1 expr: test-expr-a1 @@ -235,18 +293,21 @@ groups: annotations: test-annot: a-2 - name: sloth-slo-sli-recordings-testb + interval: 1h rules: - record: test:record-b1 expr: test-expr-b1 labels: test-label: b-1 - name: sloth-slo-meta-recordings-testb + interval: 1h rules: - record: test:record-b2 expr: test-expr-b2 labels: test-label: b-2 - name: sloth-slo-alerts-testb + interval: 1h rules: - alert: testAlertB1 expr: test-expr-b1 @@ -256,6 +317,130 @@ groups: test-annot: b-1 `, }, + "Having a mix of rule group intervals should render correctly.": { + + slos: []prometheus.StorageSLO{ + { + SLO: prometheus.SLO{ID: "testa", SLIErrorRulesInterval: sliErrorRulesInterval, MetadataRulesInterval: metadataRulesInterval, AlertRulesInterval: alertRulesInterval}, + Rules: prometheus.SLORules{ + SLIErrorRecRules: []rulefmt.Rule{ + { + Record: "test:record-a1", + Expr: "test-expr-a1", + Labels: map[string]string{"test-label": "a-1"}, + }, + }, + MetadataRecRules: []rulefmt.Rule{ + { + Record: "test:record-a3", + Expr: "test-expr-a3", + Labels: map[string]string{"test-label": "a-3"}, + }, + }, + AlertRules: []rulefmt.Rule{ + { + Alert: "testAlertA1", + Expr: "test-expr-a1", + Labels: map[string]string{"test-label": "a-1"}, + Annotations: map[string]string{"test-annot": "a-1"}, + }, + }, + }, + }, + }, + expYAML: ` +--- +# Code generated by Sloth (dev): https://github.com/slok/sloth. +# DO NOT EDIT. + +groups: +- name: sloth-slo-sli-recordings-testa + interval: 4m + rules: + - record: test:record-a1 + expr: test-expr-a1 + labels: + test-label: a-1 +- name: sloth-slo-meta-recordings-testa + interval: 5m + rules: + - record: test:record-a3 + expr: test-expr-a3 + labels: + test-label: a-3 +- name: sloth-slo-alerts-testa + interval: 6m + rules: + - alert: testAlertA1 + expr: test-expr-a1 + labels: + test-label: a-1 + annotations: + test-annot: a-1 +`}, + "Having a mix of rule group intervals and the overarching rule_group interval should render correctly.": { + + slos: []prometheus.StorageSLO{ + { + SLO: prometheus.SLO{ID: "testa", SLIErrorRulesInterval: sliErrorRulesInterval, MetadataRulesInterval: metadataRulesInterval, RuleGroupInterval: ruleGroupInterval}, + // in this case we use the broad RuleGroupInterval to set a 2m interval for the alert rules + // that dont have an explicit one set + Rules: prometheus.SLORules{ + SLIErrorRecRules: []rulefmt.Rule{ + { + Record: "test:record-a1", + Expr: "test-expr-a1", + Labels: map[string]string{"test-label": "a-1"}, + }, + }, + MetadataRecRules: []rulefmt.Rule{ + { + Record: "test:record-a3", + Expr: "test-expr-a3", + Labels: map[string]string{"test-label": "a-3"}, + }, + }, + AlertRules: []rulefmt.Rule{ + { + Alert: "testAlertA1", + Expr: "test-expr-a1", + Labels: map[string]string{"test-label": "a-1"}, + Annotations: map[string]string{"test-annot": "a-1"}, + }, + }, + }, + }, + }, + expYAML: ` +--- +# Code generated by Sloth (dev): https://github.com/slok/sloth. +# DO NOT EDIT. + +groups: +- name: sloth-slo-sli-recordings-testa + interval: 4m + rules: + - record: test:record-a1 + expr: test-expr-a1 + labels: + test-label: a-1 +- name: sloth-slo-meta-recordings-testa + interval: 5m + rules: + - record: test:record-a3 + expr: test-expr-a3 + labels: + test-label: a-3 +- name: sloth-slo-alerts-testa + interval: 2m + rules: + - alert: testAlertA1 + expr: test-expr-a1 + labels: + test-label: a-1 + annotations: + test-annot: a-1 +`}, } for name, test := range tests { diff --git a/pkg/kubernetes/api/sloth/v1/README.md b/pkg/kubernetes/api/sloth/v1/README.md index 46ef875c..607d255c 100755 --- a/pkg/kubernetes/api/sloth/v1/README.md +++ b/pkg/kubernetes/api/sloth/v1/README.md @@ -66,7 +66,7 @@ SchemeGroupVersion is group version used to register these objects. var SchemeGroupVersion = schema.GroupVersion{Group: sloth.GroupName, Version: version} ``` -## func Kind +## func [Kind]() ```go func Kind(kind string) schema.GroupKind @@ -74,7 +74,7 @@ func Kind(kind string) schema.GroupKind Kind takes an unqualified kind and returns back a Group qualified GroupKind. -## func Resource +## func [Resource]() ```go func Resource(resource string) schema.GroupResource @@ -82,7 +82,7 @@ func Resource(resource string) schema.GroupResource Resource takes an unqualified resource and returns a Group qualified GroupResource. -## func VersionKind +## func [VersionKind]() ```go func VersionKind(kind string) schema.GroupVersionKind @@ -90,7 +90,7 @@ func VersionKind(kind string) schema.GroupVersionKind VersionKind takes an unqualified kind and returns back a Group qualified GroupVersionKind. -## type Alert +## type [Alert]() Alert configures specific SLO alert. @@ -111,7 +111,7 @@ type Alert struct { } ``` -### func \(\*Alert\) DeepCopy +### func \(\*Alert\) [DeepCopy]() ```go func (in *Alert) DeepCopy() *Alert @@ -119,7 +119,7 @@ func (in *Alert) DeepCopy() *Alert DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Alert. -### func \(\*Alert\) DeepCopyInto +### func \(\*Alert\) [DeepCopyInto]() ```go func (in *Alert) DeepCopyInto(out *Alert) @@ -127,7 +127,7 @@ func (in *Alert) DeepCopyInto(out *Alert) DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non\-nil. -## type Alerting +## type [Alerting]() Alerting wraps all the configuration required by the SLO alerts. @@ -154,7 +154,7 @@ type Alerting struct { } ``` -### func \(\*Alerting\) DeepCopy +### func \(\*Alerting\) [DeepCopy]() ```go func (in *Alerting) DeepCopy() *Alerting @@ -162,7 +162,7 @@ func (in *Alerting) DeepCopy() *Alerting DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Alerting. -### func \(\*Alerting\) DeepCopyInto +### func \(\*Alerting\) [DeepCopyInto]() ```go func (in *Alerting) DeepCopyInto(out *Alerting) @@ -170,7 +170,7 @@ func (in *Alerting) DeepCopyInto(out *Alerting) DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non\-nil. -## type PrometheusServiceLevel +## type [PrometheusServiceLevel]() \+genclient \+k8s:deepcopy\-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object \+kubebuilder:subresource:status \+kubebuilder:printcolumn:name="SERVICE",type="string",JSONPath=".spec.service" \+kubebuilder:printcolumn:name="DESIRED SLOs",type="integer",JSONPath=".status.processedSLOs" \+kubebuilder:printcolumn:name="READY SLOs",type="integer",JSONPath=".status.promOpRulesGeneratedSLOs" \+kubebuilder:printcolumn:name="GEN OK",type="boolean",JSONPath=".status.promOpRulesGenerated" \+kubebuilder:printcolumn:name="GEN AGE",type="date",JSONPath=".status.lastPromOpRulesSuccessfulGenerated" \+kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" \+kubebuilder:resource:singular=prometheusservicelevel,path=prometheusservicelevels,shortName=psl;pslo,scope=Namespaced,categories=slo;slos;sli;slis @@ -186,7 +186,7 @@ type PrometheusServiceLevel struct { } ``` -### func \(\*PrometheusServiceLevel\) DeepCopy +### func \(\*PrometheusServiceLevel\) [DeepCopy]() ```go func (in *PrometheusServiceLevel) DeepCopy() *PrometheusServiceLevel @@ -194,7 +194,7 @@ func (in *PrometheusServiceLevel) DeepCopy() *PrometheusServiceLevel DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusServiceLevel. -### func \(\*PrometheusServiceLevel\) DeepCopyInto +### func \(\*PrometheusServiceLevel\) [DeepCopyInto]() ```go func (in *PrometheusServiceLevel) DeepCopyInto(out *PrometheusServiceLevel) @@ -202,7 +202,7 @@ func (in *PrometheusServiceLevel) DeepCopyInto(out *PrometheusServiceLevel) DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non\-nil. -### func \(\*PrometheusServiceLevel\) DeepCopyObject +### func \(\*PrometheusServiceLevel\) [DeepCopyObject]() ```go func (in *PrometheusServiceLevel) DeepCopyObject() runtime.Object @@ -210,7 +210,7 @@ func (in *PrometheusServiceLevel) DeepCopyObject() runtime.Object DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -## type PrometheusServiceLevelList +## type [PrometheusServiceLevelList]() \+k8s:deepcopy\-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object @@ -225,7 +225,7 @@ type PrometheusServiceLevelList struct { } ``` -### func \(\*PrometheusServiceLevelList\) DeepCopy +### func \(\*PrometheusServiceLevelList\) [DeepCopy]() ```go func (in *PrometheusServiceLevelList) DeepCopy() *PrometheusServiceLevelList @@ -233,7 +233,7 @@ func (in *PrometheusServiceLevelList) DeepCopy() *PrometheusServiceLevelList DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusServiceLevelList. -### func \(\*PrometheusServiceLevelList\) DeepCopyInto +### func \(\*PrometheusServiceLevelList\) [DeepCopyInto]() ```go func (in *PrometheusServiceLevelList) DeepCopyInto(out *PrometheusServiceLevelList) @@ -241,7 +241,7 @@ func (in *PrometheusServiceLevelList) DeepCopyInto(out *PrometheusServiceLevelLi DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non\-nil. -### func \(\*PrometheusServiceLevelList\) DeepCopyObject +### func \(\*PrometheusServiceLevelList\) [DeepCopyObject]() ```go func (in *PrometheusServiceLevelList) DeepCopyObject() runtime.Object @@ -249,7 +249,7 @@ func (in *PrometheusServiceLevelList) DeepCopyObject() runtime.Object DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -## type PrometheusServiceLevelSpec +## type [PrometheusServiceLevelSpec]() ServiceLevelSpec is the spec for a PrometheusServiceLevel. @@ -271,7 +271,7 @@ type PrometheusServiceLevelSpec struct { } ``` -### func \(\*PrometheusServiceLevelSpec\) DeepCopy +### func \(\*PrometheusServiceLevelSpec\) [DeepCopy]() ```go func (in *PrometheusServiceLevelSpec) DeepCopy() *PrometheusServiceLevelSpec @@ -279,7 +279,7 @@ func (in *PrometheusServiceLevelSpec) DeepCopy() *PrometheusServiceLevelSpec DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusServiceLevelSpec. -### func \(\*PrometheusServiceLevelSpec\) DeepCopyInto +### func \(\*PrometheusServiceLevelSpec\) [DeepCopyInto]() ```go func (in *PrometheusServiceLevelSpec) DeepCopyInto(out *PrometheusServiceLevelSpec) @@ -287,7 +287,7 @@ func (in *PrometheusServiceLevelSpec) DeepCopyInto(out *PrometheusServiceLevelSp DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non\-nil. -## type PrometheusServiceLevelStatus +## type [PrometheusServiceLevelStatus]() ```go type PrometheusServiceLevelStatus struct { @@ -307,7 +307,7 @@ type PrometheusServiceLevelStatus struct { } ``` -### func \(\*PrometheusServiceLevelStatus\) DeepCopy +### func \(\*PrometheusServiceLevelStatus\) [DeepCopy]() ```go func (in *PrometheusServiceLevelStatus) DeepCopy() *PrometheusServiceLevelStatus @@ -315,7 +315,7 @@ func (in *PrometheusServiceLevelStatus) DeepCopy() *PrometheusServiceLevelStatus DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusServiceLevelStatus. -### func \(\*PrometheusServiceLevelStatus\) DeepCopyInto +### func \(\*PrometheusServiceLevelStatus\) [DeepCopyInto]() ```go func (in *PrometheusServiceLevelStatus) DeepCopyInto(out *PrometheusServiceLevelStatus) @@ -323,7 +323,7 @@ func (in *PrometheusServiceLevelStatus) DeepCopyInto(out *PrometheusServiceLevel DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non\-nil. -## type SLI +## type [SLI]() SLI will tell what is good or bad for the SLO. All SLIs will be get based on time windows, that's why Sloth needs the queries to use \`\{\{.window\}\}\` template variable. @@ -345,7 +345,7 @@ type SLI struct { } ``` -### func \(\*SLI\) DeepCopy +### func \(\*SLI\) [DeepCopy]() ```go func (in *SLI) DeepCopy() *SLI @@ -353,7 +353,7 @@ func (in *SLI) DeepCopy() *SLI DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SLI. -### func \(\*SLI\) DeepCopyInto +### func \(\*SLI\) [DeepCopyInto]() ```go func (in *SLI) DeepCopyInto(out *SLI) @@ -361,7 +361,7 @@ func (in *SLI) DeepCopyInto(out *SLI) DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non\-nil. -## type SLIEvents +## type [SLIEvents]() SLIEvents is an SLI that is calculated as the division of bad events and total events, giving a ratio SLI. Normally this is the most common ratio type. @@ -379,7 +379,7 @@ type SLIEvents struct { } ``` -### func \(\*SLIEvents\) DeepCopy +### func \(\*SLIEvents\) [DeepCopy]() ```go func (in *SLIEvents) DeepCopy() *SLIEvents @@ -387,7 +387,7 @@ func (in *SLIEvents) DeepCopy() *SLIEvents DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SLIEvents. -### func \(\*SLIEvents\) DeepCopyInto +### func \(\*SLIEvents\) [DeepCopyInto]() ```go func (in *SLIEvents) DeepCopyInto(out *SLIEvents) @@ -395,7 +395,7 @@ func (in *SLIEvents) DeepCopyInto(out *SLIEvents) DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non\-nil. -## type SLIPlugin +## type [SLIPlugin]() SLIPlugin will use the SLI returned by the SLI plugin selected along with the options. @@ -410,7 +410,7 @@ type SLIPlugin struct { } ``` -### func \(\*SLIPlugin\) DeepCopy +### func \(\*SLIPlugin\) [DeepCopy]() ```go func (in *SLIPlugin) DeepCopy() *SLIPlugin @@ -418,7 +418,7 @@ func (in *SLIPlugin) DeepCopy() *SLIPlugin DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SLIPlugin. -### func \(\*SLIPlugin\) DeepCopyInto +### func \(\*SLIPlugin\) [DeepCopyInto]() ```go func (in *SLIPlugin) DeepCopyInto(out *SLIPlugin) @@ -426,7 +426,7 @@ func (in *SLIPlugin) DeepCopyInto(out *SLIPlugin) DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non\-nil. -## type SLIRaw +## type [SLIRaw]() SLIRaw is a error ratio SLI already calculated. Normally this will be used when the SLI is already calculated by other recording rule, system... @@ -437,7 +437,7 @@ type SLIRaw struct { } ``` -### func \(\*SLIRaw\) DeepCopy +### func \(\*SLIRaw\) [DeepCopy]() ```go func (in *SLIRaw) DeepCopy() *SLIRaw @@ -445,7 +445,7 @@ func (in *SLIRaw) DeepCopy() *SLIRaw DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SLIRaw. -### func \(\*SLIRaw\) DeepCopyInto +### func \(\*SLIRaw\) [DeepCopyInto]() ```go func (in *SLIRaw) DeepCopyInto(out *SLIRaw) @@ -453,7 +453,7 @@ func (in *SLIRaw) DeepCopyInto(out *SLIRaw) DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non\-nil. -## type SLO +## type [SLO]() SLO is the configuration/declaration of the service level objective of a service. @@ -480,6 +480,9 @@ type SLO struct { // +optional Labels map[string]string `json:"labels,omitempty"` + // Info labels added to the `sloth_slo_info` metric + InfoLabels map[string]string `json:"infoLabels,omitempty"` + // +kubebuilder:validation:Required // // SLI is the indicator (service level indicator) for this specific SLO. @@ -493,7 +496,7 @@ type SLO struct { } ``` -### func \(\*SLO\) DeepCopy +### func \(\*SLO\) [DeepCopy]() ```go func (in *SLO) DeepCopy() *SLO @@ -501,7 +504,7 @@ func (in *SLO) DeepCopy() *SLO DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SLO. -### func \(\*SLO\) DeepCopyInto +### func \(\*SLO\) [DeepCopyInto]() ```go func (in *SLO) DeepCopyInto(out *SLO) diff --git a/pkg/kubernetes/api/sloth/v1/types.go b/pkg/kubernetes/api/sloth/v1/types.go index 00e27c73..67983d8a 100644 --- a/pkg/kubernetes/api/sloth/v1/types.go +++ b/pkg/kubernetes/api/sloth/v1/types.go @@ -68,6 +68,9 @@ type SLO struct { // +optional Labels map[string]string `json:"labels,omitempty"` + // Info labels added to the `sloth_slo_info` metric + InfoLabels map[string]string `json:"infoLabels,omitempty"` + // +kubebuilder:validation:Required // // SLI is the indicator (service level indicator) for this specific SLO. diff --git a/pkg/kubernetes/api/sloth/v1/zz_generated.deepcopy.go b/pkg/kubernetes/api/sloth/v1/zz_generated.deepcopy.go index ea5cdfb9..a7380b6b 100644 --- a/pkg/kubernetes/api/sloth/v1/zz_generated.deepcopy.go +++ b/pkg/kubernetes/api/sloth/v1/zz_generated.deepcopy.go @@ -278,6 +278,13 @@ func (in *SLO) DeepCopyInto(out *SLO) { (*out)[key] = val } } + if in.InfoLabels != nil { + in, out := &in.InfoLabels, &out.InfoLabels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } in.SLI.DeepCopyInto(&out.SLI) in.Alerting.DeepCopyInto(&out.Alerting) return diff --git a/pkg/kubernetes/gen/crd/sloth.slok.dev_prometheusservicelevels.yaml b/pkg/kubernetes/gen/crd/sloth.slok.dev_prometheusservicelevels.yaml index 7283e667..107ee882 100644 --- a/pkg/kubernetes/gen/crd/sloth.slok.dev_prometheusservicelevels.yaml +++ b/pkg/kubernetes/gen/crd/sloth.slok.dev_prometheusservicelevels.yaml @@ -148,6 +148,11 @@ spec: description: description: Description is the description of the SLO. type: string + infoLabels: + additionalProperties: + type: string + description: Info labels added to the `sloth_slo_info` metric + type: object labels: additionalProperties: type: string diff --git a/pkg/prometheus/alertwindows/v1/README.md b/pkg/prometheus/alertwindows/v1/README.md index 09544ab2..ba4090f7 100755 --- a/pkg/prometheus/alertwindows/v1/README.md +++ b/pkg/prometheus/alertwindows/v1/README.md @@ -27,7 +27,7 @@ const APIVersion = "sloth.slok.dev/v1" const Kind = "AlertWindows" ``` -## type AlertWindows +## type [AlertWindows]() ```go type AlertWindows struct { @@ -37,7 +37,7 @@ type AlertWindows struct { } ``` -## type PageWindow +## type [PageWindow]() PageWindow represents the configuration for page alerting. @@ -47,7 +47,7 @@ type PageWindow struct { } ``` -## type QuickSlowWindow +## type [QuickSlowWindow]() ```go type QuickSlowWindow struct { @@ -58,7 +58,7 @@ type QuickSlowWindow struct { } ``` -## type Spec +## type [Spec]() Spec represents the root type of the Alerting window. @@ -73,7 +73,7 @@ type Spec struct { } ``` -## type TicketWindow +## type [TicketWindow]() PageWindow represents the configuration for ticket alerting. @@ -83,7 +83,7 @@ type TicketWindow struct { } ``` -## type Window +## type [Window]() ```go type Window struct { diff --git a/pkg/prometheus/api/v1/README.md b/pkg/prometheus/api/v1/README.md index ab419d3d..49846d24 100755 --- a/pkg/prometheus/api/v1/README.md +++ b/pkg/prometheus/api/v1/README.md @@ -68,6 +68,7 @@ slos: - [Constants](<#constants>) - [type Alert](<#type-alert>) - [type Alerting](<#type-alerting>) +- [type Interval](<#type-interval>) - [type SLI](<#type-sli>) - [type SLIEvents](<#type-slievents>) - [type SLIPlugin](<#type-sliplugin>) @@ -82,7 +83,7 @@ slos: const Version = "prometheus/v1" ``` -## type Alert +## type [Alert]() Alert configures specific SLO alert. @@ -99,7 +100,7 @@ type Alert struct { } ``` -## type Alerting +## type [Alerting]() Alerting wraps all the configuration required by the SLO alerts. @@ -119,7 +120,23 @@ type Alerting struct { } ``` -## type SLI +## type [Interval]() + +```go +type Interval struct { + // RuleGroupInterval is an optional value for how often the Prometheus rule_group should be evaluated. + // RuleGroupInterval string `yaml:"rulegroup_interval,omitempty"` + RuleGroupInterval time.Duration `yaml:"all,omitempty"` + // Otherwise, specify custom rule_group intervals for each set of recording rules. + // RuleGroupInterval will "fill-in" for any non-specified individual groups + // but individual group settings override RuleGroupInterval. + SLIErrorRulesInterval time.Duration `yaml:"slierror,omitempty"` + MetadataRulesInterval time.Duration `yaml:"metadata,omitempty"` + AlertRulesInterval time.Duration `yaml:"alert,omitempty"` +} +``` + +## type [SLI]() SLI will tell what is good or bad for the SLO. All SLIs will be get based on time windows, that's why Sloth needs the queries to use \`\{\{.window\}\}\` template variable. @@ -136,7 +153,7 @@ type SLI struct { } ``` -## type SLIEvents +## type [SLIEvents]() SLIEvents is an SLI that is calculated as the division of bad events and total events, giving a ratio SLI. Normally this is the most common ratio type. @@ -153,7 +170,7 @@ type SLIEvents struct { } ``` -## type SLIPlugin +## type [SLIPlugin]() SLIPlugin will use the SLI returned by the SLI plugin selected along with the options. @@ -166,7 +183,7 @@ type SLIPlugin struct { } ``` -## type SLIRaw +## type [SLIRaw]() SLIRaw is a error ratio SLI already calculated. Normally this will be used when the SLI is already calculated by other recording rule, system... @@ -177,7 +194,7 @@ type SLIRaw struct { } ``` -## type SLO +## type [SLO]() SLO is the configuration/declaration of the service level objective of a service. @@ -193,15 +210,20 @@ type SLO struct { // alerting rules for this specific SLO. These labels are merged with the // previous level labels. Labels map[string]string `yaml:"labels,omitempty"` + // Labels appended to `sloth_slo_info` + InfoLabels map[string]string `yaml:"infoLabels,omitempty"` // SLI is the indicator (service level indicator) for this specific SLO. SLI SLI `yaml:"sli"` // Alerting is the configuration with all the things related with the SLO // alerts. Alerting Alerting `yaml:"alerting"` + // Interval is the configuration for all things related to SLO rule_group intervals + // for specific rule groups and all rules. + Interval Interval `yaml:"interval,omitempty"` } ``` -## type Spec +## type [Spec]() Spec represents the root type of the SLOs declaration specification. diff --git a/pkg/prometheus/api/v1/v1.go b/pkg/prometheus/api/v1/v1.go index d81d367d..8445ad4e 100644 --- a/pkg/prometheus/api/v1/v1.go +++ b/pkg/prometheus/api/v1/v1.go @@ -54,6 +54,8 @@ // disable: true package v1 +import "time" + const Version = "prometheus/v1" //go:generate gomarkdoc -o ./README.md ./ @@ -84,11 +86,16 @@ type SLO struct { // alerting rules for this specific SLO. These labels are merged with the // previous level labels. Labels map[string]string `yaml:"labels,omitempty"` + // Labels appended to `sloth_slo_info` + InfoLabels map[string]string `yaml:"infoLabels,omitempty"` // SLI is the indicator (service level indicator) for this specific SLO. SLI SLI `yaml:"sli"` // Alerting is the configuration with all the things related with the SLO // alerts. Alerting Alerting `yaml:"alerting"` + // Interval is the configuration for all things related to SLO rule_group intervals + // for specific rule groups and all rules. + Interval Interval `yaml:"interval,omitempty"` } // SLI will tell what is good or bad for the SLO. @@ -148,6 +155,18 @@ type Alerting struct { TicketAlert Alert `yaml:"ticket_alert,omitempty"` } +type Interval struct { + // RuleGroupInterval is an optional value for how often the Prometheus rule_group should be evaluated. + // RuleGroupInterval string `yaml:"rulegroup_interval,omitempty"` + RuleGroupInterval time.Duration `yaml:"all,omitempty"` + // Otherwise, specify custom rule_group intervals for each set of recording rules. + // RuleGroupInterval will "fill-in" for any non-specified individual groups + // but individual group settings override RuleGroupInterval. + SLIErrorRulesInterval time.Duration `yaml:"slierror,omitempty"` + MetadataRulesInterval time.Duration `yaml:"metadata,omitempty"` + AlertRulesInterval time.Duration `yaml:"alert,omitempty"` +} + // Alert configures specific SLO alert. type Alert struct { // Disable disables the alert and makes Sloth not generating this alert. This diff --git a/scripts/build/bin/build-raw.sh b/scripts/build/bin/build-raw.sh index eb13684b..9b0570de 100755 --- a/scripts/build/bin/build-raw.sh +++ b/scripts/build/bin/build-raw.sh @@ -21,4 +21,4 @@ f_ver="-X ${version_path}=${VERSION:-dev}" # Build binary. echo "[*] Building binary at ${final_out} (GOOS=${GOOS:-}, GOARCH=${GOARCH:-}, GOARM=${GOARM:-}, VERSION=${VERSION:-}, EXTENSION=${EXTENSION:-})" -CGO_ENABLED=0 go build -o ${final_out} --ldflags "${ldf_cmp} ${f_ver}" ${src} +CGO_ENABLED=0 go build -buildvcs=false -o ${final_out} --ldflags "${ldf_cmp} ${f_ver}" ${src} diff --git a/scripts/check/unit-test.sh b/scripts/check/unit-test.sh index b0dfc8bf..bc96e1c4 100755 --- a/scripts/check/unit-test.sh +++ b/scripts/check/unit-test.sh @@ -3,5 +3,5 @@ set -o errexit set -o nounset -go test -race -coverprofile=.test_coverage.txt $(go list ./... | grep -v /test/integration ) -go tool cover -func=.test_coverage.txt | tail -n1 | awk '{print "Total test coverage: " $3}' \ No newline at end of file +go test -buildvcs=false -race -coverprofile=.test_coverage.txt $(go list ./... | grep -v /test/integration ) +go tool cover -func=.test_coverage.txt | tail -n1 | awk '{print "Total test coverage: " $3}'