* Alerting: Update migration to put alerts to the default folder if dashboard folder is missing (#65577)
* extract function
* use context logger
* put alert to general folder if folder is missing
* move folderHelper init
* add test
* Update pkg/services/sqlstore/migrations/ualert/ualert.go
Co-authored-by: Matthew Jacobson <matthew.jacobson@grafana.com>
---------
Co-authored-by: Matthew Jacobson <matthew.jacobson@grafana.com>
(cherry picked from commit 7b2f44762e)
* rename ID to Id and dashboards.Dashboard to models.Dashboard
---------
Co-authored-by: Yuri Tseretyan <yuriy.tseretyan@grafana.com>
* CI: Split subcommand (#66005)
* Update e2e package
- Ensure health request is monitored for addDatasource flow
- Add custom timeout to configurePanel flow
(cherry picked from commit 155fcae4aa)
* Make health check optional
(cherry picked from commit 91f66d61e1)
---------
Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
Build: Add CloudMode to build versions (#65651)
* Add CloudMode to build versions
* Use linux-amd64 variant without musl for cloud mode
* Add cloud mode to version folder on package upload
* Use musl variant for CloudMode
* Only sign rpm packages if there's any to sign
* Remove trailing whitespace
(cherry picked from commit 8f282b8a6e)
Co-authored-by: Guilherme Caulada <guilherme.caulada@grafana.com>
Alerting: Fix integration test for creating silences (#65722)
* fix integration test for creating silences
to create correct silence with endsAt in the future
* Update api_alertmanager_test.go
(cherry picked from commit ed8628e39d)
Co-authored-by: Yuri Tseretyan <yuriy.tseretyan@grafana.com>
CI: Allow overwriting of existing GitHub release assets (#65127)
* CI: Allow overwriting of existing GitHub release assets
This closes#63698
* Use c for *cli.Context in publishgithub.go
(cherry picked from commit 4ab3bd6f7e)
Co-authored-by: Horst Gutmann <horst.gutmann@grafana.com>
Alerting: Update scheduler to get updates only from database (#64635)
* stop using the scheduler's Update and Delete methods all communication must be via the database
* update scheduler's registry to calculate diff before re-setting the cache
* update fetcher to return the diff generated by registry
* update processTick to update rule eval routine if the rule was updated and it is not going to be evaluated at this tick.
* remove references to the scheduler from api package
* remove unused methods in the scheduler
(cherry picked from commit 85a954cd81)
# Conflicts:
# pkg/services/ngalert/api/api_ruler.go
# pkg/services/ngalert/ngalert.go
# pkg/services/ngalert/ngalert_test.go
# pkg/services/ngalert/schedule/schedule.go
# pkg/services/ngalert/schedule/schedule_mock.go
# pkg/services/ngalert/schedule/schedule_unit_test.go
CI: Add `PrereleaseBucket` field in `versions.go` (#64519)
Add PrereleaseBucket in versions.go
(cherry picked from commit 29b3f3fbf4)
Co-authored-by: Dimitris Sotirakis <dimitrios.sotirakis@grafana.com>
* Alerting: Update Prometheus Alertmanager
* Move to TruncateInRunes
* Use updated FromGlobs signature
* Avoid indirection around InhibitRule based on 61810
* Work around new API for nflog
* One more template FromGlobs api change
* One more FromGlobs change in test files. Searched for them all...
* Missing line from cherrypicked change
* Run maintenance on correct state object
---------
Co-authored-by: Alex Weaver <weaver.alex.d@gmail.com>
Docker Build: Use `tonistiigi/binfmt` image for cross compilation (#64108)
* Change docker image used for cross-compilation
* Replace fmt.Println with log.Println
* Add specific tag for docker image
(cherry picked from commit b42fd92fad)
Co-authored-by: Dimitris Sotirakis <dimitrios.sotirakis@grafana.com>
NPM: Stop using the folder path before the name path (#63851)
Stop using the folder path before the name path
(cherry picked from commit 177aa254c5)
Co-authored-by: Dimitris Sotirakis <dimitrios.sotirakis@grafana.com>
MSSQL Datasource: Revert functions within macros change (#63592)
* Revert functions within macros change
* Add tests for function and macro for mssql
* Remove macro support tests
---------
Co-authored-by: Oscar Kilhed <oscar.kilhed@grafana.com>
(cherry picked from commit 356e2e1933)
Co-authored-by: Kyle Cunningham <codeincarnate@users.noreply.github.com>
Alerting: Fix incorrect comment in eval.go (#63510)
This commit fixes an incorrect comment in the Result struct in eval.go
that I had written some time ago. The comment now documents the
actual behaviour and content of this field.
(cherry picked from commit f93a9c794d)
Co-authored-by: George Robinson <george.robinson@grafana.com>
Alerting: Fix a bug taking screenshots with Dashboard UID (#63220)
This commit fixes a bug where Grafana would fail to take a screenshot if
the same Dashboard UID was present across two or more different orgs.
(cherry picked from commit 1f984409a2)
Annotations: Fix EpochEnd being zero for Alert-generated annotations (#60931)
* Revert linter suggestion
* Re-add nolint
* Work in terms of pointer rather than copy
* Add tests covering validation
* Add comment
(cherry picked from commit 1381fb6dfc)
Co-authored-by: Alexander Weaver <weaver.alex.d@gmail.com>
* Alerting: Fix template validation in provisioning api (#62530)
* Alerting: Fix template validation in provisioning api
Fix issue where provisioning API accepts a malformed template having extra
text outside of definition block and template name matching definition name.
(cherry picked from commit f9ec16e74f)
---------
Co-authored-by: Matthew Jacobson <matthew.jacobson@grafana.com>
* Server: Switch from separate server & cli to a unified grafana binary (#58286)
* avoid the need for a second bulky binary for grafana-cli
* look for grafana-server in $PATH as well as same directory
* implement unified "grafana" command
* update dockerfiles, fix grafana-cli -v
* update packaging to work with single binary
- add wrapper scripts for grafana and grafana-server
- update and sync package files
- implement --sign flag of build package command
- stop packaging scripts folder, they are not useful for end users
- add support for --configOverrides in server command
- remove unused nfpm.yaml config file
* windows support
(cherry picked from commit de99ce139c)
* Build: don't remove grafana-server and grafana-cli binaries from deb and rpm packages (#59890)
* don't remove grafana-server and grafana-cli binaries from /usr/share/grafana/bin in deb and rpm packages
* don't add config overrides in /usr/sbin/grafana-server
---------
Co-authored-by: Dan Cech <dcech@grafana.com>
Expressions: Fixes the issue showing expressions editor (#62510)
* Use suggested value for uid
* update the snapshot
* use __expr__
* replace all -100 with __expr__
* update snapshot
* more changes
* revert redundant change
* Use expr.DatasourceUID where it's possible
* generate files
(cherry picked from commit 91221bc436)
Auth: Fix catch both both ErrInvalidAPIKey for context with APIKey (#62193)
* fix: capture both ErrInvalidAPIKey
* rename of variable
(cherry picked from commit c5cb5be3cc)
Co-authored-by: Eric Leijonmarck <eric.leijonmarck@gmail.com>
Encryption: Cache new DEKs (only) after a caution period (#60664)
* Encryption: Cache new DEKs (only) after commit
* Fix typo
* Update secrets manager tests with new failing case
* Update secrets manager tests with new clarifications (comments)
* Correct broken method calls
* Unify methods
* Cache data keys only after a caution period
* Caution period for data keys caching only for encrypt ops
(cherry picked from commit c4e067d49d)
Co-authored-by: Joan López de la Franca Beltran <5459617+joanlopez@users.noreply.github.com>
Oauth: Remove extra decoding of redirect url (#60875)
Oauth: remove extra decoding of redirect cookie url
(cherry picked from commit 5b4e1ee6fc)
Co-authored-by: Karl Persson <kalle.persson@grafana.com>
Datasources: Fix Proxy by UID Failing for UIDs with a Hyphen (#61723)
Fix Proxy by UID Failing for UIDs with a Hyphen
Hyphens are allowed in short IDs but not picked up by the
proxyPathRegexp. This caused the end of the uid to be proxied as part of
the path to the backing datasource which would usually cause a 404.
(cherry picked from commit f85d072c17)
Co-authored-by: Chris Marchbanks <csmarchbanks@gmail.com>
Elasticsearch: Fix failing requests when using SigV4 (#61923)
fix setting of `es` servicename
(cherry picked from commit c5610450b2)
Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>
Plugins: enable the plugin sdk to get the json data for all datasources (#61729)
(cherry picked from commit 3b718a3e8f)
Co-authored-by: Stephanie Hingtgen <stephanie.hingtgen@grafana.com>
Auth: Fix correct error for updateapikey in context handler (#61544)
* fix: correct error for updateapikey
* refactor: send the correct err forward
* update: based on review
(cherry picked from commit 07bbc0716c)
Co-authored-by: Eric Leijonmarck <eric.leijonmarck@gmail.com>
* Alerting: Set error annotation on EvaluationError regardless of underlying error type (#61506)
Set error annotation regardless of underlying error type
(cherry picked from commit b289b8ac6e)
* Also cherrypick the nilcheck that got added prior to 9.4
Alerting: Fix conversion of alert state from db state during manager warmup (#60933)
(cherry picked from commit 4d989860fb)
Co-authored-by: Yuri Tseretyan <yuriy.tseretyan@grafana.com>
Plugins: add option to proxy ds connections through a secure socks proxy (#59254)
* Plugins: add feature to proxy data source connections
(cherry picked from commit 6805c951e9)