* 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)
Plugins: Fix plugin query help markdown (#60485)
* refactor(pluginhelp): rewrite as functional component with useAsync
* mimic old behaviour
* feat(pluginhelp): display message if backend returned an empty string
Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
(cherry picked from commit 9aed364898)
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
fix(cli): correct wire binding for reset-admin-password
The cli methods were updated to use the db.DB interface, but that interface was still wired in as the fake DB - it had only been used for tests previously. This isn't an issue in the main branch now that it's been collapsed into a single binary all using the same wire graph.
Fixes#59915
Alerting: Prevent uid collision in migration when db is case-insensitive (#60494)
* Alerting: Prevent short uid collision in legacy migration when db is case-insensitive
Two factors come into play that cause sporadic uid conflicts during legacy alert migration:
- MySQL and MySQL-compatible backends use case-insensitive collation.
- Our short uid generator is not a uniform RNG and generates uids in such a way that generations in quick succession have a higher probability of creating similar uids.
Normally we would be guaranteed unique short uid generation, however if the source alphabet contains
duplicate characters (for example, if we use case-insensitive comparison) this guarantee is void.
Generating even ~1000 uids in quick succession is nearly guaranteed to create a case-insensitive
duplicate.
(cherry picked from commit 570b62091c)
Co-authored-by: Matthew Jacobson <matthew.jacobson@grafana.com>
Prometheus: Fix Instant query time calculation (#60815)
* Use single point in time instead of doing time range calculation
* Comment update
(cherry picked from commit 15d32546ea)
AzureMonitor: Set Logs portal URL from resource URI (#60583)
Set URL based off of resource URI
(cherry picked from commit f3f043e097)
Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
AzureMonitor: Correctly set filter values in portal URL (#60627)
* Correctly set filter values in portal URL
* Refactor to include dimensions as a part of AzureMonitor query
* Correctly set splitting value in URL
- Add type for dimension filters object
* Update tests
* Don't test dimensions
(cherry picked from commit 2e4bc200f5)
Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
Plugins: Fix parsing of Azure settings for plugins (#60611)
Fix parsing of Azure settings for plugins
(cherry picked from commit 96b7fb15de)
Co-authored-by: Sergey Kostrukov <sekost@microsoft.com>
RBAC: Fix DeleteUserPermissions not being called on Upsert org sync (#60531)
* fix DeleteUserPermissions not being called on RemoveOrgUser
* do not error out of auth flow
* fix test missing service
(cherry picked from commit 77786f236a)
Co-authored-by: Jo <joao.guerreiro@grafana.com>
Prometheus: Fix X-Id-Token and X-ID-Token sent to Prometheus in query requests (#60342)
* Prometheus: Use Set rather than map assignment in sdkHeaderToHttpHeader
Fixes#59940
* Prometheus: Add TestPrometheusCanonicalHeaders
(cherry picked from commit 92c01e416e)
Co-authored-by: Giuseppe Guerra <giuseppe.guerra@grafana.com>
Prometheus: Add POST support to client (#60243)
* Prometheus: Add POST support to client
* Prometheus: Revert client test change from 1c503908
(cherry picked from commit 055c3b7332)
Co-authored-by: Fionera <fionera@fionera.de>
Alerting: Set Dashboard and Panel IDs on rule group replacement (#60374)
* Set Dashboard and Panel IDs on rule group replacement
* fix comments and abbreviate test variable name
* Update pkg/services/ngalert/provisioning/alert_rules.go
Co-authored-by: Jean-Philippe Quéméner <JohnnyQQQQ@users.noreply.github.com>
Co-authored-by: Jean-Philippe Quéméner <JohnnyQQQQ@users.noreply.github.com>
(cherry picked from commit 174c61b949)
Co-authored-by: Alex Moreno <alexander.moreno@grafana.com>
Navigation: Fix some missing pages in admin section (#60143)
* add stats and licensing under admin -> general when topnav is enabled
* add ldap to users and access
* use ID instead of Id
* add enterprise licensing node
(cherry picked from commit 39a4ba4396)
Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
Chore: All tests under pkg/tests should be integration tests (#59521)
* Chore: All tests under pkg/tests should be integrationtests
* run alerting integration tests only for sqlite
(cherry picked from commit 2db8ed9441)
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
Navigation: Prevent app crash when importing a dashboard with a uid of `home` (#59874)
* change home id to be more unique, refactor so that home circular reference is never created
* prefix starred dashboards
* update reducer
(cherry picked from commit a589929c92)
Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
Login: Fix failure to login a new user via an external provider if quota are enabled (#60015)
* Login: Fix failure to login a new user via an external provider if quota are enabled
(cherry picked from commit 341d7b01ee)
Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
Alerting: Use the QuotaTargetSrv instead of the QuotaTarget in quota check (#60026)
Before this change, the alerting provisioning system incorrectly used
the QuotaTarget to check if alerting's request quota had been reached.
The quota service requires the QuotaTargetSrv, which is what's
registered with the service at startup time. This is leading to errors
in the provisioning system.
(cherry picked from commit e6743a7e9a)
Co-authored-by: Joe Blubaugh <joe.blubaugh@grafana.com>
ServiceAccounts: Do not display warnings about secret scanner when scanner is disabled (#59952)
ServiceAccounts: Fix warnings about secret scanner when scanner is disabled
(cherry picked from commit d833031726)
Co-authored-by: Jo <joao.guerreiro@grafana.com>