From 675523df96dbd212c915dc6a233e7edef73d3fe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Gomez?= Date: Mon, 14 Aug 2023 16:41:28 +0200 Subject: [PATCH] Update grabana to v0.21.19 --- go.mod | 4 ++-- go.sum | 8 ++++---- .../grabana/alert/queries/stackdriver/stackdriver.go | 7 +++++++ .../github.com/K-Phoen/grabana/decoder/alert_targets.go | 5 +++++ vendor/github.com/K-Phoen/sdk/alert.go | 1 + vendor/modules.txt | 4 ++-- 6 files changed, 21 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 38b01da0..c1e80875 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module github.com/K-Phoen/dark go 1.19 require ( - github.com/K-Phoen/grabana v0.21.18 - github.com/K-Phoen/sdk v0.12.2 + github.com/K-Phoen/grabana v0.21.19 + github.com/K-Phoen/sdk v0.12.3 github.com/go-logr/logr v1.2.3 github.com/onsi/ginkgo v1.16.5 github.com/onsi/gomega v1.27.1 diff --git a/go.sum b/go.sum index 52b6c732..5b0ddbd2 100644 --- a/go.sum +++ b/go.sum @@ -38,10 +38,10 @@ cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3f dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= 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/K-Phoen/grabana v0.21.18 h1:Ph+C7eEcRuv58rueiVEOHb4aeV+v0ybTeA0WrspfKVY= -github.com/K-Phoen/grabana v0.21.18/go.mod h1:vbASQt9UiQhX4lC3/opLpJMJ8m+hsTUU2FwkQMytHK4= -github.com/K-Phoen/sdk v0.12.2 h1:0QofDlKE+lloyBOzhjEEMW21061zts/WIpfpQ5NLLAs= -github.com/K-Phoen/sdk v0.12.2/go.mod h1:qmM0wO23CtoDux528MXPpYvS4XkRWkWX6rvX9Za8EVU= +github.com/K-Phoen/grabana v0.21.19 h1:tJjRO8nN9JrFjLoQGtOB9P5ILoqENZZGAtt3nK+Ry2Y= +github.com/K-Phoen/grabana v0.21.19/go.mod h1:B7gxVxacQUgHWmgqduf4WPZoKYHO1mvZnRVCoyQiwdw= +github.com/K-Phoen/sdk v0.12.3 h1:ScutEQASc9VEKJCm3OjIMD82BIS9B2XtNg3gEf6Gs+M= +github.com/K-Phoen/sdk v0.12.3/go.mod h1:qmM0wO23CtoDux528MXPpYvS4XkRWkWX6rvX9Za8EVU= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= diff --git a/vendor/github.com/K-Phoen/grabana/alert/queries/stackdriver/stackdriver.go b/vendor/github.com/K-Phoen/grabana/alert/queries/stackdriver/stackdriver.go index 06cbc56a..79ac0567 100644 --- a/vendor/github.com/K-Phoen/grabana/alert/queries/stackdriver/stackdriver.go +++ b/vendor/github.com/K-Phoen/grabana/alert/queries/stackdriver/stackdriver.go @@ -146,6 +146,13 @@ func Legend(legend string) Option { } } +// Project defines the GCP project to use for this target. +func Project(project string) Option { + return func(stackdriver *Stackdriver) { + stackdriver.Builder.Model.MetricQuery.ProjectName = project + } +} + // Aggregation defines how the time series will be aggregated. func Aggregation(reducer Reducer) Option { return func(stackdriver *Stackdriver) { diff --git a/vendor/github.com/K-Phoen/grabana/decoder/alert_targets.go b/vendor/github.com/K-Phoen/grabana/decoder/alert_targets.go index 37ad3f7b..3dd0cf48 100644 --- a/vendor/github.com/K-Phoen/grabana/decoder/alert_targets.go +++ b/vendor/github.com/K-Phoen/grabana/decoder/alert_targets.go @@ -123,6 +123,7 @@ type AlertStackdriver struct { Ref string `yaml:",omitempty"` Lookback string `yaml:",omitempty"` + Project string `yaml:",omitempty"` Type string Metric string Filters StackdriverAlertFilters `yaml:",omitempty"` @@ -195,6 +196,10 @@ func (t AlertStackdriver) targetOptions() ([]stackdriver.Option, error) { opts = append(opts, stackdriver.GroupBys(t.GroupBy...)) } + if t.Project != "" { + opts = append(opts, stackdriver.Project(t.Project)) + } + if t.Aggregation != "" { opt, err := t.aggregation() if err != nil { diff --git a/vendor/github.com/K-Phoen/sdk/alert.go b/vendor/github.com/K-Phoen/sdk/alert.go index 08002adb..f8996580 100644 --- a/vendor/github.com/K-Phoen/sdk/alert.go +++ b/vendor/github.com/K-Phoen/sdk/alert.go @@ -74,6 +74,7 @@ type AlertModel struct { } type StackdriverAlertQuery struct { + ProjectName string `json:"projectName,omitempty"` AlignOptions []StackdriverAlignOptions `json:"alignOptions,omitempty"` AliasBy string `json:"aliasBy,omitempty"` MetricType string `json:"metricType,omitempty"` diff --git a/vendor/modules.txt b/vendor/modules.txt index a362e495..aea0b183 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,4 +1,4 @@ -# github.com/K-Phoen/grabana v0.21.18 +# github.com/K-Phoen/grabana v0.21.19 ## explicit; go 1.19 github.com/K-Phoen/grabana github.com/K-Phoen/grabana/alert @@ -51,7 +51,7 @@ github.com/K-Phoen/grabana/variable/datasource github.com/K-Phoen/grabana/variable/interval github.com/K-Phoen/grabana/variable/query github.com/K-Phoen/grabana/variable/text -# github.com/K-Phoen/sdk v0.12.2 +# github.com/K-Phoen/sdk v0.12.3 ## explicit; go 1.19 github.com/K-Phoen/sdk # github.com/beorn7/perks v1.0.1