* Alerting: Validate contact point configuration during the migration
This minimises the chances of generating broken configuration as part of the migration. Originally, we wanted to generate it and not produce a hard stop in Grafana but this strategy has the chance to avoid delivering notifications for our users.
We now think it's better to hard stop the migration and let the user take care of resolving the configuration manually.
* Protect datasource tsdb and proxy endpoints with access control
* Add datasource query permissions to fixed admin role
Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
Co-authored-by: Mitch Seaman <mjseaman@users.noreply.github.com>
* avoid duplicate allocations
* set labels
* Replace NaN in matrix with null
* Refactor and add test
* Update test
* Append response only if no error
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
* Add extra fields to OSS types to support enterprise
* Create a service account at the same time as the API key
* Use service account credentials when accessing API with APIkey
* Add GetRole to service, merge RoleDTO and Role structs
This patch merges the identical OSS and Enterprise data structures, which improves the code for two reasons:
1. Makes switching between OSS and Enterprise easier
2. Reduces the chance of incompatibilities developing between the same functions in OSS and Enterprise
* If API key is not linked to a service account, continue login as usual
* Fallback to old auth if no service account linked to key
* Add CloneUserToServiceAccount
* Adding LinkAPIKeyToServiceAccount
* Handle api key link error
* Better error messages for OSS accesscontrol
* Set an invalid user id as default
* Re-arrange field names
* ServiceAccountId is integer
* Better error messages
Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com>
Co-authored-by: Eric Leijonmarck <eric.leijonmarck@gmail.com>
Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
* update loki
* install openssl from alpine's edge repository
* extracttraceid moved to tracing package
* remove exit if warning limit is exceeded
* disable flaky libraryelements test
* context all the things
* apply feedback
* rollback some alerting changes
* rollback some alerting changes #2
* more rollbacks
* more rollbacks #2
* more rollbacks #3
* more rollbacks #4
* fix integration test
* add missing context
* add missing and remove incorrect dispatch
* Add global week start option to shared preferences
* Add default_week_start to configuration docs
* Add week start option to dashboards
* Add week start argument to tsdb time range parser
* Fix strict check issues
* Add tests for week start
* Change wording on default_week_start documentation
Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
* Update week_start column to be a nullable field
Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
* Update configuration to include browser option
* Update WeekStartPicker container selector
Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com>
* Add menuShouldPortal to WeekStartPicker to remove deprecation warning
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Add inputId to WeekStartPicker
* Use e2e selector on WeekStartPicker aria-label
* Simplify WeekStartPicker onChange condition
* Specify value type on WeekStartPicker weekStarts
* Remove setWeekStart side effect from reducer
* Fix updateLocale failing to reset week start
* Store week start as string to handle empty values
Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com>
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Remove Convey from dashboards
* Add context for dashboards
* Remove Convey from dashboards
* refactor tests to run setup each time
* Fix last tests
* Adjust after rebase
* Remove print statement
Co-authored-by: Serge Zaitsev <serge.zaitsev@grafana.com>
* Fix processing for table in dashboard - expolre compatible
* Add processing of histograms
* Interpolsate rate_interval in step field
* Add tests
* Fix function name
* Extract internal range and interval variables to constants
* Fix typings, refactor, simplify
* Fix constant that was missing _ms
* Alerting: Remove invalid Slack URL as we migrate notification channels
Grafana will accept any type of utf8 valid string as the Slack URL and will simply fail as we try to deliver the notification of the channel. The Alertmanager will fail to apply a configuration if the URL of the Slack Receiver is invalid.
This change takes that into account by removing the URL for the receiver as we migrate notification channels that do not pass the url validation. As we assume the notification was not being delivered to being with.
* Add a log line when we modify the channel
Co-authored-by: Yuriy Tseretyan <yuriy.tseretyan@grafana.com>
* Alerting: Fixes a bug when trying to sync broken alertmanager config
Broken alertmanager configuration has the potential to be introduced as part of a migration e.g. due to incompatible data between what grafana accepts and what the Alertmanager expects. When this happens, we expect an eventually consistent behaviour where we'll keep trying to apply the configuration until it works.
As part of change in https://github.com/grafana/grafana/pull/39237 we introduced a regression that modified this behaviour and instead tried to create a new Alertmanager for that organization everytime, which eventually ended up in a panic due to a duplicate metrics being registered.
This PR fixes that and introduces a test to catch further regressions.
* Remove disable orgs
* Prometheus: Run Explore both queries trough backend
* Refactor, simplify
* Set default values for query type selector
* Run multiple queries as one query trough backend
* Remove trailing newlines
* Pass utcOffset
* Remove trailing comma
* WIP: Implementatioon of exemplars
* add sampling for exemplars
* Refactor to use response as custom metadata
* Simplify processing of exemplars
* Update, clean up
* Refactor the way how we get available exemplars
* Simplify exemplars disabling and running on frontend
* Add tests
* Update toggle
* Remove console log
* Fix go linting
* Fix e2e test
* Trigger Build
* Compare lengts, small fix
* Remove duplicated time check
* Address feedback
* Remove redundant ! as not needed
* Update