* Chore: Upgrade to Go 1.13
Fixes: #18878
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Chore: Upgrade lint tools in order to work with Go 1.13
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Chore: Fix Go linting issues
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Build: use golangci-lint as a make command
* Since gometalinter was deprecated in favor of golangci-lint so it was
replaced by it. Responsibilities held by the gometalinter was moved to
golangci-lint
* There was some changes in implementation (that was also mentioned in
the code comment) between the tools, which uncovered couple errors
in the code. Those issues were either solved or disabled by
the inline comments
* Introduce the golangci-lint config, to make their
configuration more manageable
* Build: replace backend-lint.sh script with make
* tsdb: add support for setting debug flag of tsdb query
* alerting: adds debug flag in eval context
Debug flag is set when testing an alert rule and this debug
flag is used to return more debug information in test aler rule
response. This debug flag is also provided to tsdb queries so
datasources can optionally add support for returning additional
debug data
* alerting: improve test alert rule ui
Adds buttons for expand/collapse json and copy json to clipboard,
very similar to how the query inspector works.
* elasticsearch: implement support for tsdb query debug flag
* elasticsearch: embedding client response in struct
* alerting: return proper query model when testing rule
This fixes a regression introduced in #16646 where using Elasticsearch
pre-v7.0 and alerting resulted in an error when trying to deserialize the
response of total number of hits.
Total number of hits is not in use by the backend so we're removing it
for now to make ES 6 and 7 being able to deserialize search responses
without errors.
Closes#15622
Adds a new version option 7.0+ (70 internally).
Version 7.0+ doesn't include document types in index mappings
so support for handling this have been added.
Version 7.0+ returns number of hits in a different way so
support for handling this have been added.
Version 7.0+ doesn't support sending
max_concurrent_shard_requests in multisearch header so
support for sending this in query string have been added.
Update elastic6 docker block and dashboards (devenv) to use
6.7.1 images, filebeat index name is now filebeat-YYYY.MM.DD
and dashboard include correct tags and links.
Add elastic7 docker block and provisioning (devenv).
Updates documentation regarding new version.
Closes#15622
* Store passwords in secureJsonData
* Revert unnecessary refactors
* Fix for nil jsonSecureData value
* Remove copied encryption code from migration
* Fix wrong field reference
* Remove migration and provisioning changes
* Use password getters in datasource proxy
* Refactor password handling in datasource configs
* Add provisioning warnings
* Update documentation
* Remove migration command, moved to separate PR
* Remove unused code
* Set the upgrade version
* Remove unused code
* Remove double reference
When weekly index pattern is used, indices names contain single digit week number for week 1-9
This fix makes sure indice names always contain 2 digit week number for weekly pattern
See,
$ find . -type f | xargs misspell -locale US | grep -vi -e vendor -e devenv -e Unknwon -e Destory | grep pkg
./pkg/services/sqlstore/org_test.go:190:15: "frome" is a misspelling of "from"
./pkg/tsdb/elasticsearch/response_parser.go:544:24: "Unkown" is a misspelling of "Unknown"
./pkg/tsdb/opentsdb/opentsdb.go:87:20: "marshalling" is a misspelling of "marshaling"
./pkg/components/dynmap/dynmap_test.go:2:7: "Licence" is a misspelling of "License"
./pkg/components/dynmap/dynmap.go:2:7: "Licence" is a misspelling of "License"
See,
$ gometalinter --vendor --disable-all --enable=megacheck --disable=gotype --deadline 6m ./...
pkg/tsdb/elasticsearch/client/client_test.go:28:25⚠️ do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012) (megacheck)
pkg/tsdb/elasticsearch/client/client_test.go:39:25⚠️ do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012) (megacheck)
pkg/tsdb/elasticsearch/client/client_test.go:51:25⚠️ do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012) (megacheck)
pkg/tsdb/elasticsearch/client/client_test.go:63:25⚠️ do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012) (megacheck)
pkg/tsdb/elasticsearch/client/client_test.go:76:25⚠️ do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012) (megacheck)
pkg/tsdb/elasticsearch/client/client_test.go:89:25⚠️ do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012) (megacheck)
See,
$ gometalinter --vendor --disable-all --enable=goconst --disable=gotype --deadline=6m ./...
build.go:113:15⚠️ 2 other occurrence(s) of "linux" found in: build.go:119:15 build.go:491:34 (goconst)
build.go:119:15⚠️ 2 other occurrence(s) of "linux" found in: build.go:113:15 build.go:491:34 (goconst)
build.go:491:34⚠️ 2 other occurrence(s) of "linux" found in: build.go:113:15 build.go:119:15 (goconst)
build.go:381:21⚠️ 2 other occurrence(s) of "windows" found in: build.go:423:13 build.go:487:13 (goconst)
build.go:423:13⚠️ 2 other occurrence(s) of "windows" found in: build.go:381:21 build.go:487:13 (goconst)
build.go:487:13⚠️ 2 other occurrence(s) of "windows" found in: build.go:381:21 build.go:423:13 (goconst)
pkg/api/dashboard.go:67:22⚠️ 5 other occurrence(s) of "Anonymous" found in: pkg/api/dashboard.go:67:35 pkg/api/dashboard.go:131:10 pkg/api/dashboard.go:406:13 pkg/api/folder.go:98:22 pkg/api/folder.go:98:35 (goconst)
pkg/api/dashboard.go:67:35⚠️ 5 other occurrence(s) of "Anonymous" found in: pkg/api/dashboard.go:67:22 pkg/api/dashboard.go:131:10 pkg/api/dashboard.go:406:13 pkg/api/folder.go:98:22 pkg/api/folder.go:98:35 (goconst)
pkg/api/dashboard.go:131:10⚠️ 5 other occurrence(s) of "Anonymous" found in: pkg/api/dashboard.go:67:22 pkg/api/dashboard.go:67:35 pkg/api/dashboard.go:406:13 pkg/api/folder.go:98:22 pkg/api/folder.go:98:35 (goconst)
pkg/api/dashboard.go:406:13⚠️ 5 other occurrence(s) of "Anonymous" found in: pkg/api/dashboard.go:67:22 pkg/api/dashboard.go:67:35 pkg/api/dashboard.go:131:10 pkg/api/folder.go:98:22 pkg/api/folder.go:98:35 (goconst)
pkg/api/folder.go:98:22⚠️ 5 other occurrence(s) of "Anonymous" found in: pkg/api/dashboard.go:67:22 pkg/api/dashboard.go:67:35 pkg/api/dashboard.go:131:10 pkg/api/dashboard.go:406:13 pkg/api/folder.go:98:35 (goconst)
pkg/api/folder.go:98:35⚠️ 5 other occurrence(s) of "Anonymous" found in: pkg/api/dashboard.go:67:22 pkg/api/dashboard.go:67:35 pkg/api/dashboard.go:131:10 pkg/api/dashboard.go:406:13 pkg/api/folder.go:98:22 (goconst)
pkg/api/index.go:63:47⚠️ 2 other occurrence(s) of "light" found
in: pkg/api/index.go:91:22 pkg/api/index.go:93:16 (goconst)
pkg/api/index.go:91:22⚠️ 2 other occurrence(s) of "light" found in: pkg/api/index.go:63:47 pkg/api/index.go:93:16 (goconst)
pkg/api/index.go:93:16⚠️ 2 other occurrence(s) of "light" found in: pkg/api/index.go:63:47 pkg/api/index.go:91:22 (goconst)
pkg/components/null/float.go:71:25⚠️ 2 other occurrence(s) of "null" found in: pkg/components/null/float.go:103:10 pkg/components/null/float.go:112:10 (goconst)
pkg/components/null/float.go:103:10⚠️ 2 other occurrence(s) of "null" found in: pkg/components/null/float.go:71:25 pkg/components/null/float.go:112:10 (goconst)
pkg/components/null/float.go:112:10⚠️ 2 other occurrence(s) of "null" found in: pkg/components/null/float.go:71:25 pkg/components/null/float.go:103:10 (goconst)
pkg/services/alerting/notifiers/pagerduty.go:79:16⚠️ 2 other occurrence(s) of "Triggered metrics:\n\n" found in: pkg/services/alerting/notifiers/kafka.go:64:16 pkg/services/alerting/notifiers/opsgenie.go:98:16 (goconst)
pkg/services/alerting/notifiers/kafka.go:64:16⚠️ 2 other occurrence(s) of "Triggered metrics:\n\n" found in: pkg/services/alerting/notifiers/pagerduty.go:79:16 pkg/services/alerting/notifiers/opsgenie.go:98:16 (goconst)
pkg/services/alerting/notifiers/opsgenie.go:98:16⚠️ 2 other occurrence(s) of "Triggered metrics:\n\n" found in: pkg/services/alerting/notifiers/pagerduty.go:79:16 pkg/services/alerting/notifiers/kafka.go:64:16 (goconst)
pkg/social/social.go:85:11⚠️ 2 other occurrence(s) of "grafana_com" found in: pkg/social/social.go:162:14 pkg/social/social.go:197:11 (goconst)
pkg/social/social.go:162:14⚠️ 2 other occurrence(s) of "grafana_com" found in: pkg/social/social.go:85:11 pkg/social/social.go:197:11 (goconst)
pkg/social/social.go:197:11⚠️ 2 other occurrence(s) of "grafana_com" found in: pkg/social/social.go:85:11 pkg/social/social.go:162:14 (goconst)
pkg/tsdb/elasticsearch/time_series_query.go:92:17⚠️ 3 other occurrence(s) of "count" found in: pkg/tsdb/elasticsearch/response_parser.go:152:8 pkg/tsdb/elasticsearch/response_parser.go:167:31 pkg/tsdb/elasticsearch/response_parser.go:315:9 (goconst)
pkg/tsdb/elasticsearch/response_parser.go:152:8⚠️ 3 other occurrence(s) of "count" found in: pkg/tsdb/elasticsearch/time_series_query.go:92:17 pkg/tsdb/elasticsearch/response_parser.go:167:31 pkg/tsdb/elasticsearch/response_parser.go:315:9 (goconst)
pkg/tsdb/elasticsearch/response_parser.go:167:31⚠️ 3 other occurrence(s) of "count" found in: pkg/tsdb/elasticsearch/time_series_query.go:92:17 pkg/tsdb/elasticsearch/response_parser.go:152:8 pkg/tsdb/elasticsearch/response_parser.go:315:9 (goconst)
pkg/tsdb/elasticsearch/response_parser.go:315:9⚠️ 3 other occurrence(s) of "count" found in: pkg/tsdb/elasticsearch/time_series_query.go:92:17 pkg/tsdb/elasticsearch/response_parser.go:152:8 pkg/tsdb/elasticsearch/response_parser.go:167:31 (goconst)
pkg/tsdb/elasticsearch/time_series_query.go:78:9⚠️ 2 other occurrence(s) of "date_histogram" found in: pkg/tsdb/elasticsearch/response_parser.go:84:22 pkg/tsdb/elasticsearch/response_parser.go:369:24 (goconst)
pkg/tsdb/elasticsearch/response_parser.go:84:22⚠️ 2 other occurrence(s) of "date_histogram" found in: pkg/tsdb/elasticsearch/time_series_query.go:78:9 pkg/tsdb/elasticsearch/response_parser.go:369:24 (goconst)
pkg/tsdb/elasticsearch/response_parser.go:369:24⚠️ 2 other occurrence(s) of "date_histogram" found in: pkg/tsdb/elasticsearch/time_series_query.go:78:9 pkg/tsdb/elasticsearch/response_parser.go:84:22 (goconst)
See,
$ gometalinter --disable-all --enable misspell --deadline 10m --vendor ./...
pkg/api/dtos/alerting_test.go:32:13⚠️ "expectes" is a misspelling of "expects" (misspell)
pkg/api/static/static.go:2:18⚠️ "Unknwon" is a misspelling of "Unknown" (misspell)
pkg/components/imguploader/azureblobuploader.go:55:48⚠️ "conatiner" is a misspelling of "container" (misspell)
pkg/login/ldap_settings.go:51:115⚠️ "compatability" is a misspelling of "compatibility" (misspell)
pkg/middleware/auth_proxy_test.go:122:22⚠️ "Destory" is a misspelling of "Destroy" (misspell)
pkg/middleware/logger.go:2:18⚠️ "Unknwon" is a misspelling of "Unknown" (misspell)
pkg/services/notifications/codes.go:9:13⚠️ "Unknwon" is a misspelling of "Unknown" (misspell)
pkg/services/session/mysql.go:170:3⚠️ "Destory" is a misspelling of "Destroy" (misspell)
pkg/services/session/mysql.go:171:24⚠️ "Destory" is a misspelling of "Destroy" (misspell)
pkg/services/session/session.go:95:4⚠️ "Destory" is a misspelling of "Destroy" (misspell)
pkg/services/session/session.go:96:1⚠️ "Destory" is a misspelling of "Destroy" (misspell)
pkg/services/session/session.go:167:25⚠️ "Destory" is a misspelling of "Destroy" (misspell)
pkg/setting/setting.go:1:18⚠️ "Unknwon" is a misspelling of "Unknown" (misspell)
pkg/tsdb/cloudwatch/cloudwatch.go:199:14⚠️ "resolutin" is a misspelling of "resolutions" (misspell)
pkg/tsdb/cloudwatch/cloudwatch.go:270:15⚠️ "resolutin" is a misspelling of "resolutions" (misspell)
pkg/tsdb/elasticsearch/response_parser.go:531:24⚠️ "Unkown" is a misspelling of "Unknown" (misspell)
pkg/tsdb/elasticsearch/client/search_request.go:113:7⚠️ "initaite" is a misspelling of "initiate" (misspell)
Note: Unknwon is a library name, and Destory a mysql typo.
$ gometalinter --vendor --disable=all --enable=megacheck --deadline=10m ./...
pkg/tsdb/elasticsearch/client/client.go:147:13⚠️ should use time.Since instead of time.Now().Sub (S1012) (megacheck)
pkg/tsdb/elasticsearch/client/client.go:190:14⚠️ should use time.Since instead of time.Now().Sub (S1012) (megacheck)
pkg/tsdb/elasticsearch/client/client.go:218:13⚠️ should use time.Since instead of time.Now().Sub (S1012) (megacheck)
Removes moment dependency.
Adds response parser tests (based on frontend tests).
Adds time series query tests (based on frontend tests).
Fixes various issues related to response parsing and building search request queries.
Added support for extended stats metrics and geo hash grid aggregations.