Skip to content

Commit

Permalink
Use sdk v0.13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
K-Phoen committed Apr 11, 2024
1 parent 0721de3 commit 5ac0a14
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ go 1.19

require (
github.com/K-Phoen/jennifer v0.0.0-20230811102814-e6c78cf40086
github.com/K-Phoen/sdk v0.12.4
github.com/K-Phoen/sdk v0.13.0
github.com/blang/semver v3.5.1+incompatible
github.com/invopop/jsonschema v0.12.0
github.com/prometheus/common v0.45.0
github.com/rhysd/go-github-selfupdate v1.2.3
github.com/spf13/cobra v1.8.0
Expand All @@ -26,7 +27,6 @@ require (
github.com/gosimple/unidecode v1.0.1 // indirect
github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/invopop/jsonschema v0.12.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
github.com/K-Phoen/jennifer v0.0.0-20230811102814-e6c78cf40086 h1:cvgm5R+2OIaCzMqyA8YAHuybHEbdvBIC3OAziNiMbEU=
github.com/K-Phoen/jennifer v0.0.0-20230811102814-e6c78cf40086/go.mod h1:rm3gx5yYxh/Q3ynk+qaNoN6nQiII0Vn/uz46bIgj0P0=
github.com/K-Phoen/sdk v0.12.4 h1:j2EYuBJm3zDTD0fGKACVFWxAXtkR0q5QzfVqxmHSeGQ=
github.com/K-Phoen/sdk v0.12.4/go.mod h1:qmM0wO23CtoDux528MXPpYvS4XkRWkWX6rvX9Za8EVU=
github.com/K-Phoen/sdk v0.13.0 h1:eMJWVekp0iFBJO5dCyKHWxMDow4EFSy2DURy46+b/sk=
github.com/K-Phoen/sdk v0.13.0/go.mod h1:qmM0wO23CtoDux528MXPpYvS4XkRWkWX6rvX9Za8EVU=
github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk=
github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg=
github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ=
Expand Down
2 changes: 1 addition & 1 deletion target/cloudmonitoring/mql.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func NewMQL(projectName, query string, options ...MQLOption) *MQL {
mql := &MQL{
target: &sdk.Target{
QueryType: "timeSeriesQuery",
TimeSeriesQuery: &sdk.StackdriverTimeSeriesQuery{
TimeSeriesQuery: &sdk.GCMTimeSeriesQuery{
ProjectName: projectName,
Query: query,
},
Expand Down
4 changes: 2 additions & 2 deletions target/cloudmonitoring/promql.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ func NewPromQL(projectName, expr string, options ...PromQLOption) *PromQL {
QueryType: "promQL",
// For some reason I can't explain, Grafana seems to require TimeSeriesQuery to be set
// when we're making a promQL query.
TimeSeriesQuery: &sdk.StackdriverTimeSeriesQuery{
TimeSeriesQuery: &sdk.GCMTimeSeriesQuery{
ProjectName: projectName,
},
PromQLQuery: &sdk.StackdriverPromQLQuery{
PromQLQuery: &sdk.GCMPromQLQuery{
ProjectName: projectName,
Expr: expr,
Step: "10s",
Expand Down
8 changes: 7 additions & 1 deletion target/cloudmonitoring/slo.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ func SLORef(id, name string) SLOOption {
}
}

func Goal(goal float64) SLOOption {
return func(s *SLO) {
s.target.SLOQuery.Goal = &goal
}
}

func LookbackPeriod(period string) SLOOption {
return func(s *SLO) {
s.target.SLOQuery.LookbackPeriod = period
Expand All @@ -52,7 +58,7 @@ func NewSLO(projectName string, options ...SLOOption) *SLO {
slo := &SLO{
target: &sdk.Target{
QueryType: "slo",
SLOQuery: &sdk.StackdriverSLOQuery{
SLOQuery: &sdk.GCMSLOQuery{
ProjectName: projectName,
},
},
Expand Down
2 changes: 1 addition & 1 deletion target/cloudmonitoring/timeseries.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func NewTimeSeries(projectName, metricType string, options ...TimeSeriesOption)
cloudMonitoring := &TimeSeries{
target: &sdk.Target{
QueryType: "timeSeriesList",
TimeSeriesList: &sdk.StackdriverTimeSeriesList{
TimeSeriesList: &sdk.GCMTimeSeriesList{
ProjectName: projectName,
Filters: []string{
"metric.type", string(FilterOperatorEqual), metricType,
Expand Down

0 comments on commit 5ac0a14

Please sign in to comment.