Chore: Upgrade Go version to 1.19.1 (backport) (#55733)
Upgrades the version of Go used to build Grafana v9.1.x to 1.19.1. Backport of Chore: Upgrade Go to 1.19.1 #54902 Backport of Chore: Update swagger to v0.30.2 #55159
This commit is contained in:
+9
-9
@@ -29,17 +29,17 @@ $(DRONE): $(BINGO_DIR)/drone.mod
|
||||
@echo "(re)installing $(GOBIN)/drone-v1.5.0"
|
||||
@cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=drone.mod -o=$(GOBIN)/drone-v1.5.0 "github.com/drone/drone-cli/drone"
|
||||
|
||||
SWAGGER := $(GOBIN)/swagger-v0.29.0
|
||||
$(SWAGGER): $(BINGO_DIR)/swagger.mod
|
||||
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
|
||||
@echo "(re)installing $(GOBIN)/swagger-v0.29.0"
|
||||
@cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=swagger.mod -o=$(GOBIN)/swagger-v0.29.0 "github.com/go-swagger/go-swagger/cmd/swagger"
|
||||
|
||||
GOLANGCI_LINT := $(GOBIN)/golangci-lint-v1.40.1
|
||||
GOLANGCI_LINT := $(GOBIN)/golangci-lint-v1.49.0
|
||||
$(GOLANGCI_LINT): $(BINGO_DIR)/golangci-lint.mod
|
||||
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
|
||||
@echo "(re)installing $(GOBIN)/golangci-lint-v1.40.1"
|
||||
@cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=golangci-lint.mod -o=$(GOBIN)/golangci-lint-v1.40.1 "github.com/golangci/golangci-lint/cmd/golangci-lint"
|
||||
@echo "(re)installing $(GOBIN)/golangci-lint-v1.49.0"
|
||||
@cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=golangci-lint.mod -o=$(GOBIN)/golangci-lint-v1.49.0 "github.com/golangci/golangci-lint/cmd/golangci-lint"
|
||||
|
||||
SWAGGER := $(GOBIN)/swagger-v0.30.2
|
||||
$(SWAGGER): $(BINGO_DIR)/swagger.mod
|
||||
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
|
||||
@echo "(re)installing $(GOBIN)/swagger-v0.30.2"
|
||||
@cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=swagger.mod -o=$(GOBIN)/swagger-v0.30.2 "github.com/go-swagger/go-swagger/cmd/swagger"
|
||||
|
||||
WIRE := $(GOBIN)/wire-v0.5.0
|
||||
$(WIRE): $(BINGO_DIR)/wire.mod
|
||||
|
||||
+171
-2
@@ -1,5 +1,174 @@
|
||||
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT
|
||||
|
||||
go 1.17
|
||||
go 1.19
|
||||
|
||||
require github.com/golangci/golangci-lint v1.40.1 // cmd/golangci-lint
|
||||
require github.com/golangci/golangci-lint v1.49.0 // cmd/golangci-lint
|
||||
|
||||
require (
|
||||
4d63.com/gochecknoglobals v0.1.0 // indirect
|
||||
github.com/Antonboom/errname v0.1.7 // indirect
|
||||
github.com/Antonboom/nilnil v0.1.1 // indirect
|
||||
github.com/BurntSushi/toml v1.2.0 // indirect
|
||||
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect
|
||||
github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0 // indirect
|
||||
github.com/Masterminds/semver v1.5.0 // indirect
|
||||
github.com/OpenPeeDeeP/depguard v1.1.0 // indirect
|
||||
github.com/alexkohler/prealloc v1.0.0 // indirect
|
||||
github.com/alingse/asasalint v0.0.11 // indirect
|
||||
github.com/ashanbrown/forbidigo v1.3.0 // indirect
|
||||
github.com/ashanbrown/makezero v1.1.1 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/bkielbasa/cyclop v1.2.0 // indirect
|
||||
github.com/blizzy78/varnamelen v0.8.0 // indirect
|
||||
github.com/bombsimon/wsl/v3 v3.3.0 // indirect
|
||||
github.com/breml/bidichk v0.2.3 // indirect
|
||||
github.com/breml/errchkjson v0.3.0 // indirect
|
||||
github.com/butuzov/ireturn v0.1.1 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
||||
github.com/charithe/durationcheck v0.0.9 // indirect
|
||||
github.com/chavacava/garif v0.0.0-20220630083739-93517212f375 // indirect
|
||||
github.com/curioswitch/go-reassign v0.1.2 // indirect
|
||||
github.com/daixiang0/gci v0.6.3 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/denis-tingaikin/go-header v0.4.3 // indirect
|
||||
github.com/esimonov/ifshort v1.0.4 // indirect
|
||||
github.com/ettle/strcase v0.1.1 // indirect
|
||||
github.com/fatih/color v1.13.0 // indirect
|
||||
github.com/fatih/structtag v1.2.0 // indirect
|
||||
github.com/firefart/nonamedreturns v1.0.4 // indirect
|
||||
github.com/fsnotify/fsnotify v1.5.4 // indirect
|
||||
github.com/fzipp/gocyclo v0.6.0 // indirect
|
||||
github.com/go-critic/go-critic v0.6.4 // indirect
|
||||
github.com/go-toolsmith/astcast v1.0.0 // indirect
|
||||
github.com/go-toolsmith/astcopy v1.0.1 // indirect
|
||||
github.com/go-toolsmith/astequal v1.0.2 // indirect
|
||||
github.com/go-toolsmith/astfmt v1.0.0 // indirect
|
||||
github.com/go-toolsmith/astp v1.0.0 // indirect
|
||||
github.com/go-toolsmith/strparse v1.0.0 // indirect
|
||||
github.com/go-toolsmith/typep v1.0.2 // indirect
|
||||
github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b // indirect
|
||||
github.com/gobwas/glob v0.2.3 // indirect
|
||||
github.com/gofrs/flock v0.8.1 // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 // indirect
|
||||
github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect
|
||||
github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe // indirect
|
||||
github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a // indirect
|
||||
github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 // indirect
|
||||
github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca // indirect
|
||||
github.com/golangci/misspell v0.3.5 // indirect
|
||||
github.com/golangci/revgrep v0.0.0-20220804021717-745bb2f7c2e6 // indirect
|
||||
github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect
|
||||
github.com/google/go-cmp v0.5.8 // indirect
|
||||
github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8 // indirect
|
||||
github.com/gostaticanalysis/analysisutil v0.7.1 // indirect
|
||||
github.com/gostaticanalysis/comment v1.4.2 // indirect
|
||||
github.com/gostaticanalysis/forcetypeassert v0.1.0 // indirect
|
||||
github.com/gostaticanalysis/nilerr v0.1.1 // indirect
|
||||
github.com/hashicorp/errwrap v1.0.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/go-version v1.6.0 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/hexops/gotextdiff v1.0.3 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.0.0 // indirect
|
||||
github.com/jgautheron/goconst v1.5.1 // indirect
|
||||
github.com/jingyugao/rowserrcheck v1.1.1 // indirect
|
||||
github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect
|
||||
github.com/julz/importas v0.1.0 // indirect
|
||||
github.com/kisielk/errcheck v1.6.2 // indirect
|
||||
github.com/kisielk/gotool v1.0.0 // indirect
|
||||
github.com/kulti/thelper v0.6.3 // indirect
|
||||
github.com/kunwardeep/paralleltest v1.0.6 // indirect
|
||||
github.com/kyoh86/exportloopref v0.1.8 // indirect
|
||||
github.com/ldez/gomoddirectives v0.2.3 // indirect
|
||||
github.com/ldez/tagliatelle v0.3.1 // indirect
|
||||
github.com/leonklingele/grouper v1.1.0 // indirect
|
||||
github.com/lufeee/execinquery v1.2.1 // indirect
|
||||
github.com/magiconair/properties v1.8.6 // indirect
|
||||
github.com/maratori/testpackage v1.1.0 // indirect
|
||||
github.com/matoous/godox v0.0.0-20210227103229-6504466cf951 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.16 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.9 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
|
||||
github.com/mbilski/exhaustivestruct v1.2.0 // indirect
|
||||
github.com/mgechev/revive v1.2.3 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/moricho/tparallel v0.2.1 // indirect
|
||||
github.com/nakabonne/nestif v0.3.1 // indirect
|
||||
github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 // indirect
|
||||
github.com/nishanths/exhaustive v0.8.1 // indirect
|
||||
github.com/nishanths/predeclared v0.2.2 // indirect
|
||||
github.com/olekukonko/tablewriter v0.0.5 // indirect
|
||||
github.com/pelletier/go-toml v1.9.5 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.0.2 // indirect
|
||||
github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/polyfloyd/go-errorlint v1.0.2 // indirect
|
||||
github.com/prometheus/client_golang v1.12.1 // indirect
|
||||
github.com/prometheus/client_model v0.2.0 // indirect
|
||||
github.com/prometheus/common v0.32.1 // indirect
|
||||
github.com/prometheus/procfs v0.7.3 // indirect
|
||||
github.com/quasilyte/go-ruleguard v0.3.17 // indirect
|
||||
github.com/quasilyte/gogrep v0.0.0-20220120141003-628d8b3623b5 // indirect
|
||||
github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 // indirect
|
||||
github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect
|
||||
github.com/ryancurrah/gomodguard v1.2.4 // indirect
|
||||
github.com/ryanrolds/sqlclosecheck v0.3.0 // indirect
|
||||
github.com/sanposhiho/wastedassign/v2 v2.0.6 // indirect
|
||||
github.com/sashamelentyev/interfacebloat v1.1.0 // indirect
|
||||
github.com/sashamelentyev/usestdlibvars v1.13.0 // indirect
|
||||
github.com/securego/gosec/v2 v2.13.1 // indirect
|
||||
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect
|
||||
github.com/sirupsen/logrus v1.9.0 // indirect
|
||||
github.com/sivchari/containedctx v1.0.2 // indirect
|
||||
github.com/sivchari/nosnakecase v1.7.0 // indirect
|
||||
github.com/sivchari/tenv v1.7.0 // indirect
|
||||
github.com/sonatard/noctx v0.0.1 // indirect
|
||||
github.com/sourcegraph/go-diff v0.6.1 // indirect
|
||||
github.com/spf13/afero v1.8.2 // indirect
|
||||
github.com/spf13/cast v1.5.0 // indirect
|
||||
github.com/spf13/cobra v1.5.0 // indirect
|
||||
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/spf13/viper v1.12.0 // indirect
|
||||
github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect
|
||||
github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect
|
||||
github.com/stretchr/objx v0.4.0 // indirect
|
||||
github.com/stretchr/testify v1.8.0 // indirect
|
||||
github.com/subosito/gotenv v1.4.0 // indirect
|
||||
github.com/sylvia7788/contextcheck v1.0.6 // indirect
|
||||
github.com/tdakkota/asciicheck v0.1.1 // indirect
|
||||
github.com/tetafro/godot v1.4.11 // indirect
|
||||
github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144 // indirect
|
||||
github.com/timonwong/logrlint v0.1.0 // indirect
|
||||
github.com/tomarrell/wrapcheck/v2 v2.6.2 // indirect
|
||||
github.com/tommy-muehle/go-mnd/v2 v2.5.0 // indirect
|
||||
github.com/ultraware/funlen v0.0.3 // indirect
|
||||
github.com/ultraware/whitespace v0.0.5 // indirect
|
||||
github.com/uudashr/gocognit v1.0.6 // indirect
|
||||
github.com/yagipy/maintidx v1.0.0 // indirect
|
||||
github.com/yeya24/promlinter v0.2.0 // indirect
|
||||
gitlab.com/bosi/decorder v0.2.3 // indirect
|
||||
go.uber.org/atomic v1.7.0 // indirect
|
||||
go.uber.org/multierr v1.6.0 // indirect
|
||||
go.uber.org/zap v1.17.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
|
||||
golang.org/x/exp/typeparams v0.0.0-20220613132600-b0d781184e0d // indirect
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab // indirect
|
||||
golang.org/x/text v0.3.7 // indirect
|
||||
golang.org/x/tools v0.1.12 // indirect
|
||||
google.golang.org/protobuf v1.28.0 // indirect
|
||||
gopkg.in/ini.v1 v1.66.6 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
honnef.co/go/tools v0.3.3 // indirect
|
||||
mvdan.cc/gofumpt v0.3.1 // indirect
|
||||
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect
|
||||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect
|
||||
mvdan.cc/unparam v0.0.0-20220706161116-678bad134442 // indirect
|
||||
)
|
||||
|
||||
+322
-608
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -2,4 +2,4 @@ module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT
|
||||
|
||||
go 1.18
|
||||
|
||||
require github.com/go-swagger/go-swagger v0.29.0 // cmd/swagger
|
||||
require github.com/go-swagger/go-swagger v0.30.2 // cmd/swagger
|
||||
|
||||
@@ -1,48 +1,86 @@
|
||||
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
|
||||
github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc=
|
||||
github.com/Masterminds/sprig/v3 v3.2.2 h1:17jRggJu518dr3QaafizSXOjKYp94wKfABxUmyxvxX8=
|
||||
github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI=
|
||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=
|
||||
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d h1:Byv0BzEl3/e6D5CLfI0j/7hiIEtvGVFPCZ7Ei2oq8iQ=
|
||||
github.com/felixge/httpsnoop v1.0.2 h1:+nS9g82KMXccJ/wp0zyRW9ZBHFETmMGtkk+2CTTrW4o=
|
||||
github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk=
|
||||
github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI=
|
||||
github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI=
|
||||
github.com/go-openapi/analysis v0.21.2 h1:hXFrOYFHUAMQdu6zwAiKKJHJQ8kqZs1ux/ru1P1wLJU=
|
||||
github.com/go-openapi/analysis v0.21.4 h1:ZDFLvSNxpDaomuCueM0BlSXxpANBlFYiBvr+GXrvIHc=
|
||||
github.com/go-openapi/errors v0.20.2 h1:dxy7PGTqEh94zj2E3h1cUmQQWiM1+aeCROfAr02EmK8=
|
||||
github.com/go-openapi/errors v0.20.3 h1:rz6kiC84sqNQoqrtulzaL/VERgkoCyB6WdEkc2ujzUc=
|
||||
github.com/go-openapi/inflect v0.19.0 h1:9jCH9scKIbHeV9m12SmPilScz6krDxKRasNNSNPXu/4=
|
||||
github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY=
|
||||
github.com/go-openapi/jsonreference v0.19.6 h1:UBIxjkht+AWIgYzCDSv2GN+E/togfwXUJFRTWhl2Jjs=
|
||||
github.com/go-openapi/jsonreference v0.20.0 h1:MYlu0sBgChmCfJxxUKZ8g1cPWFOB37YSZqewK7OKeyA=
|
||||
github.com/go-openapi/loads v0.21.0 h1:jYtUO4wwP7psAweisP/MDoOpdzsYEESdoPcsWjHDR68=
|
||||
github.com/go-openapi/loads v0.21.2 h1:r2a/xFIYeZ4Qd2TnGpWDIQNcP80dIaZgf704za8enro=
|
||||
github.com/go-openapi/runtime v0.21.1 h1:/KIG00BzA2x2HRStX2tnhbqbQdPcFlkgsYCiNY20FZs=
|
||||
github.com/go-openapi/runtime v0.24.1 h1:Sml5cgQKGYQHF+M7yYSHaH1eOjvTykrddTE/KtQVjqo=
|
||||
github.com/go-openapi/spec v0.20.4 h1:O8hJrt0UMnhHcluhIdUgCLRWyM2x7QkBXRvOs7m+O1M=
|
||||
github.com/go-openapi/spec v0.20.7 h1:1Rlu/ZrOCCob0n+JKKJAWhNWMPW8bOZRg8FJaY+0SKI=
|
||||
github.com/go-openapi/strfmt v0.21.1 h1:G6s2t5V5kGCHLVbSdZ/6lI8Wm4OzoPFkc3/cjAsKQrM=
|
||||
github.com/go-openapi/strfmt v0.21.3 h1:xwhj5X6CjXEZZHMWy1zKJxvW9AfHC9pkyUjLvHtKG7o=
|
||||
github.com/go-openapi/swag v0.19.15 h1:D2NRCBzS9/pEY3gP9Nl8aDqGUcPFrwG2p+CNFrLyrCM=
|
||||
github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g=
|
||||
github.com/go-openapi/validate v0.20.3 h1:GZPPhhKSZrE8HjB4eEkoYAZmoWA4+tCemSgINH1/vKw=
|
||||
github.com/go-openapi/validate v0.22.0 h1:b0QecH6VslW/TxtpKgzpO1SNG7GU2FsaqKdP1E2T50Y=
|
||||
github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw=
|
||||
github.com/go-swagger/go-swagger v0.29.0 h1:z3YoZtLvS1Y8TE/PCat1VypcZxM0IgKLt0NvZxQyNl8=
|
||||
github.com/go-swagger/go-swagger v0.29.0/go.mod h1:Z4GJzI+bHKKkGB2Ji1rawpi3/ldXX8CkzGIa9HAC5EE=
|
||||
github.com/go-swagger/go-swagger v0.30.2 h1:23odPUyQZdkNFZZSBJ3mqYYcdh+LnuReEbdWN18OMRo=
|
||||
github.com/go-swagger/go-swagger v0.30.2/go.mod h1:neDPes8r8PCz2JPvHRDj8BTULLh4VJUt7n6MpQqxhHM=
|
||||
github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y=
|
||||
github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4=
|
||||
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
||||
github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw=
|
||||
github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU=
|
||||
github.com/jessevdk/go-flags v1.5.0 h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc=
|
||||
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
|
||||
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls=
|
||||
github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo=
|
||||
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
|
||||
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
|
||||
github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGgCcyj8cs=
|
||||
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||
github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
|
||||
github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4=
|
||||
github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM=
|
||||
github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8=
|
||||
github.com/pelletier/go-toml/v2 v2.0.1 h1:8e3L2cCQzLFi2CR4g7vGFuFxX7Jl1kKX8gW+iV0GUKU=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XFkP+Eg=
|
||||
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
|
||||
github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ=
|
||||
github.com/spf13/afero v1.8.0 h1:5MmtuhAgYeU6qpa7w7bP0dv6MBYuup0vekhSpSkoq60=
|
||||
github.com/spf13/afero v1.8.2 h1:xehSyVa0YnHWsJ49JFljMpg1HX19V6NDZ1fkm1Xznbo=
|
||||
github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA=
|
||||
github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w=
|
||||
github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/viper v1.10.1 h1:nuJZuYpG7gTj/XqiUwg8bA0cp1+M2mC3J4g5luUYBKk=
|
||||
github.com/spf13/viper v1.12.0 h1:CZ7eSOd3kZoaYDLbXnmzgQI5RlciuXBMA+18HwHRfZQ=
|
||||
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
|
||||
github.com/subosito/gotenv v1.3.0 h1:mjC+YW8QpAdXibNi+vNWgzmgBH4+5l5dCXv8cNysBLI=
|
||||
github.com/toqueteos/webbrowser v1.2.0 h1:tVP/gpK69Fx+qMJKsLE7TD8LuGWPnEV71wBN9rrstGQ=
|
||||
go.mongodb.org/mongo-driver v1.8.2 h1:8ssUXufb90ujcIvR6MyE1SchaNj0SFxsakiZgxIyrMk=
|
||||
go.mongodb.org/mongo-driver v1.10.1 h1:NujsPveKwHaWuKUer/ceo9DzEe7HIj1SlJ6uvXZG0S4=
|
||||
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 h1:Y/gsMcFOcR+6S6f3YeMKl5g+dZMEWqcz5Czj/GWYbkM=
|
||||
golang.org/x/mod v0.5.1 h1:OJxoQ/rynoF0dcCdI7cLPktw/hR2cueqYfjm43oqK38=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=
|
||||
golang.org/x/net v0.0.0-20220121210141-e204ce36a2ba h1:6u6sik+bn/y7vILcYkK3iwTBWN7WtBvB0+SZswQnbf8=
|
||||
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 h1:XfKQ4OlFl8okEOr5UvAqFRVj8pY/4yfcXrddB8qAbU0=
|
||||
golang.org/x/sys v0.0.0-20220829200755-d48e67d00261 h1:v6hYoSR9T5oet+pMXwUWkbiVqx/63mlHjefrHmxwfeY=
|
||||
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
|
||||
golang.org/x/tools v0.1.8 h1:P1HhGGuLW4aAclzjtmJdf0mJOjVUZUzOTqkAkWL+l6w=
|
||||
golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
||||
gopkg.in/ini.v1 v1.66.3 h1:jRskFVxYaMGAMUbN0UZ7niA9gzL9B49DOqE78vg0k3w=
|
||||
gopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
|
||||
@@ -12,9 +12,9 @@ BRA="${GOBIN}/bra-v0.0.0-20200517080246-1e3013ecaff8"
|
||||
|
||||
DRONE="${GOBIN}/drone-v1.5.0"
|
||||
|
||||
SWAGGER="${GOBIN}/swagger-v0.29.0"
|
||||
GOLANGCI_LINT="${GOBIN}/golangci-lint-v1.49.0"
|
||||
|
||||
GOLANGCI_LINT="${GOBIN}/golangci-lint-v1.40.1"
|
||||
SWAGGER="${GOBIN}/swagger-v0.30.2"
|
||||
|
||||
WIRE="${GOBIN}/wire-v0.5.0"
|
||||
|
||||
|
||||
+227
-227
File diff suppressed because it is too large
Load Diff
@@ -22,13 +22,12 @@ rules = "pkg/ruleguard.rules.go"
|
||||
disable-all = true
|
||||
enable = [
|
||||
"bodyclose",
|
||||
"deadcode",
|
||||
"depguard",
|
||||
"dogsled",
|
||||
"errcheck",
|
||||
# "gochecknoinits",
|
||||
"goconst",
|
||||
"gocritic",
|
||||
# "gocritic", # Temporarily disabled on 2022-09-09, running into weird bug "ruleguard: execution error: used Run() with an empty rule set; forgot to call Load() first?"
|
||||
"goimports",
|
||||
"goprintffuncname",
|
||||
"gosec",
|
||||
@@ -40,12 +39,10 @@ enable = [
|
||||
"rowserrcheck",
|
||||
"exportloopref",
|
||||
"staticcheck",
|
||||
"structcheck",
|
||||
"stylecheck",
|
||||
"typecheck",
|
||||
"unconvert",
|
||||
"unused",
|
||||
"varcheck",
|
||||
"whitespace",
|
||||
"gocyclo",
|
||||
"exhaustive",
|
||||
@@ -74,6 +71,13 @@ text = "ST1003"
|
||||
linters = ["stylecheck"]
|
||||
text = "ST1001"
|
||||
|
||||
# Enable when appropriate
|
||||
# strings.Title has been deprecated since Go 1.18 and an alternative has been available since Go 1.0: The rule Title uses for word boundaries does not handle Unicode punctuation properly.
|
||||
# Use golang.org/x/text/cases instead.
|
||||
[[issues.exclude-rules]]
|
||||
linters = ["staticcheck"]
|
||||
text = "SA1019"
|
||||
|
||||
[[issues.exclude-rules]]
|
||||
linters = ["gosec"]
|
||||
text = "G108"
|
||||
+1
-1
@@ -20,7 +20,7 @@ COPY emails emails
|
||||
ENV NODE_ENV production
|
||||
RUN yarn build
|
||||
|
||||
FROM golang:1.17.12-alpine3.15 as go-builder
|
||||
FROM golang:1.19.1-alpine3.15 as go-builder
|
||||
|
||||
RUN apk add --no-cache gcc g++ make
|
||||
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ COPY emails emails
|
||||
ENV NODE_ENV production
|
||||
RUN yarn build
|
||||
|
||||
FROM golang:1.17.12 AS go-builder
|
||||
FROM golang:1.19.1 AS go-builder
|
||||
|
||||
WORKDIR /src/grafana
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ test: test-go test-js ## Run all tests.
|
||||
golangci-lint: $(GOLANGCI_LINT)
|
||||
@echo "lint via golangci-lint"
|
||||
$(GOLANGCI_LINT) run \
|
||||
--config ./conf/.golangci.toml \
|
||||
--config .golangci.toml \
|
||||
$(GO_FILES)
|
||||
|
||||
lint-go: golangci-lint ## Run all code checks for backend. You can use GO_FILES to specify exact files to check
|
||||
|
||||
@@ -59,7 +59,7 @@ func themaTestableDashboards() (map[string][]byte, error) {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close() // nolint: errcheck
|
||||
defer f.Close() //nolint:errcheck
|
||||
|
||||
b, err := io.ReadAll(f)
|
||||
if err != nil {
|
||||
|
||||
+1
-1
@@ -342,7 +342,7 @@ func (hs *HTTPServer) GetAlertNotificationByID(c *models.ReqContext) response.Re
|
||||
|
||||
// swagger:route GET /alert-notifications/uid/{notification_channel_uid} legacy_alerts_notification_channels getAlertNotificationChannelByUID
|
||||
//
|
||||
// Get notification channel by UID
|
||||
// Get notification channel by UID.
|
||||
//
|
||||
// Returns the notification channel given the notification channel UID.
|
||||
//
|
||||
|
||||
@@ -289,7 +289,7 @@ func (hs *HTTPServer) UpdateAnnotation(c *models.ReqContext) response.Response {
|
||||
|
||||
// swagger:route PATCH /annotations/{annotation_id} annotations patchAnnotation
|
||||
//
|
||||
// Patch Annotation
|
||||
// Patch Annotation.
|
||||
//
|
||||
// Updates one or more properties of an annotation that matches the specified ID.
|
||||
// This operation currently supports updating of the `text`, `tags`, `time` and `timeEnd` properties.
|
||||
|
||||
+20
-19
@@ -3,29 +3,30 @@
|
||||
// The Grafana backend exposes an HTTP API, the same API is used by the frontend to do
|
||||
// everything from saving dashboards, creating users and updating data sources.
|
||||
//
|
||||
// Schemes: http, https
|
||||
// BasePath: /api
|
||||
// Version: 0.0.1
|
||||
// License: GNU Affero General Public License v3.0 https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
// Contact: Grafana Labs<hello@grafana.com> https://grafana.com
|
||||
// Schemes: http, https
|
||||
// BasePath: /api
|
||||
// Version: 0.0.1
|
||||
// License: GNU Affero General Public License v3.0 https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
// Contact: Grafana Labs<hello@grafana.com> https://grafana.com
|
||||
//
|
||||
// Consumes:
|
||||
// - application/json
|
||||
// Consumes:
|
||||
// - application/json
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Security:
|
||||
// - basic:
|
||||
// - api_key:
|
||||
// Security:
|
||||
// - basic:
|
||||
// - api_key:
|
||||
//
|
||||
// SecurityDefinitions:
|
||||
// basic:
|
||||
// type: basic
|
||||
// api_key:
|
||||
// type: apiKey
|
||||
// name: Authorization
|
||||
// in: header
|
||||
// SecurityDefinitions:
|
||||
// basic:
|
||||
// type: basic
|
||||
//
|
||||
// api_key:
|
||||
// type: apiKey
|
||||
// name: Authorization
|
||||
// in: header
|
||||
//
|
||||
// swagger:meta
|
||||
package api
|
||||
|
||||
+1
-1
@@ -94,7 +94,7 @@ func (hs *HTTPServer) DeleteAPIKey(c *models.ReqContext) response.Response {
|
||||
//
|
||||
// Creates an API key.
|
||||
//
|
||||
// Will return details of the created API key
|
||||
// Will return details of the created API key.
|
||||
//
|
||||
// Responses:
|
||||
// 200: postAPIkeyResponse
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ func (hs *HTTPServer) handleQueryMetricsError(err error) *response.NormalRespons
|
||||
// QueryMetricsV2 returns query metrics.
|
||||
// swagger:route POST /ds/query ds queryMetricsWithExpressions
|
||||
//
|
||||
// DataSource query metrics with expressions
|
||||
// DataSource query metrics with expressions.
|
||||
//
|
||||
// If you are running Grafana Enterprise and have Fine-grained access control enabled
|
||||
// you need to have a permission with action: `datasources:query`.
|
||||
|
||||
+2
-2
@@ -17,7 +17,7 @@ import (
|
||||
|
||||
// swagger:route GET /org org getCurrentOrg
|
||||
//
|
||||
// Get current Organization
|
||||
// Get current Organization.
|
||||
//
|
||||
// Responses:
|
||||
// 200: getCurrentOrgResponse
|
||||
@@ -300,7 +300,7 @@ func (hs *HTTPServer) DeleteOrgByID(c *models.ReqContext) response.Response {
|
||||
|
||||
// swagger:route GET /orgs orgs searchOrgs
|
||||
//
|
||||
// Search all Organizations
|
||||
// Search all Organizations.
|
||||
//
|
||||
// Security:
|
||||
// - basic:
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
|
||||
// swagger:route POST /org/users org addOrgUserToCurrentOrg
|
||||
//
|
||||
// Add a new user to the current organization
|
||||
// Add a new user to the current organization.
|
||||
//
|
||||
// Adds a global user to the current organization.
|
||||
//
|
||||
@@ -39,7 +39,7 @@ func (hs *HTTPServer) AddOrgUserToCurrentOrg(c *models.ReqContext) response.Resp
|
||||
|
||||
// swagger:route POST /orgs/{org_id}/users orgs addOrgUser
|
||||
//
|
||||
// Add a new user to the current organization
|
||||
// Add a new user to the current organization.
|
||||
//
|
||||
// Adds a global user to the current organization.
|
||||
//
|
||||
@@ -275,7 +275,7 @@ func (hs *HTTPServer) SearchOrgUsersWithPaging(c *models.ReqContext) response.Re
|
||||
|
||||
// swagger:route PATCH /org/users/{user_id} org updateOrgUserForCurrentOrg
|
||||
//
|
||||
// Updates the given user
|
||||
// Updates the given user.
|
||||
//
|
||||
// If you are running Grafana Enterprise and have Fine-grained access control enabled
|
||||
// you need to have a permission with action: `org.users.role:update` with scope `users:*`.
|
||||
@@ -349,7 +349,7 @@ func (hs *HTTPServer) updateOrgUserHelper(c *models.ReqContext, cmd models.Updat
|
||||
|
||||
// swagger:route DELETE /org/users/{user_id} org removeOrgUserForCurrentOrg
|
||||
//
|
||||
// Delete user in current organization
|
||||
// Delete user in current organization.
|
||||
//
|
||||
// If you are running Grafana Enterprise and have Fine-grained access control enabled
|
||||
// you need to have a permission with action: `org.users:remove` with scope `users:*`.
|
||||
@@ -375,7 +375,7 @@ func (hs *HTTPServer) RemoveOrgUserForCurrentOrg(c *models.ReqContext) response.
|
||||
|
||||
// swagger:route DELETE /orgs/{org_id}/users/{user_id} orgs removeOrgUser
|
||||
//
|
||||
// Delete user in current organization
|
||||
// Delete user in current organization.
|
||||
//
|
||||
// If you are running Grafana Enterprise and have Fine-grained access control enabled
|
||||
// you need to have a permission with action: `org.users:remove` with scope `users:*`.
|
||||
|
||||
@@ -19,7 +19,6 @@ func (hs *HTTPServer) GetCurrentOrgQuotas(c *models.ReqContext) response.Respons
|
||||
// Fetch Organization quota.
|
||||
//
|
||||
// If you are running Grafana Enterprise and have Fine-grained access control enabled, you need to have a permission with action `orgs.quotas:read` and scope `org:id:1` (orgIDScope).
|
||||
//list
|
||||
// Responses:
|
||||
// 200: getQuotaResponse
|
||||
// 401: unauthorisedError
|
||||
|
||||
+1
-1
@@ -131,7 +131,7 @@ func (hs *HTTPServer) searchHitsWithMetadata(c *models.ReqContext, hits models.H
|
||||
|
||||
// swagger:route GET /search/sorting search listSortOptions
|
||||
//
|
||||
// List search sorting options
|
||||
// List search sorting options.
|
||||
//
|
||||
// Responses:
|
||||
// 200: listSortOptionsResponse
|
||||
|
||||
@@ -97,6 +97,10 @@ func RunServer(opt ServerOptions) int {
|
||||
fmt.Println("diagnostics: pprof profiling enabled", "addr", profileDiagnostics.addr, "port", profileDiagnostics.port)
|
||||
runtime.SetBlockProfileRate(1)
|
||||
go func() {
|
||||
// TODO: We should enable the linter and fix G114 here.
|
||||
// G114: Use of net/http serve function that has no support for setting timeouts (gosec)
|
||||
//
|
||||
//nolint:gosec
|
||||
err := http.ListenAndServe(fmt.Sprintf("%s:%d", profileDiagnostics.addr, profileDiagnostics.port), nil)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
||||
@@ -256,14 +256,15 @@ func tryget(headers map[string][]string, key string) string {
|
||||
|
||||
/*
|
||||
Based on Azure docs:
|
||||
Link: http://msdn.microsoft.com/en-us/library/windowsazure/dd179428.aspx#Constructing_Element
|
||||
|
||||
1) Retrieve all headers for the resource that begin with x-ms-, including the x-ms-date header.
|
||||
2) Convert each HTTP header name to lowercase.
|
||||
3) Sort the headers lexicographically by header name, in ascending order. Note that each header may appear only once in the string.
|
||||
4) Unfold the string by replacing any breaking white space with a single space.
|
||||
5) Trim any white space around the colon in the header.
|
||||
6) Finally, append a new line character to each canonicalized header in the resulting list. Construct the CanonicalizedHeaders string by concatenating all headers in this list into a single string.
|
||||
Link: http://msdn.microsoft.com/en-us/library/windowsazure/dd179428.aspx#Constructing_Element
|
||||
|
||||
1) Retrieve all headers for the resource that begin with x-ms-, including the x-ms-date header.
|
||||
2) Convert each HTTP header name to lowercase.
|
||||
3) Sort the headers lexicographically by header name, in ascending order. Note that each header may appear only once in the string.
|
||||
4) Unfold the string by replacing any breaking white space with a single space.
|
||||
5) Trim any white space around the colon in the header.
|
||||
6) Finally, append a new line character to each canonicalized header in the resulting list. Construct the CanonicalizedHeaders string by concatenating all headers in this list into a single string.
|
||||
*/
|
||||
func (a *Auth) canonicalizedHeaders(req *http.Request) string {
|
||||
var buffer bytes.Buffer
|
||||
@@ -288,25 +289,26 @@ func (a *Auth) canonicalizedHeaders(req *http.Request) string {
|
||||
|
||||
/*
|
||||
Based on Azure docs
|
||||
Link: http://msdn.microsoft.com/en-us/library/windowsazure/dd179428.aspx#Constructing_Element
|
||||
|
||||
1) Beginning with an empty string (""), append a forward slash (/), followed by the name of the account that owns the resource being accessed.
|
||||
2) Append the resource's encoded URI path, without any query parameters.
|
||||
3) Retrieve all query parameters on the resource URI, including the comp parameter if it exists.
|
||||
4) Convert all parameter names to lowercase.
|
||||
5) Sort the query parameters lexicographically by parameter name, in ascending order.
|
||||
6) URL-decode each query parameter name and value.
|
||||
7) Append each query parameter name and value to the string in the following format, making sure to include the colon (:) between the name and the value:
|
||||
parameter-name:parameter-value
|
||||
Link: http://msdn.microsoft.com/en-us/library/windowsazure/dd179428.aspx#Constructing_Element
|
||||
|
||||
8) If a query parameter has more than one value, sort all values lexicographically, then include them in a comma-separated list:
|
||||
parameter-name:parameter-value-1,parameter-value-2,parameter-value-n
|
||||
1. Beginning with an empty string (""), append a forward slash (/), followed by the name of the account that owns the resource being accessed.
|
||||
2. Append the resource's encoded URI path, without any query parameters.
|
||||
3. Retrieve all query parameters on the resource URI, including the comp parameter if it exists.
|
||||
4. Convert all parameter names to lowercase.
|
||||
5. Sort the query parameters lexicographically by parameter name, in ascending order.
|
||||
6. URL-decode each query parameter name and value.
|
||||
7. Append each query parameter name and value to the string in the following format, making sure to include the colon (:) between the name and the value:
|
||||
parameter-name:parameter-value
|
||||
|
||||
8. If a query parameter has more than one value, sort all values lexicographically, then include them in a comma-separated list:
|
||||
parameter-name:parameter-value-1,parameter-value-2,parameter-value-n
|
||||
|
||||
9) Append a new line character (\n) after each name-value pair.
|
||||
|
||||
Rules:
|
||||
1) Avoid using the new line character (\n) in values for query parameters. If it must be used, ensure that it does not affect the format of the canonicalized resource string.
|
||||
2) Avoid using commas in query parameter values.
|
||||
1. Avoid using the new line character (\n) in values for query parameters. If it must be used, ensure that it does not affect the format of the canonicalized resource string.
|
||||
2. Avoid using commas in query parameter values.
|
||||
*/
|
||||
func (a *Auth) canonicalizedResource(req *http.Request) string {
|
||||
var buffer bytes.Buffer
|
||||
|
||||
@@ -6,6 +6,13 @@ package logproto
|
||||
import (
|
||||
context "context"
|
||||
fmt "fmt"
|
||||
io "io"
|
||||
math "math"
|
||||
math_bits "math/bits"
|
||||
reflect "reflect"
|
||||
strings "strings"
|
||||
time "time"
|
||||
|
||||
_ "github.com/gogo/protobuf/gogoproto"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
github_com_gogo_protobuf_types "github.com/gogo/protobuf/types"
|
||||
@@ -13,12 +20,6 @@ import (
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
io "io"
|
||||
math "math"
|
||||
math_bits "math/bits"
|
||||
reflect "reflect"
|
||||
strings "strings"
|
||||
time "time"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
|
||||
@@ -108,7 +108,7 @@ func (m *Entry) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
//nolint: gocyclo
|
||||
//nolint:gocyclo
|
||||
func (m *Stream) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
@@ -248,7 +248,7 @@ func (m *Stream) Unmarshal(dAtA []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
//nolint: gocyclo
|
||||
//nolint:gocyclo
|
||||
func (m *Entry) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
|
||||
@@ -154,7 +154,8 @@ func (j *Json) Del(key string) {
|
||||
// for `key` in its `map` representation
|
||||
//
|
||||
// useful for chaining operations (to traverse a nested JSON):
|
||||
// js.Get("top_level").Get("dict").Get("value").Int()
|
||||
//
|
||||
// js.Get("top_level").Get("dict").Get("value").Int()
|
||||
func (j *Json) Get(key string) *Json {
|
||||
m, err := j.Map()
|
||||
if err == nil {
|
||||
@@ -168,7 +169,7 @@ func (j *Json) Get(key string) *Json {
|
||||
// GetPath searches for the item as specified by the branch
|
||||
// without the need to deep dive using Get()'s.
|
||||
//
|
||||
// js.GetPath("top_level", "dict")
|
||||
// js.GetPath("top_level", "dict")
|
||||
func (j *Json) GetPath(branch ...string) *Json {
|
||||
jin := j
|
||||
for _, p := range branch {
|
||||
@@ -182,7 +183,8 @@ func (j *Json) GetPath(branch ...string) *Json {
|
||||
//
|
||||
// this is the analog to Get when accessing elements of
|
||||
// a json array instead of a json object:
|
||||
// js.Get("top_level").Get("array").GetIndex(1).Get("key").Int()
|
||||
//
|
||||
// js.Get("top_level").Get("array").GetIndex(1).Get("key").Int()
|
||||
func (j *Json) GetIndex(index int) *Json {
|
||||
a, err := j.Array()
|
||||
if err == nil {
|
||||
@@ -198,9 +200,10 @@ func (j *Json) GetIndex(index int) *Json {
|
||||
// indicating success or failure
|
||||
//
|
||||
// useful for chained operations when success is important:
|
||||
// if data, ok := js.Get("top_level").CheckGetIndex(0); ok {
|
||||
// log.Println(data)
|
||||
// }
|
||||
//
|
||||
// if data, ok := js.Get("top_level").CheckGetIndex(0); ok {
|
||||
// log.Println(data)
|
||||
// }
|
||||
func (j *Json) CheckGetIndex(index int) (*Json, bool) {
|
||||
a, err := j.Array()
|
||||
if err == nil {
|
||||
@@ -226,9 +229,10 @@ func (j *Json) SetIndex(index int, val interface{}) {
|
||||
// a `bool` identifying success or failure
|
||||
//
|
||||
// useful for chained operations when success is important:
|
||||
// if data, ok := js.Get("top_level").CheckGet("inner"); ok {
|
||||
// log.Println(data)
|
||||
// }
|
||||
//
|
||||
// if data, ok := js.Get("top_level").CheckGet("inner"); ok {
|
||||
// log.Println(data)
|
||||
// }
|
||||
func (j *Json) CheckGet(key string) (*Json, bool) {
|
||||
m, err := j.Map()
|
||||
if err == nil {
|
||||
@@ -303,9 +307,10 @@ func (j *Json) StringArray() ([]string, error) {
|
||||
// MustArray guarantees the return of a `[]interface{}` (with optional default)
|
||||
//
|
||||
// useful when you want to iterate over array values in a succinct manner:
|
||||
// for i, v := range js.Get("results").MustArray() {
|
||||
// fmt.Println(i, v)
|
||||
// }
|
||||
//
|
||||
// for i, v := range js.Get("results").MustArray() {
|
||||
// fmt.Println(i, v)
|
||||
// }
|
||||
func (j *Json) MustArray(args ...[]interface{}) []interface{} {
|
||||
var def []interface{}
|
||||
|
||||
@@ -328,9 +333,10 @@ func (j *Json) MustArray(args ...[]interface{}) []interface{} {
|
||||
// MustMap guarantees the return of a `map[string]interface{}` (with optional default)
|
||||
//
|
||||
// useful when you want to iterate over map values in a succinct manner:
|
||||
// for k, v := range js.Get("dictionary").MustMap() {
|
||||
// fmt.Println(k, v)
|
||||
// }
|
||||
//
|
||||
// for k, v := range js.Get("dictionary").MustMap() {
|
||||
// fmt.Println(k, v)
|
||||
// }
|
||||
func (j *Json) MustMap(args ...map[string]interface{}) map[string]interface{} {
|
||||
var def map[string]interface{}
|
||||
|
||||
@@ -353,7 +359,8 @@ func (j *Json) MustMap(args ...map[string]interface{}) map[string]interface{} {
|
||||
// MustString guarantees the return of a `string` (with optional default)
|
||||
//
|
||||
// useful when you explicitly want a `string` in a single value return context:
|
||||
// myFunc(js.Get("param1").MustString(), js.Get("optional_param").MustString("my_default"))
|
||||
//
|
||||
// myFunc(js.Get("param1").MustString(), js.Get("optional_param").MustString("my_default"))
|
||||
func (j *Json) MustString(args ...string) string {
|
||||
var def string
|
||||
|
||||
@@ -376,9 +383,10 @@ func (j *Json) MustString(args ...string) string {
|
||||
// MustStringArray guarantees the return of a `[]string` (with optional default)
|
||||
//
|
||||
// useful when you want to iterate over array values in a succinct manner:
|
||||
// for i, s := range js.Get("results").MustStringArray() {
|
||||
// fmt.Println(i, s)
|
||||
// }
|
||||
//
|
||||
// for i, s := range js.Get("results").MustStringArray() {
|
||||
// fmt.Println(i, s)
|
||||
// }
|
||||
func (j *Json) MustStringArray(args ...[]string) []string {
|
||||
var def []string
|
||||
|
||||
@@ -401,7 +409,8 @@ func (j *Json) MustStringArray(args ...[]string) []string {
|
||||
// MustInt guarantees the return of an `int` (with optional default)
|
||||
//
|
||||
// useful when you explicitly want an `int` in a single value return context:
|
||||
// myFunc(js.Get("param1").MustInt(), js.Get("optional_param").MustInt(5150))
|
||||
//
|
||||
// myFunc(js.Get("param1").MustInt(), js.Get("optional_param").MustInt(5150))
|
||||
func (j *Json) MustInt(args ...int) int {
|
||||
var def int
|
||||
|
||||
@@ -424,7 +433,8 @@ func (j *Json) MustInt(args ...int) int {
|
||||
// MustFloat64 guarantees the return of a `float64` (with optional default)
|
||||
//
|
||||
// useful when you explicitly want a `float64` in a single value return context:
|
||||
// myFunc(js.Get("param1").MustFloat64(), js.Get("optional_param").MustFloat64(5.150))
|
||||
//
|
||||
// myFunc(js.Get("param1").MustFloat64(), js.Get("optional_param").MustFloat64(5.150))
|
||||
func (j *Json) MustFloat64(args ...float64) float64 {
|
||||
var def float64
|
||||
|
||||
@@ -447,7 +457,8 @@ func (j *Json) MustFloat64(args ...float64) float64 {
|
||||
// MustBool guarantees the return of a `bool` (with optional default)
|
||||
//
|
||||
// useful when you explicitly want a `bool` in a single value return context:
|
||||
// myFunc(js.Get("param1").MustBool(), js.Get("optional_param").MustBool(true))
|
||||
//
|
||||
// myFunc(js.Get("param1").MustBool(), js.Get("optional_param").MustBool(true))
|
||||
func (j *Json) MustBool(args ...bool) bool {
|
||||
var def bool
|
||||
|
||||
@@ -470,7 +481,8 @@ func (j *Json) MustBool(args ...bool) bool {
|
||||
// MustInt64 guarantees the return of an `int64` (with optional default)
|
||||
//
|
||||
// useful when you explicitly want an `int64` in a single value return context:
|
||||
// myFunc(js.Get("param1").MustInt64(), js.Get("optional_param").MustInt64(5150))
|
||||
//
|
||||
// myFunc(js.Get("param1").MustInt64(), js.Get("optional_param").MustInt64(5150))
|
||||
func (j *Json) MustInt64(args ...int64) int64 {
|
||||
var def int64
|
||||
|
||||
@@ -493,7 +505,8 @@ func (j *Json) MustInt64(args ...int64) int64 {
|
||||
// MustUInt64 guarantees the return of an `uint64` (with optional default)
|
||||
//
|
||||
// useful when you explicitly want an `uint64` in a single value return context:
|
||||
// myFunc(js.Get("param1").MustUint64(), js.Get("optional_param").MustUint64(5150))
|
||||
//
|
||||
// myFunc(js.Get("param1").MustUint64(), js.Get("optional_param").MustUint64(5150))
|
||||
func (j *Json) MustUint64(args ...uint64) uint64 {
|
||||
var def uint64
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ func (cr classicReducer) ValidReduceFunc() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
//nolint: gocyclo
|
||||
//nolint:gocyclo
|
||||
func (cr classicReducer) Reduce(series mathexp.Series) mathexp.Number {
|
||||
num := mathexp.NewNumber("", nil)
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Package gcsifaces provides interfaces for Google Cloud Storage.
|
||||
//
|
||||
//go:generate mockgen -source $GOFILE -destination ../../mocks/mock_gcsifaces/mocks.go StorageClient
|
||||
package gcsifaces
|
||||
|
||||
|
||||
@@ -7,11 +7,12 @@ import (
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
"gocloud.dev/blob"
|
||||
_ "gocloud.dev/blob/fileblob"
|
||||
_ "gocloud.dev/blob/memblob"
|
||||
"gocloud.dev/gcerrors"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -272,7 +273,7 @@ func (c cdkBlobStorage) DeleteFolder(ctx context.Context, folderPath string, opt
|
||||
return lastErr
|
||||
}
|
||||
|
||||
//nolint: gocyclo
|
||||
//nolint:gocyclo
|
||||
func (c cdkBlobStorage) list(ctx context.Context, folderPath string, paging *Paging, options *ListOptions) (*ListResponse, error) {
|
||||
lowerRootPath := strings.ToLower(folderPath)
|
||||
iterators := []*blob.ListIterator{c.bucket.List(&blob.ListOptions{
|
||||
|
||||
@@ -275,7 +275,7 @@ func upsertProperty(dialect migrator.Dialect, sess *sqlstore.DBSession, now time
|
||||
return err
|
||||
}
|
||||
|
||||
//nolint: gocyclo
|
||||
//nolint:gocyclo
|
||||
func (s dbFileStorage) List(ctx context.Context, folderPath string, paging *Paging, options *ListOptions) (*ListResponse, error) {
|
||||
var resp *ListResponse
|
||||
|
||||
|
||||
@@ -76,6 +76,7 @@ func copyFileContents(src, dst string) (err error) {
|
||||
}
|
||||
}()
|
||||
|
||||
//nolint:gosec
|
||||
out, err := os.Create(dst)
|
||||
if err != nil {
|
||||
return
|
||||
|
||||
@@ -11,7 +11,7 @@ var dbCallCounterNameKey = contextKey{}
|
||||
|
||||
// InitCounter creates a pointer on the context that can be incremented later
|
||||
func InitCounter(ctx context.Context) context.Context {
|
||||
var ptr *int64 = new(int64)
|
||||
var ptr = new(int64)
|
||||
return context.WithValue(ctx, dbCallCounterNameKey, ptr)
|
||||
}
|
||||
|
||||
|
||||
@@ -205,9 +205,12 @@ func (cl *ConcreteLogger) New(ctx ...interface{}) *ConcreteLogger {
|
||||
// name plus additional contextual information, you must use the
|
||||
// Logger interface New method for it to work as expected.
|
||||
// Example creating a shared logger:
|
||||
// requestLogger := log.New("request-logger")
|
||||
//
|
||||
// requestLogger := log.New("request-logger")
|
||||
//
|
||||
// Example creating a contextual logger:
|
||||
// contextualLogger := requestLogger.New("username", "user123")
|
||||
//
|
||||
// contextualLogger := requestLogger.New("username", "user123")
|
||||
func New(ctx ...interface{}) *ConcreteLogger {
|
||||
if len(ctx) == 0 {
|
||||
return root.New()
|
||||
|
||||
@@ -34,12 +34,11 @@ type terminalLogger struct {
|
||||
// level output and terser human friendly timestamp.
|
||||
// This format should only be used for interactive programs or while developing.
|
||||
//
|
||||
// [TIME] [LEVEL] MESSAGE key=value key=value ...
|
||||
// [TIME] [LEVEL] MESSAGE key=value key=value ...
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// [May 16 20:58:45] [DBUG] remove route ns=haproxy addr=127.0.0.1:50002
|
||||
//
|
||||
// [May 16 20:58:45] [DBUG] remove route ns=haproxy addr=127.0.0.1:50002
|
||||
func NewTerminalLogger(w io.Writer) gokitlog.Logger {
|
||||
return &terminalLogger{w}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/go-kit/log"
|
||||
|
||||
glog "github.com/grafana/grafana/pkg/infra/log"
|
||||
"github.com/grafana/grafana/pkg/registry"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore"
|
||||
@@ -45,7 +46,7 @@ func ProvideService(cfg *setting.Cfg, sqlStore *sqlstore.SQLStore) (*RemoteCache
|
||||
// CacheStorage allows the caller to set, get and delete items in the cache.
|
||||
// Cached items are stored as byte arrays and marshalled using "encoding/gob"
|
||||
// so any struct added to the cache needs to be registered with `remotecache.Register`
|
||||
// ex `remotecache.Register(CacheableStruct{})``
|
||||
// ex `remotecache.Register(CacheableStruct{})`
|
||||
type CacheStorage interface {
|
||||
// Get reads object from Cache
|
||||
Get(ctx context.Context, key string) (interface{}, error)
|
||||
|
||||
@@ -96,9 +96,7 @@ func (dto *DashboardACLInfoDTO) IsDuplicateOf(other *DashboardACLInfoDTO) bool {
|
||||
return dto.hasSameRoleAs(other) || dto.hasSameUserAs(other) || dto.hasSameTeamAs(other)
|
||||
}
|
||||
|
||||
//
|
||||
// QUERIES
|
||||
//
|
||||
type GetDashboardACLInfoListQuery struct {
|
||||
DashboardID int64
|
||||
OrgID int64
|
||||
|
||||
@@ -8,13 +8,14 @@ package pluginextensionv2
|
||||
|
||||
import (
|
||||
context "context"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -8,13 +8,14 @@ package pluginextensionv2
|
||||
|
||||
import (
|
||||
context "context"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -7,10 +7,11 @@
|
||||
package secretsmanagerplugin
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -8,6 +8,7 @@ package secretsmanagerplugin
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
|
||||
@@ -47,6 +47,7 @@ func TestUninstall(t *testing.T) {
|
||||
|
||||
pluginDir := t.TempDir()
|
||||
pluginJSON := filepath.Join(pluginDir, "plugin.json")
|
||||
//nolint:gosec
|
||||
_, err := os.Create(pluginJSON)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -61,6 +62,7 @@ func TestUninstall(t *testing.T) {
|
||||
err = os.Mkdir(pluginDistDir, os.ModePerm)
|
||||
require.NoError(t, err)
|
||||
pluginJSON = filepath.Join(pluginDistDir, "plugin.json")
|
||||
//nolint:gosec
|
||||
_, err = os.Create(pluginJSON)
|
||||
require.NoError(t, err)
|
||||
|
||||
|
||||
@@ -29,7 +29,8 @@ import (
|
||||
)
|
||||
|
||||
// Soon we can fetch keys from:
|
||||
// https://grafana.com/api/plugins/ci/keys
|
||||
//
|
||||
// https://grafana.com/api/plugins/ci/keys
|
||||
const publicKeyText = `-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
Version: OpenPGP.js v4.10.1
|
||||
Comment: https://openpgpjs.org
|
||||
|
||||
@@ -120,7 +120,7 @@ func getScopeCacheKey(orgID int64, scope string) string {
|
||||
return fmt.Sprintf("%s-%v", scope, orgID)
|
||||
}
|
||||
|
||||
//ScopeInjector inject request params into the templated scopes. e.g. "settings:" + eval.Parameters(":id")
|
||||
// ScopeInjector inject request params into the templated scopes. e.g. "settings:" + eval.Parameters(":id")
|
||||
func ScopeInjector(params ScopeParams) ScopeAttributeMutator {
|
||||
return func(_ context.Context, scope string) ([]string, error) {
|
||||
tmpl, err := template.New("scope").Parse(scope)
|
||||
|
||||
@@ -126,7 +126,7 @@ type fakeIntervalTestReqHandler struct {
|
||||
verifier queryIntervalVerifier
|
||||
}
|
||||
|
||||
//nolint: staticcheck // legacydata.DataResponse deprecated
|
||||
//nolint:staticcheck // legacydata.DataResponse deprecated
|
||||
func (rh fakeIntervalTestReqHandler) HandleRequest(ctx context.Context, dsInfo *datasources.DataSource, query legacydata.DataQuery) (
|
||||
legacydata.DataResponse, error) {
|
||||
q := query.Queries[0]
|
||||
@@ -134,7 +134,7 @@ func (rh fakeIntervalTestReqHandler) HandleRequest(ctx context.Context, dsInfo *
|
||||
return rh.response, nil
|
||||
}
|
||||
|
||||
//nolint: staticcheck // legacydata.DataResponse deprecated
|
||||
//nolint:staticcheck // legacydata.DataResponse deprecated
|
||||
func applyScenario(t *testing.T, timeRange string, dataSourceJsonData *simplejson.Json, queryModel string, verifier func(query legacydata.DataSubQuery)) {
|
||||
t.Run("desc", func(t *testing.T) {
|
||||
store := mockstore.NewSQLStoreMock()
|
||||
|
||||
@@ -205,7 +205,7 @@ type queryConditionTestContext struct {
|
||||
condition *QueryCondition
|
||||
}
|
||||
|
||||
//nolint: staticcheck // legacydata.DataPlugin deprecated
|
||||
//nolint:staticcheck // legacydata.DataPlugin deprecated
|
||||
func (ctx *queryConditionTestContext) exec(t *testing.T) (*alerting.ConditionResult, error) {
|
||||
jsonModel, err := simplejson.NewJson([]byte(`{
|
||||
"type": "query",
|
||||
@@ -249,7 +249,7 @@ type fakeReqHandler struct {
|
||||
response legacydata.DataResponse
|
||||
}
|
||||
|
||||
//nolint: staticcheck // legacydata.DataPlugin deprecated
|
||||
//nolint:staticcheck // legacydata.DataPlugin deprecated
|
||||
func (rh fakeReqHandler) HandleRequest(context.Context, *datasources.DataSource, legacydata.DataQuery) (
|
||||
legacydata.DataResponse, error) {
|
||||
return rh.response, nil
|
||||
|
||||
@@ -17,7 +17,7 @@ type queryReducer struct {
|
||||
Type string
|
||||
}
|
||||
|
||||
//nolint: gocyclo
|
||||
//nolint:gocyclo
|
||||
func (s *queryReducer) Reduce(series legacydata.DataTimeSeries) null.Float {
|
||||
if len(series.Points) == 0 {
|
||||
return null.FloatFromPtr(nil)
|
||||
|
||||
@@ -16,7 +16,8 @@ import (
|
||||
)
|
||||
|
||||
// for stubbing in tests
|
||||
//nolint: gocritic
|
||||
//
|
||||
//nolint:gocritic
|
||||
var newImageUploaderProvider = func() (imguploader.ImageUploader, error) {
|
||||
return imguploader.NewImageUploader()
|
||||
}
|
||||
|
||||
@@ -54,7 +54,8 @@ type GoogleChatNotifier struct {
|
||||
log log.Logger
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
*
|
||||
Structs used to build a custom Google Hangouts Chat message card.
|
||||
See: https://developers.google.com/hangouts/chat/reference/message-formats/cards
|
||||
*/
|
||||
|
||||
@@ -11,10 +11,10 @@ import (
|
||||
)
|
||||
|
||||
// Ticker is a ticker to power the alerting scheduler. it's like a time.Ticker, except:
|
||||
// * it doesn't drop ticks for slow receivers, rather, it queues up. so that callers are in control to instrument what's going on.
|
||||
// * it ticks on interval marks or very shortly after. this provides a predictable load pattern
|
||||
// (this shouldn't cause too much load contention issues because the next steps in the pipeline just process at their own pace)
|
||||
// * the timestamps are used to mark "last datapoint to query for" and as such, are a configurable amount of seconds in the past
|
||||
// - it doesn't drop ticks for slow receivers, rather, it queues up. so that callers are in control to instrument what's going on.
|
||||
// - it ticks on interval marks or very shortly after. this provides a predictable load pattern
|
||||
// (this shouldn't cause too much load contention issues because the next steps in the pipeline just process at their own pace)
|
||||
// - the timestamps are used to mark "last datapoint to query for" and as such, are a configurable amount of seconds in the past
|
||||
type Ticker struct {
|
||||
C chan time.Time
|
||||
clock clock.Clock
|
||||
|
||||
@@ -6,8 +6,9 @@ import (
|
||||
"reflect"
|
||||
"time"
|
||||
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"gopkg.in/square/go-jose.v2/jwt"
|
||||
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
)
|
||||
|
||||
func (s *AuthService) initClaimExpectations() error {
|
||||
@@ -35,8 +36,8 @@ func (s *AuthService) initClaimExpectations() error {
|
||||
switch value := value.(type) {
|
||||
case []interface{}:
|
||||
for _, val := range value {
|
||||
if val, ok := val.(string); ok {
|
||||
s.expectRegistered.Audience = append(s.expectRegistered.Audience, val)
|
||||
if v, ok := val.(string); ok {
|
||||
s.expectRegistered.Audience = append(s.expectRegistered.Audience, v)
|
||||
} else {
|
||||
return fmt.Errorf("%q expectation contains value with invalid type %T, string expected", key, val)
|
||||
}
|
||||
@@ -73,8 +74,8 @@ func (s *AuthService) validateClaims(claims models.JWTClaims) error {
|
||||
switch value := value.(type) {
|
||||
case []interface{}:
|
||||
for _, val := range value {
|
||||
if val, ok := val.(string); ok {
|
||||
registeredClaims.Audience = append(registeredClaims.Audience, val)
|
||||
if v, ok := val.(string); ok {
|
||||
registeredClaims.Audience = append(registeredClaims.Audience, v)
|
||||
} else {
|
||||
return fmt.Errorf("%q claim contains value with invalid type %T, string expected", key, val)
|
||||
}
|
||||
|
||||
@@ -6,8 +6,9 @@ import (
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
)
|
||||
|
||||
//go:generate mockery --name DashboardService --structname FakeDashboardService --inpackage --filename dashboard_service_mock.go
|
||||
// DashboardService is a service for operating on dashboards.
|
||||
//
|
||||
//go:generate mockery --name DashboardService --structname FakeDashboardService --inpackage --filename dashboard_service_mock.go
|
||||
type DashboardService interface {
|
||||
BuildSaveDashboardCommand(ctx context.Context, dto *SaveDashboardDTO, shouldValidateAlerts bool, validateProvisionedDashboard bool) (*models.SaveDashboardCommand, error)
|
||||
DeleteDashboard(ctx context.Context, dashboardId int64, orgId int64) error
|
||||
@@ -32,8 +33,9 @@ type PluginService interface {
|
||||
GetDashboardsByPluginID(ctx context.Context, query *models.GetDashboardsByPluginIdQuery) error
|
||||
}
|
||||
|
||||
//go:generate mockery --name DashboardProvisioningService --structname FakeDashboardProvisioning --inpackage --filename dashboard_provisioning_mock.go
|
||||
// DashboardProvisioningService is a service for operating on provisioned dashboards.
|
||||
//
|
||||
//go:generate mockery --name DashboardProvisioningService --structname FakeDashboardProvisioning --inpackage --filename dashboard_provisioning_mock.go
|
||||
type DashboardProvisioningService interface {
|
||||
DeleteOrphanedProvisionedDashboards(ctx context.Context, cmd *models.DeleteOrphanedProvisionedDashboardsCommand) error
|
||||
DeleteProvisionedDashboard(ctx context.Context, dashboardID int64, orgID int64) error
|
||||
@@ -45,8 +47,9 @@ type DashboardProvisioningService interface {
|
||||
UnprovisionDashboard(ctx context.Context, dashboardID int64) error
|
||||
}
|
||||
|
||||
//go:generate mockery --name Store --structname FakeDashboardStore --inpackage --filename store_mock.go
|
||||
// Store is a dashboard store.
|
||||
//
|
||||
//go:generate mockery --name Store --structname FakeDashboardStore --inpackage --filename store_mock.go
|
||||
type Store interface {
|
||||
DeleteDashboard(ctx context.Context, cmd *models.DeleteDashboardCommand) error
|
||||
DeleteOrphanedProvisionedDashboards(ctx context.Context, cmd *models.DeleteOrphanedProvisionedDashboardsCommand) error
|
||||
@@ -76,8 +79,9 @@ type Store interface {
|
||||
FolderStore
|
||||
}
|
||||
|
||||
//go:generate mockery --name FolderStore --structname FakeFolderStore --inpackage --filename folder_store_mock.go
|
||||
// FolderStore is a folder store.
|
||||
//
|
||||
//go:generate mockery --name FolderStore --structname FakeFolderStore --inpackage --filename folder_store_mock.go
|
||||
type FolderStore interface {
|
||||
// GetFolderByTitle retrieves a folder by its title
|
||||
GetFolderByTitle(ctx context.Context, orgID int64, title string) (*models.Folder, error)
|
||||
|
||||
@@ -6,8 +6,9 @@ import (
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
)
|
||||
|
||||
//go:generate mockery --name FolderService --structname FakeFolderService --inpackage --filename folder_service_mock.go
|
||||
// FolderService is a service for operating on folders.
|
||||
//
|
||||
//go:generate mockery --name FolderService --structname FakeFolderService --inpackage --filename folder_service_mock.go
|
||||
type FolderService interface {
|
||||
GetFolders(ctx context.Context, user *models.SignedInUser, orgID int64, limit int64, page int64) ([]*models.Folder, error)
|
||||
GetFolderByID(ctx context.Context, user *models.SignedInUser, id int64, orgID int64) (*models.Folder, error)
|
||||
|
||||
@@ -65,7 +65,8 @@ func ToDelimited(s string, delimiter uint8) string {
|
||||
// (in this case `delimiter = '.'; screaming = true`)
|
||||
// or delimited.snake.case
|
||||
// (in this case `delimiter = '.'; screaming = false`)
|
||||
//nolint: gocyclo
|
||||
//
|
||||
//nolint:gocyclo
|
||||
func ToScreamingDelimited(s string, delimiter uint8, ignore string, screaming bool) string {
|
||||
s = strings.TrimSpace(s)
|
||||
n := strings.Builder{}
|
||||
|
||||
@@ -3,23 +3,22 @@
|
||||
// Package definitions includes the types required for generating or consuming an OpenAPI
|
||||
// spec for the Grafana Alerting API.
|
||||
//
|
||||
// Schemes: http, https
|
||||
// BasePath: /api/v1
|
||||
// Version: 1.1.0
|
||||
//
|
||||
// Schemes: http, https
|
||||
// BasePath: /api/v1
|
||||
// Version: 1.1.0
|
||||
// Consumes:
|
||||
// - application/json
|
||||
//
|
||||
// Consumes:
|
||||
// - application/json
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
// Security:
|
||||
// - basic
|
||||
//
|
||||
// Security:
|
||||
// - basic
|
||||
//
|
||||
// SecurityDefinitions:
|
||||
// basic:
|
||||
// type: basic
|
||||
// SecurityDefinitions:
|
||||
// basic:
|
||||
// type: basic
|
||||
//
|
||||
// swagger:meta
|
||||
package definitions
|
||||
|
||||
@@ -330,18 +330,18 @@ func executeQueriesAndExpressions(ctx AlertExecCtx, data []models.AlertQuery, no
|
||||
//
|
||||
// For example, given the following:
|
||||
//
|
||||
// map[string]string{
|
||||
// "ref1": "datasource1",
|
||||
// "ref2": "datasource1",
|
||||
// "ref3": "datasource2",
|
||||
// }
|
||||
// map[string]string{
|
||||
// "ref1": "datasource1",
|
||||
// "ref2": "datasource1",
|
||||
// "ref3": "datasource2",
|
||||
// }
|
||||
//
|
||||
// we would expect:
|
||||
//
|
||||
// map[string][]string{
|
||||
// "datasource1": []string{"ref1", "ref2"},
|
||||
// "datasource2": []string{"ref3"},
|
||||
// }
|
||||
// map[string][]string{
|
||||
// "datasource1": []string{"ref1", "ref2"},
|
||||
// "datasource2": []string{"ref3"},
|
||||
// }
|
||||
func datasourceUIDsToRefIDs(refIDsToDatasourceUIDs map[string]string) map[string][]string {
|
||||
if refIDsToDatasourceUIDs == nil {
|
||||
return nil
|
||||
@@ -376,12 +376,15 @@ func datasourceUIDsToRefIDs(refIDsToDatasourceUIDs map[string]string) map[string
|
||||
// Also, each Frame must be uniquely identified by its Field.Labels or a single Error result will be returned.
|
||||
//
|
||||
// Per Frame, data becomes a State based on the following rules:
|
||||
// - Empty or zero length Frames result in NoData.
|
||||
// - If a value:
|
||||
// - 0 results in Normal.
|
||||
// - Nonzero (e.g 1.2, NaN) results in Alerting.
|
||||
// - nil results in noData.
|
||||
// - unsupported Frame schemas results in Error.
|
||||
//
|
||||
// If no value is set:
|
||||
// - Empty or zero length Frames result in NoData.
|
||||
//
|
||||
// If a value is set:
|
||||
// - 0 results in Normal.
|
||||
// - Nonzero (e.g 1.2, NaN) results in Alerting.
|
||||
// - nil results in noData.
|
||||
// - unsupported Frame schemas results in Error.
|
||||
func evaluateExecutionResult(execResults ExecutionResults, ts time.Time) Results {
|
||||
evalResults := make([]Result, 0)
|
||||
|
||||
|
||||
@@ -48,8 +48,8 @@ type FakeEvaluator_ConditionEval_Call struct {
|
||||
}
|
||||
|
||||
// ConditionEval is a helper method to define mock.On call
|
||||
// - condition models.Condition
|
||||
// - now time.Time
|
||||
// - condition models.Condition
|
||||
// - now time.Time
|
||||
func (_e *FakeEvaluator_Expecter) ConditionEval(condition interface{}, now interface{}) *FakeEvaluator_ConditionEval_Call {
|
||||
return &FakeEvaluator_ConditionEval_Call{Call: _e.mock.On("ConditionEval", condition, now)}
|
||||
}
|
||||
@@ -95,9 +95,9 @@ type FakeEvaluator_QueriesAndExpressionsEval_Call struct {
|
||||
}
|
||||
|
||||
// QueriesAndExpressionsEval is a helper method to define mock.On call
|
||||
// - orgID int64
|
||||
// - data []models.AlertQuery
|
||||
// - now time.Time
|
||||
// - orgID int64
|
||||
// - data []models.AlertQuery
|
||||
// - now time.Time
|
||||
func (_e *FakeEvaluator_Expecter) QueriesAndExpressionsEval(orgID interface{}, data interface{}, now interface{}) *FakeEvaluator_QueriesAndExpressionsEval_Call {
|
||||
return &FakeEvaluator_QueriesAndExpressionsEval_Call{Call: _e.mock.On("QueriesAndExpressionsEval", orgID, data, now)}
|
||||
}
|
||||
|
||||
@@ -394,7 +394,8 @@ func (c Condition) IsValid() bool {
|
||||
// There are several exceptions:
|
||||
// 1. Following fields are not patched and therefore will be ignored: AlertRule.ID, AlertRule.OrgID, AlertRule.Updated, AlertRule.Version, AlertRule.UID, AlertRule.DashboardUID, AlertRule.PanelID, AlertRule.Annotations and AlertRule.Labels
|
||||
// 2. There are fields that are patched together:
|
||||
// - AlertRule.Condition and AlertRule.Data
|
||||
// - AlertRule.Condition and AlertRule.Data
|
||||
//
|
||||
// If either of the pair is specified, neither is patched.
|
||||
func PatchPartialAlertRule(existingRule *AlertRule, ruleToPatch *AlertRule) {
|
||||
if ruleToPatch.Title == "" {
|
||||
|
||||
@@ -110,11 +110,12 @@ func newTestImage() (string, error) {
|
||||
// mockTimeNow replaces function timeNow to return constant time.
|
||||
// It returns a function that resets the variable back to its original value.
|
||||
// This allows usage of this function with defer:
|
||||
// func Test (t *testing.T) {
|
||||
// now := time.Now()
|
||||
// defer mockTimeNow(now)()
|
||||
// ...
|
||||
// }
|
||||
//
|
||||
// func Test (t *testing.T) {
|
||||
// now := time.Now()
|
||||
// defer mockTimeNow(now)()
|
||||
// ...
|
||||
// }
|
||||
func mockTimeNow(constTime time.Time) func() {
|
||||
timeNow = func() time.Time {
|
||||
return constTime
|
||||
|
||||
@@ -96,6 +96,7 @@ func withStoredImages(ctx context.Context, l log.Logger, imageStore ImageStore,
|
||||
|
||||
// The path argument here comes from reading internal image storage, not user
|
||||
// input, so we ignore the security check here.
|
||||
//
|
||||
//nolint:gosec
|
||||
func openImage(path string) (io.ReadCloser, error) {
|
||||
fp := filepath.Clean(path)
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
)
|
||||
|
||||
// AMStore is a store of Alertmanager configurations.
|
||||
//
|
||||
//go:generate mockery --name AMConfigStore --structname MockAMConfigStore --inpackage --filename persist_mock.go --with-expecter
|
||||
type AMConfigStore interface {
|
||||
GetLatestAlertmanagerConfiguration(ctx context.Context, query *models.GetLatestAlertmanagerConfigurationQuery) error
|
||||
@@ -19,6 +20,7 @@ type AMConfigStore interface {
|
||||
}
|
||||
|
||||
// ProvisioningStore is a store of provisioning data for arbitrary objects.
|
||||
//
|
||||
//go:generate mockery --name ProvisioningStore --structname MockProvisioningStore --inpackage --filename provisioning_store_mock.go --with-expecter
|
||||
type ProvisioningStore interface {
|
||||
GetProvenance(ctx context.Context, o models.Provisionable, org int64) (models.Provenance, error)
|
||||
@@ -44,6 +46,7 @@ type RuleStore interface {
|
||||
}
|
||||
|
||||
// QuotaChecker represents the ability to evaluate whether quotas are met.
|
||||
//
|
||||
//go:generate mockery --name QuotaChecker --structname MockQuotaChecker --inpackage --filename quota_checker_mock.go --with-expecter
|
||||
type QuotaChecker interface {
|
||||
CheckQuotaReached(ctx context.Context, target string, scopeParams *quota.ScopeParameters) (bool, error)
|
||||
|
||||
@@ -44,8 +44,8 @@ type MockAMConfigStore_GetLatestAlertmanagerConfiguration_Call struct {
|
||||
}
|
||||
|
||||
// GetLatestAlertmanagerConfiguration is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
// - query *models.GetLatestAlertmanagerConfigurationQuery
|
||||
// - ctx context.Context
|
||||
// - query *models.GetLatestAlertmanagerConfigurationQuery
|
||||
func (_e *MockAMConfigStore_Expecter) GetLatestAlertmanagerConfiguration(ctx interface{}, query interface{}) *MockAMConfigStore_GetLatestAlertmanagerConfiguration_Call {
|
||||
return &MockAMConfigStore_GetLatestAlertmanagerConfiguration_Call{Call: _e.mock.On("GetLatestAlertmanagerConfiguration", ctx, query)}
|
||||
}
|
||||
@@ -82,8 +82,8 @@ type MockAMConfigStore_UpdateAlertmanagerConfiguration_Call struct {
|
||||
}
|
||||
|
||||
// UpdateAlertmanagerConfiguration is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
// - cmd *models.SaveAlertmanagerConfigurationCmd
|
||||
// - ctx context.Context
|
||||
// - cmd *models.SaveAlertmanagerConfigurationCmd
|
||||
func (_e *MockAMConfigStore_Expecter) UpdateAlertmanagerConfiguration(ctx interface{}, cmd interface{}) *MockAMConfigStore_UpdateAlertmanagerConfiguration_Call {
|
||||
return &MockAMConfigStore_UpdateAlertmanagerConfiguration_Call{Call: _e.mock.On("UpdateAlertmanagerConfiguration", ctx, cmd)}
|
||||
}
|
||||
|
||||
@@ -44,9 +44,9 @@ type MockProvisioningStore_DeleteProvenance_Call struct {
|
||||
}
|
||||
|
||||
// DeleteProvenance is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
// - o models.Provisionable
|
||||
// - org int64
|
||||
// - ctx context.Context
|
||||
// - o models.Provisionable
|
||||
// - org int64
|
||||
func (_e *MockProvisioningStore_Expecter) DeleteProvenance(ctx interface{}, o interface{}, org interface{}) *MockProvisioningStore_DeleteProvenance_Call {
|
||||
return &MockProvisioningStore_DeleteProvenance_Call{Call: _e.mock.On("DeleteProvenance", ctx, o, org)}
|
||||
}
|
||||
@@ -90,9 +90,9 @@ type MockProvisioningStore_GetProvenance_Call struct {
|
||||
}
|
||||
|
||||
// GetProvenance is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
// - o models.Provisionable
|
||||
// - org int64
|
||||
// - ctx context.Context
|
||||
// - o models.Provisionable
|
||||
// - org int64
|
||||
func (_e *MockProvisioningStore_Expecter) GetProvenance(ctx interface{}, o interface{}, org interface{}) *MockProvisioningStore_GetProvenance_Call {
|
||||
return &MockProvisioningStore_GetProvenance_Call{Call: _e.mock.On("GetProvenance", ctx, o, org)}
|
||||
}
|
||||
@@ -138,9 +138,9 @@ type MockProvisioningStore_GetProvenances_Call struct {
|
||||
}
|
||||
|
||||
// GetProvenances is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
// - org int64
|
||||
// - resourceType string
|
||||
// - ctx context.Context
|
||||
// - org int64
|
||||
// - resourceType string
|
||||
func (_e *MockProvisioningStore_Expecter) GetProvenances(ctx interface{}, org interface{}, resourceType interface{}) *MockProvisioningStore_GetProvenances_Call {
|
||||
return &MockProvisioningStore_GetProvenances_Call{Call: _e.mock.On("GetProvenances", ctx, org, resourceType)}
|
||||
}
|
||||
@@ -177,10 +177,10 @@ type MockProvisioningStore_SetProvenance_Call struct {
|
||||
}
|
||||
|
||||
// SetProvenance is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
// - o models.Provisionable
|
||||
// - org int64
|
||||
// - p models.Provenance
|
||||
// - ctx context.Context
|
||||
// - o models.Provisionable
|
||||
// - org int64
|
||||
// - p models.Provenance
|
||||
func (_e *MockProvisioningStore_Expecter) SetProvenance(ctx interface{}, o interface{}, org interface{}, p interface{}) *MockProvisioningStore_SetProvenance_Call {
|
||||
return &MockProvisioningStore_SetProvenance_Call{Call: _e.mock.On("SetProvenance", ctx, o, org, p)}
|
||||
}
|
||||
|
||||
@@ -51,9 +51,9 @@ type MockQuotaChecker_CheckQuotaReached_Call struct {
|
||||
}
|
||||
|
||||
// CheckQuotaReached is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
// - target string
|
||||
// - scopeParams *quota.ScopeParameters
|
||||
// - ctx context.Context
|
||||
// - target string
|
||||
// - scopeParams *quota.ScopeParameters
|
||||
func (_e *MockQuotaChecker_Expecter) CheckQuotaReached(ctx interface{}, target interface{}, scopeParams interface{}) *MockQuotaChecker_CheckQuotaReached_Call {
|
||||
return &MockQuotaChecker_CheckQuotaReached_Call{Call: _e.mock.On("CheckQuotaReached", ctx, target, scopeParams)}
|
||||
}
|
||||
|
||||
@@ -33,8 +33,8 @@ type AlertsSenderMock_Send_Call struct {
|
||||
}
|
||||
|
||||
// Send is a helper method to define mock.On call
|
||||
// - key models.AlertRuleKey
|
||||
// - alerts definitions.PostableAlerts
|
||||
// - key models.AlertRuleKey
|
||||
// - alerts definitions.PostableAlerts
|
||||
func (_e *AlertsSenderMock_Expecter) Send(key interface{}, alerts interface{}) *AlertsSenderMock_Send_Call {
|
||||
return &AlertsSenderMock_Send_Call{Call: _e.mock.On("Send", key, alerts)}
|
||||
}
|
||||
|
||||
@@ -91,6 +91,7 @@ func newAlertRuleInfo(parent context.Context) *alertRuleInfo {
|
||||
// Returns a tuple where first element is
|
||||
// - true when message was sent
|
||||
// - false when the send operation is stopped
|
||||
//
|
||||
// the second element contains a dropped message that was sent by a concurrent sender.
|
||||
func (a *alertRuleInfo) eval(t time.Time, rule *models.AlertRule) (bool, *evaluation) {
|
||||
// read the channel in unblocking manner to make sure that there is no concurrent send operation.
|
||||
|
||||
@@ -25,6 +25,7 @@ import (
|
||||
|
||||
// ScheduleService is an interface for a service that schedules the evaluation
|
||||
// of alert rules.
|
||||
//
|
||||
//go:generate mockery --name ScheduleService --structname FakeScheduleService --inpackage --filename schedule_mock.go --unroll-variadic=False
|
||||
type ScheduleService interface {
|
||||
// Run the scheduler until the context is canceled or the scheduler returns
|
||||
@@ -40,8 +41,9 @@ type ScheduleService interface {
|
||||
overrideCfg(cfg SchedulerCfg)
|
||||
}
|
||||
|
||||
//go:generate mockery --name AlertsSender --structname AlertsSenderMock --inpackage --filename alerts_sender_mock.go --with-expecter
|
||||
// AlertsSender is an interface for a service that is responsible for sending notifications to the end-user.
|
||||
//
|
||||
//go:generate mockery --name AlertsSender --structname AlertsSenderMock --inpackage --filename alerts_sender_mock.go --with-expecter
|
||||
type AlertsSender interface {
|
||||
Send(key ngmodels.AlertRuleKey, alerts definitions.PostableAlerts)
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ func assertEvalRun(t *testing.T, ch <-chan evalAppliedInfo, tick time.Time, keys
|
||||
case info := <-ch:
|
||||
_, ok := expected[info.alertDefKey]
|
||||
if !ok {
|
||||
t.Fatal(fmt.Sprintf("alert rule: %v should not have been evaluated at: %v", info.alertDefKey, info.now))
|
||||
t.Fatalf("alert rule: %v should not have been evaluated at: %v", info.alertDefKey, info.now)
|
||||
}
|
||||
t.Logf("alert rule: %v evaluated at: %v", info.alertDefKey, info.now)
|
||||
assert.Equal(t, tick, info.now)
|
||||
|
||||
@@ -40,7 +40,7 @@ type AdminConfigurationStoreMock_DeleteAdminConfiguration_Call struct {
|
||||
}
|
||||
|
||||
// DeleteAdminConfiguration is a helper method to define mock.On call
|
||||
// - orgID int64
|
||||
// - orgID int64
|
||||
func (_e *AdminConfigurationStoreMock_Expecter) DeleteAdminConfiguration(orgID interface{}) *AdminConfigurationStoreMock_DeleteAdminConfiguration_Call {
|
||||
return &AdminConfigurationStoreMock_DeleteAdminConfiguration_Call{Call: _e.mock.On("DeleteAdminConfiguration", orgID)}
|
||||
}
|
||||
@@ -86,7 +86,7 @@ type AdminConfigurationStoreMock_GetAdminConfiguration_Call struct {
|
||||
}
|
||||
|
||||
// GetAdminConfiguration is a helper method to define mock.On call
|
||||
// - orgID int64
|
||||
// - orgID int64
|
||||
func (_e *AdminConfigurationStoreMock_Expecter) GetAdminConfiguration(orgID interface{}) *AdminConfigurationStoreMock_GetAdminConfiguration_Call {
|
||||
return &AdminConfigurationStoreMock_GetAdminConfiguration_Call{Call: _e.mock.On("GetAdminConfiguration", orgID)}
|
||||
}
|
||||
@@ -168,7 +168,7 @@ type AdminConfigurationStoreMock_UpdateAdminConfiguration_Call struct {
|
||||
}
|
||||
|
||||
// UpdateAdminConfiguration is a helper method to define mock.On call
|
||||
// - _a0 UpdateAdminConfigurationCmd
|
||||
// - _a0 UpdateAdminConfigurationCmd
|
||||
func (_e *AdminConfigurationStoreMock_Expecter) UpdateAdminConfiguration(_a0 interface{}) *AdminConfigurationStoreMock_UpdateAdminConfiguration_Call {
|
||||
return &AdminConfigurationStoreMock_UpdateAdminConfiguration_Call{Call: _e.mock.On("UpdateAdminConfiguration", _a0)}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
// Package values is a set of value types to use in provisioning. They add custom unmarshaling logic that puts the string values
|
||||
// through os.ExpandEnv.
|
||||
// Usage:
|
||||
// type Data struct {
|
||||
// Field StringValue `yaml:"field"` // Instead of string
|
||||
// }
|
||||
//
|
||||
// type Data struct {
|
||||
// Field StringValue `yaml:"field"` // Instead of string
|
||||
// }
|
||||
//
|
||||
// d := &Data{}
|
||||
// // unmarshal into d
|
||||
// d.Field.Value() // returns the final interpolated value from the yaml file
|
||||
//
|
||||
package values
|
||||
|
||||
import (
|
||||
|
||||
@@ -16,6 +16,7 @@ import (
|
||||
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/data"
|
||||
|
||||
"github.com/grafana/grafana/pkg/api/dtos"
|
||||
"github.com/grafana/grafana/pkg/components/simplejson"
|
||||
"github.com/grafana/grafana/pkg/infra/localcache"
|
||||
@@ -265,7 +266,7 @@ func TestApiSavePublicDashboardConfig(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// `/public/dashboards/:uid/query`` endpoint test
|
||||
// `/public/dashboards/:uid/query` endpoint test
|
||||
func TestAPIQueryPublicDashboard(t *testing.T) {
|
||||
cacheService := &fakeDatasources.FakeCacheService{
|
||||
DataSources: []*datasources.DataSource{
|
||||
|
||||
@@ -137,7 +137,7 @@ func buildQueryDataService(t *testing.T, cs datasources.CacheService, fpc *fakeP
|
||||
)
|
||||
}
|
||||
|
||||
//copied from pkg/api/metrics_test.go
|
||||
// copied from pkg/api/metrics_test.go
|
||||
type fakePluginRequestValidator struct {
|
||||
err error
|
||||
}
|
||||
|
||||
@@ -98,9 +98,7 @@ func (pd PublicDashboard) BuildTimeSettings(dashboard *models.Dashboard) *TimeSe
|
||||
return ts
|
||||
}
|
||||
|
||||
//
|
||||
// DTO for transforming user input in the api
|
||||
//
|
||||
type SavePublicDashboardConfigDTO struct {
|
||||
DashboardUid string
|
||||
OrgId int64
|
||||
|
||||
@@ -175,6 +175,7 @@ func (rs *RenderingService) readFileResponse(ctx context.Context, resp *http.Res
|
||||
resp.Status)
|
||||
}
|
||||
|
||||
//nolint:gosec
|
||||
out, err := os.Create(filePath)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -77,6 +77,7 @@ func (s ScreenshotOptions) SetDefaults() ScreenshotOptions {
|
||||
}
|
||||
|
||||
// ScreenshotService is an interface for taking screenshots.
|
||||
//
|
||||
//go:generate mockgen -destination=mock.go -package=screenshot github.com/grafana/grafana/pkg/services/screenshot ScreenshotService
|
||||
type ScreenshotService interface {
|
||||
Take(ctx context.Context, opts ScreenshotOptions) (*Screenshot, error)
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
"github.com/blugelabs/bluge/search/aggregations"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/data"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
)
|
||||
|
||||
@@ -349,7 +350,7 @@ func getDashboardLocation(index *orgIndex, dashboardUID string) (string, bool, e
|
||||
return dashboardLocation, found, err
|
||||
}
|
||||
|
||||
//nolint: gocyclo
|
||||
//nolint:gocyclo
|
||||
func doSearchQuery(
|
||||
ctx context.Context,
|
||||
logger log.Logger,
|
||||
|
||||
@@ -8,9 +8,10 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/searchV2/dslookup"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/searchV2/dslookup"
|
||||
)
|
||||
|
||||
func dsLookup() dslookup.DatasourceLookup {
|
||||
@@ -98,6 +99,7 @@ func TestReadDashboard(t *testing.T) {
|
||||
|
||||
update := false
|
||||
savedPath := filepath.Join("testdata/", input+"-info.json")
|
||||
//nolint:gosec
|
||||
saved, err := os.ReadFile(savedPath)
|
||||
if err != nil {
|
||||
update = true
|
||||
|
||||
@@ -63,7 +63,6 @@ func validateSecretWasStoreInPlugin(t *testing.T, secretsStore SecretsKVStore, c
|
||||
require.Equal(t, 1, len(resPlugin))
|
||||
}
|
||||
|
||||
//
|
||||
func setupTestMigratorService(t *testing.T) (*PluginSecretMigrationService, SecretsKVStore, *secretsKVStoreSQL) {
|
||||
t.Helper()
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ func (api *ServiceAccountsAPI) RegisterAPIEndpoints() {
|
||||
|
||||
// swagger:route POST /serviceaccounts service_accounts createServiceAccount
|
||||
//
|
||||
// Create service account
|
||||
// Create service account.
|
||||
//
|
||||
// Required permissions (See note in the [introduction](https://grafana.com/docs/grafana/latest/developers/http_api/serviceaccount/#service-account-api) for an explanation):
|
||||
// action: `serviceaccounts:write` scope: `serviceaccounts:*`
|
||||
@@ -133,7 +133,7 @@ func (api *ServiceAccountsAPI) CreateServiceAccount(c *models.ReqContext) respon
|
||||
|
||||
// swagger:route GET /serviceaccounts/{serviceAccountId} service_accounts retrieveServiceAccount
|
||||
//
|
||||
// Get single serviceaccount by Id
|
||||
// Get single serviceaccount by Id.
|
||||
//
|
||||
// Required permissions (See note in the [introduction](https://grafana.com/docs/grafana/latest/developers/http_api/serviceaccount/#service-account-api) for an explanation):
|
||||
// action: `serviceaccounts:read` scope: `serviceaccounts:id:1` (single service account)
|
||||
@@ -177,7 +177,7 @@ func (api *ServiceAccountsAPI) RetrieveServiceAccount(ctx *models.ReqContext) re
|
||||
|
||||
// swagger:route PATCH /serviceaccounts/{serviceAccountId} service_accounts updateServiceAccount
|
||||
//
|
||||
// Update service account
|
||||
// Update service account.
|
||||
//
|
||||
// Required permissions (See note in the [introduction](https://grafana.com/docs/grafana/latest/developers/http_api/serviceaccount/#service-account-api) for an explanation):
|
||||
// action: `serviceaccounts:write` scope: `serviceaccounts:id:1` (single service account)
|
||||
@@ -246,7 +246,7 @@ func (api *ServiceAccountsAPI) validateRole(r *models.RoleType, orgRole *models.
|
||||
|
||||
// swagger:route DELETE /serviceaccounts/{serviceAccountId} service_accounts deleteServiceAccount
|
||||
//
|
||||
// Delete service account
|
||||
// Delete service account.
|
||||
//
|
||||
// Required permissions (See note in the [introduction](https://grafana.com/docs/grafana/latest/developers/http_api/serviceaccount/#service-account-api) for an explanation):
|
||||
// action: `serviceaccounts:delete` scope: `serviceaccounts:id:1` (single service account)
|
||||
@@ -271,7 +271,7 @@ func (api *ServiceAccountsAPI) DeleteServiceAccount(ctx *models.ReqContext) resp
|
||||
|
||||
// swagger:route GET /serviceaccounts/search service_accounts searchOrgServiceAccountsWithPaging
|
||||
//
|
||||
// Search service accounts with paging
|
||||
// Search service accounts with paging.
|
||||
//
|
||||
// Required permissions (See note in the [introduction](https://grafana.com/docs/grafana/latest/developers/http_api/serviceaccount/#service-account-api) for an explanation):
|
||||
// action: `serviceaccounts:read` scope: `serviceaccounts:*`
|
||||
|
||||
@@ -50,7 +50,7 @@ const sevenDaysAhead = 7 * 24 * time.Hour
|
||||
|
||||
// swagger:route GET /serviceaccounts/{serviceAccountId}/tokens service_accounts listTokens
|
||||
//
|
||||
// Get service account tokens
|
||||
// Get service account tokens.
|
||||
//
|
||||
// Required permissions (See note in the [introduction](https://grafana.com/docs/grafana/latest/developers/http_api/serviceaccount/#service-account-api) for an explanation):
|
||||
// action: `serviceaccounts:read` scope: `global:serviceaccounts:id:1` (single service account)
|
||||
@@ -104,7 +104,7 @@ func (api *ServiceAccountsAPI) ListTokens(ctx *models.ReqContext) response.Respo
|
||||
|
||||
// swagger:route POST /serviceaccounts/{serviceAccountId}/tokens service_accounts createToken
|
||||
//
|
||||
// CreateNewToken adds a token to a service account
|
||||
// CreateNewToken adds a token to a service account.
|
||||
//
|
||||
// Required permissions (See note in the [introduction](https://grafana.com/docs/grafana/latest/developers/http_api/serviceaccount/#service-account-api) for an explanation):
|
||||
// action: `serviceaccounts:write` scope: `serviceaccounts:id:1` (single service account)
|
||||
@@ -178,7 +178,7 @@ func (api *ServiceAccountsAPI) CreateToken(c *models.ReqContext) response.Respon
|
||||
|
||||
// swagger:route DELETE /serviceaccounts/{serviceAccountId}/tokens/{tokenId} service_accounts deleteToken
|
||||
//
|
||||
// DeleteToken deletes service account tokens
|
||||
// DeleteToken deletes service account tokens.
|
||||
//
|
||||
// Required permissions (See note in the [introduction](https://grafana.com/docs/grafana/latest/developers/http_api/serviceaccount/#service-account-api) for an explanation):
|
||||
// action: `serviceaccounts:write` scope: `serviceaccounts:id:1` (single service account)
|
||||
|
||||
@@ -199,6 +199,7 @@ func openReplace(filename string) (*replaceFile, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
//nolint:gosec
|
||||
f, err := os.Create(tmpFilename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -232,7 +232,7 @@ func (m *migration) SQL(dialect migrator.Dialect) string {
|
||||
return codeMigration
|
||||
}
|
||||
|
||||
// nolint: gocyclo
|
||||
//nolint:gocyclo
|
||||
func (m *migration) Exec(sess *xorm.Session, mg *migrator.Migrator) error {
|
||||
m.sess = sess
|
||||
m.mg = mg
|
||||
|
||||
@@ -313,7 +313,7 @@ func (b *BaseDialect) TruncateDBTables() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
//UpsertSQL returns empty string
|
||||
// UpsertSQL returns empty string
|
||||
func (b *BaseDialect) UpsertSQL(tableName string, keyCols, updateCols []string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
@@ -415,7 +415,7 @@ func TestIntegrationAccountDataAccess(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
//TODO: Use FakeDashboardStore when org has its own service
|
||||
// TODO: Use FakeDashboardStore when org has its own service
|
||||
func insertTestDashboard(t *testing.T, sqlStore *SQLStore, title string, orgId int64,
|
||||
folderId int64, isFolder bool, tags ...interface{}) *models.Dashboard {
|
||||
t.Helper()
|
||||
@@ -472,7 +472,7 @@ func insertTestDashboard(t *testing.T, sqlStore *SQLStore, title string, orgId i
|
||||
return dash
|
||||
}
|
||||
|
||||
//TODO: Use FakeDashboardStore when org has its own service
|
||||
// TODO: Use FakeDashboardStore when org has its own service
|
||||
func updateDashboardACL(t *testing.T, sqlStore *SQLStore, dashboardID int64, items ...*models.DashboardACL) error {
|
||||
t.Helper()
|
||||
|
||||
|
||||
@@ -21,11 +21,11 @@
|
||||
//
|
||||
// Filters will be applied in order with the final result like such:
|
||||
//
|
||||
// SELECT id FROM dashboard LEFT OUTER JOIN <FilterLeftJoin...>
|
||||
// WHERE <FilterWhere[0]> AND ... AND <FilterWhere[n]>
|
||||
// GROUP BY <FilterGroupBy...>
|
||||
// ORDER BY <FilterOrderBy...>
|
||||
// LIMIT <limit> OFFSET <(page-1)*limit>;
|
||||
// SELECT id FROM dashboard LEFT OUTER JOIN <FilterLeftJoin...>
|
||||
// WHERE <FilterWhere[0]> AND ... AND <FilterWhere[n]>
|
||||
// GROUP BY <FilterGroupBy...>
|
||||
// ORDER BY <FilterOrderBy...>
|
||||
// LIMIT <limit> OFFSET <(page-1)*limit>;
|
||||
//
|
||||
// This structure is intended to isolate the filters from each other
|
||||
// and implementors are expected to add all the required joins, where
|
||||
|
||||
@@ -178,7 +178,7 @@ func (ss *SQLStore) createUser(ctx context.Context, sess *DBSession, args user.C
|
||||
return usr, nil
|
||||
}
|
||||
|
||||
// deprecated method, use only for tests
|
||||
// deprecated method, use only for tests
|
||||
func (ss *SQLStore) CreateUser(ctx context.Context, cmd user.CreateUserCommand) (*user.User, error) {
|
||||
var user user.User
|
||||
createErr := ss.WithTransactionalDbSession(ctx, func(sess *DBSession) (err error) {
|
||||
|
||||
@@ -58,6 +58,7 @@ type EventHandler func(ctx context.Context, e *EntityEvent) error
|
||||
|
||||
// EntityEventsService is a temporary solution to support change notifications in an HA setup
|
||||
// With this service each system can query for any events that have happened since a fixed time
|
||||
//
|
||||
//go:generate mockery --name EntityEventsService --structname MockEntityEventsService --inpackage --filename entity_events_mock.go
|
||||
type EntityEventsService interface {
|
||||
registry.BackgroundService
|
||||
|
||||
@@ -23,9 +23,10 @@ type rootStorageSQL struct {
|
||||
|
||||
// getDbRootFolder creates a DB path prefix for a given storage name and orgId.
|
||||
// example:
|
||||
// orgId: 5
|
||||
// storageName: "upload"
|
||||
// => prefix: "/5/upload/"
|
||||
//
|
||||
// orgId: 5
|
||||
// storageName: "upload"
|
||||
// => prefix: "/5/upload/"
|
||||
func getDbStoragePathPrefix(orgId int64, storageName string) string {
|
||||
return filestorage.Join(fmt.Sprintf("%d", orgId), storageName+filestorage.Delimiter)
|
||||
}
|
||||
|
||||
@@ -913,6 +913,9 @@ func newMockNotificationChannel(t *testing.T, grafanaListedAddr string) *mockNot
|
||||
require.NoError(t, err)
|
||||
|
||||
nc := &mockNotificationChannel{
|
||||
// Skip gosec linter since this is in test code.
|
||||
//
|
||||
//nolint:gosec
|
||||
server: &http.Server{
|
||||
Addr: listener.Addr().String(),
|
||||
},
|
||||
|
||||
@@ -450,9 +450,12 @@ func formatAzureMonitorLegendKey(alias string, resourceName string, metricName s
|
||||
}
|
||||
|
||||
// Map values from:
|
||||
// https://docs.microsoft.com/en-us/rest/api/monitor/metrics/list#unit
|
||||
//
|
||||
// https://docs.microsoft.com/en-us/rest/api/monitor/metrics/list#unit
|
||||
//
|
||||
// to
|
||||
// https://github.com/grafana/grafana/blob/main/packages/grafana-data/src/valueFormats/categories.ts#L24
|
||||
//
|
||||
// https://github.com/grafana/grafana/blob/main/packages/grafana-data/src/valueFormats/categories.ts#L24
|
||||
func toGrafanaUnit(unit string) string {
|
||||
switch unit {
|
||||
case "BitsPerSecond":
|
||||
|
||||
@@ -12,8 +12,9 @@ import (
|
||||
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/data"
|
||||
"github.com/grafana/grafana/pkg/infra/tracing"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/tracing"
|
||||
)
|
||||
|
||||
func (timeSeriesFilter *cloudMonitoringTimeSeriesFilter) run(ctx context.Context, req *backend.QueryDataRequest,
|
||||
@@ -82,7 +83,7 @@ func (timeSeriesFilter *cloudMonitoringTimeSeriesFilter) run(ctx context.Context
|
||||
return dr, d, r.URL.RawQuery, nil
|
||||
}
|
||||
|
||||
//nolint: gocyclo
|
||||
//nolint:gocyclo
|
||||
func (timeSeriesFilter *cloudMonitoringTimeSeriesFilter) parseResponse(queryRes *backend.DataResponse,
|
||||
response cloudMonitoringResponse, executedQueryString string) error {
|
||||
frames := data.Frames{}
|
||||
|
||||
@@ -29,18 +29,18 @@ const (
|
||||
//
|
||||
// we also try to detect some often used patterns in the data,
|
||||
// and make the data easier to graph in the browser for such cases:
|
||||
// - if there is only one timestamp-column and it's named "_time",
|
||||
// we will not add the labels to this data-column, because timestamp
|
||||
// columns usually do not have labels in grafana.
|
||||
// we use the `columnInfo.shouldGetLabels` attribute to handle this.
|
||||
// - if there is only one timestamp-column and it's named "_time",
|
||||
// and there is only one non-timestamp-column and it's named "_value",
|
||||
// we rename "_time" to "Time" (using `columnInfo.isTheSimpleTime`),
|
||||
// and we rename "_value" too (using `columnInfo.isTheSimpleValue`):
|
||||
// if there is a tag called "_field" we use it's value as the name
|
||||
// (because that's the usual approach in influxdb), and if there is not,
|
||||
// we name it "Value". with these new names, they are more compatible
|
||||
// with the visualizations in grafana.
|
||||
// - if there is only one timestamp-column and it's named "_time",
|
||||
// we will not add the labels to this data-column, because timestamp
|
||||
// columns usually do not have labels in grafana.
|
||||
// we use the `columnInfo.shouldGetLabels` attribute to handle this.
|
||||
// - if there is only one timestamp-column and it's named "_time",
|
||||
// and there is only one non-timestamp-column and it's named "_value",
|
||||
// we rename "_time" to "Time" (using `columnInfo.isTheSimpleTime`),
|
||||
// and we rename "_value" too (using `columnInfo.isTheSimpleValue`):
|
||||
// if there is a tag called "_field" we use it's value as the name
|
||||
// (because that's the usual approach in influxdb), and if there is not,
|
||||
// we name it "Value". with these new names, they are more compatible
|
||||
// with the visualizations in grafana.
|
||||
type columnInfo struct {
|
||||
name string
|
||||
converter *data.FieldConverter
|
||||
|
||||
@@ -156,7 +156,7 @@ func FormatDuration(inter time.Duration) string {
|
||||
return "1ms"
|
||||
}
|
||||
|
||||
//nolint: gocyclo
|
||||
//nolint:gocyclo
|
||||
func roundInterval(interval time.Duration) time.Duration {
|
||||
switch {
|
||||
// 0.01s
|
||||
|
||||
@@ -146,7 +146,7 @@ func FormatDuration(inter time.Duration) string {
|
||||
return "1ms"
|
||||
}
|
||||
|
||||
//nolint: gocyclo
|
||||
//nolint:gocyclo
|
||||
func roundInterval(interval time.Duration) time.Duration {
|
||||
switch {
|
||||
// 0.015s
|
||||
|
||||
@@ -33,7 +33,7 @@ func ProvideService(pluginsClient plugins.Client, oAuthTokenService oauthtoken.O
|
||||
}
|
||||
}
|
||||
|
||||
//nolint: staticcheck // legacydata.DataResponse deprecated
|
||||
//nolint:staticcheck // legacydata.DataResponse deprecated
|
||||
func (h *Service) HandleRequest(ctx context.Context, ds *datasources.DataSource, query legacydata.DataQuery) (legacydata.DataResponse, error) {
|
||||
decryptedJsonData, err := h.dataSourcesService.DecryptedValues(ctx, ds)
|
||||
if err != nil {
|
||||
|
||||
@@ -189,7 +189,7 @@ func formatNamePrometheusStyle(labels map[string]string) string {
|
||||
return fmt.Sprintf("{%s}", strings.Join(parts, ", "))
|
||||
}
|
||||
|
||||
//If legend (using of name or pattern instead of time series name) is used, use that name/pattern for formatting
|
||||
// If legend (using of name or pattern instead of time series name) is used, use that name/pattern for formatting
|
||||
func formatName(labels map[string]string, query *lokiQuery) string {
|
||||
if query.LegendFormat == "" {
|
||||
return formatNamePrometheusStyle(labels)
|
||||
|
||||
@@ -57,6 +57,7 @@ func TestSuccessResponse(t *testing.T) {
|
||||
responseFileName := filepath.Join("testdata", test.filepath+".json")
|
||||
goldenFileName := test.filepath + ".golden"
|
||||
|
||||
//nolint:gosec
|
||||
bytes, err := os.ReadFile(responseFileName)
|
||||
require.NoError(t, err)
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend/gtime"
|
||||
|
||||
"github.com/grafana/grafana/pkg/tsdb/sqleng"
|
||||
)
|
||||
|
||||
@@ -65,7 +66,7 @@ func (m *postgresMacroEngine) Interpolate(query *backend.DataQuery, timeRange ba
|
||||
return sql, nil
|
||||
}
|
||||
|
||||
//nolint: gocyclo
|
||||
//nolint:gocyclo
|
||||
func (m *postgresMacroEngine) evaluateMacro(timeRange backend.TimeRange, query *backend.DataQuery, name string, args []string) (string, error) {
|
||||
switch name {
|
||||
case "__time":
|
||||
|
||||
@@ -15,11 +15,12 @@ import (
|
||||
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/experimental"
|
||||
"github.com/prometheus/client_golang/api"
|
||||
apiv1 "github.com/prometheus/client_golang/api/prometheus/v1"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
"github.com/grafana/grafana/pkg/infra/tracing"
|
||||
"github.com/grafana/grafana/pkg/tsdb/intervalv2"
|
||||
"github.com/prometheus/client_golang/api"
|
||||
apiv1 "github.com/prometheus/client_golang/api/prometheus/v1"
|
||||
)
|
||||
|
||||
var update = true
|
||||
@@ -44,6 +45,7 @@ func TestMatrixResponses(t *testing.T) {
|
||||
query, err := loadStoredPrometheusQuery(queryFileName)
|
||||
require.NoError(t, err)
|
||||
|
||||
//nolint:gosec
|
||||
responseBytes, err := os.ReadFile(responseFileName)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -101,6 +103,7 @@ type storedPrometheusQuery struct {
|
||||
}
|
||||
|
||||
func loadStoredPrometheusQuery(fileName string) (PrometheusQuery, error) {
|
||||
//nolint:gosec
|
||||
bytes, err := os.ReadFile(fileName)
|
||||
if err != nil {
|
||||
return PrometheusQuery{}, err
|
||||
|
||||
@@ -26,7 +26,7 @@ import (
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
)
|
||||
|
||||
//Internal interval and range variables
|
||||
// Internal interval and range variables
|
||||
const (
|
||||
varInterval = "$__interval"
|
||||
varIntervalMs = "$__interval_ms"
|
||||
@@ -36,8 +36,8 @@ const (
|
||||
varRateInterval = "$__rate_interval"
|
||||
)
|
||||
|
||||
//Internal interval and range variables with {} syntax
|
||||
//Repetitive code, we should have functionality to unify these
|
||||
// Internal interval and range variables with {} syntax
|
||||
// Repetitive code, we should have functionality to unify these
|
||||
const (
|
||||
varIntervalAlt = "${__interval}"
|
||||
varIntervalMsAlt = "${__interval_ms}"
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/tsdb/intervalv2"
|
||||
)
|
||||
|
||||
//Internal interval and range variables
|
||||
// Internal interval and range variables
|
||||
const (
|
||||
varInterval = "$__interval"
|
||||
varIntervalMs = "$__interval_ms"
|
||||
@@ -21,8 +21,8 @@ const (
|
||||
varRateInterval = "$__rate_interval"
|
||||
)
|
||||
|
||||
//Internal interval and range variables with {} syntax
|
||||
//Repetitive code, we should have functionality to unify these
|
||||
// Internal interval and range variables with {} syntax
|
||||
// Repetitive code, we should have functionality to unify these
|
||||
const (
|
||||
varIntervalAlt = "${__interval}"
|
||||
varIntervalMsAlt = "${__interval_ms}"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user