Commit Graph

3828 Commits

Author SHA1 Message Date
Ryan McKinley
b6a9b9804d
Plugin admin: Add a page to show where panel plugins are used in dashboards (#50909) 2022-06-27 20:23:43 -04:00
Jean-Philippe Quéméner
cd0fefec5b
Alerting: change optimistic lock to use proper insert select (#51461)
* Alerting: change optimistic lock to proper insert select

* remove debug logging

* fix postgres

* fix mysql

* remove empty line for go-lint

* add some docs

* use constants
2022-06-28 00:20:21 +02:00
Yuriy Tseretyan
94e709fdcb
Alerting: Simplify eval.Evaluator interface (#51463)
* remove ExpressionService from argument list of Evaluator's methods
2022-06-27 17:40:44 -04:00
Jean-Philippe Quéméner
bf255965a2
Alerting: prevent the use of the same uid across all contact points (#51440)
* Alerting: prevent the use of the same uid across all contact points

* Update pkg/services/ngalert/provisioning/contactpoints.go

Co-authored-by: Yuriy Tseretyan <yuriy.tseretyan@grafana.com>

Co-authored-by: Yuriy Tseretyan <yuriy.tseretyan@grafana.com>
2022-06-27 12:57:47 -04:00
Kristin Laemmert
945f015770
backend/datasources: move datasources models into the datasources service package (#51267)
* backend/datasources: move datasources models into the datasources service pkg
2022-06-27 12:23:15 -04:00
Yuriy Tseretyan
78c012df65
move eval_conditions to API models package (#51447) 2022-06-27 11:52:41 -04:00
Alexander Emelin
120c92b950
Search: Fix indexing - re-index after initial provisioning (#50959) 2022-06-27 18:11:08 +03:00
Ashley Harrison
ee3f4f1709
Navigation: Display Starred dashboards in the Navbar (#51038)
* remove feature toggle, add empty state and fix bug with initial starring

* Extract empty message into lingui

* remove full stop

* add empty message in the backend

* remove unused import

* translate starred + empty starred states

* betterer changes
2022-06-27 15:41:00 +01:00
Vardan Torosyan
f1661166b2
Service accounts: Grafana service accounts are enabled by default (#51402)
* Remove feature flag for service accounts

* Fix failing tests and remove remaining usage

* Fix failing tests and remove remaining usage
2022-06-27 10:22:49 +02:00
Sofia Papagiannaki
1399ab50b3
API: Universal swagger generation (#51033) 2022-06-27 10:54:31 +03:00
Jguer
0689c5839a
Auth: Add option for case insensitive login (#49262)
* add case insensitive option

* treat id as case insensitive

* Users: Add integration tests for case insensitive querying

* Prefer config struct to global variable

* change key to case_insensitive_login

* impede conflicting users from logging in

* add tests for impeding user retrieval if conflicting

* nits and picks

Co-authored-by: gamab <gabi.mabs@gmail.com>

* Add check in transaction for conflicting user

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>

* add update tests

* skip on mysql

* add custom messages for user admin view

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>

* nit: extra else

* linting mistake

Co-authored-by: gamab <gabi.mabs@gmail.com>
Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
2022-06-24 16:59:45 +02:00
George Robinson
dc68213114
Alerting: Remove fmt.Println from Threema (#51380) 2022-06-24 14:50:53 +01:00
Ezequiel Victorero
9e80e44b45
Public Dashboards: fix updating public dashboard configuration (#51350)
* Public Dashboards: fix updating public dashboard configuration
2022-06-23 18:44:59 -03:00
Alexander Weaver
0d9389e1f4
Alerting: Code-gen parsing of URL parameters and fix related bugs (#50731)
* Extend template and generate

* Generate and fix up alertmanager endpoints

* Prometheus routes

* fix up Testing endpoints

* touch up ruler API

* Update provisioning and fix 500

* Drop dead code

* Remove more dead code

* Resolve merge conflicts
2022-06-23 15:13:39 -05:00
Ryan McKinley
dd5a3b7747
Heatmap: Replace the heatmap panel with new implementation (#50229) 2022-06-23 11:48:28 -07:00
Ezequiel Victorero
4c4d6fd425
PublicDashboards: collect stats for public dashboards (#50553)
* PublicDashboards: collect stats for public dashboards
2022-06-23 12:02:57 -03:00
Karl Persson
b9bb0513e3
Remove version property from fixed roles (#51298) 2022-06-23 12:09:03 +02:00
Selene
ecc15a2f71
KVStore: Extend kvstore to retrieve all items (#50848)
* Extend kvstore to retrieve all items

* Fix comment

* Fix tests

* Change test order

* Move test outside to avoid order conditions

* Update Items to GetAll function and return a map

* Add explanation of map result

* Add description comment

Co-authored-by: Tania B <yalyna.ts@gmail.com>
2022-06-23 11:12:07 +02:00
owensmallwood
1802cc8aca
Add correct table definition for migrations for old dashboard_public schema (#51292)
Co-authored-by: Jesse Weaver <jesse.weaver@grafana.com>
2022-06-22 15:35:33 -08:00
Jeff Levin
d076bedb5e
public dashboards: finalize db schema & v1 feature complete (#50467)
This PR completes public dashboards v1 functionality and simplifies public dashboard conventions. It exists as a large PR so that we are not making constant changes to the database schema.

models.PublicDashboardConfig model replaced with models.PublicDashboard directly
dashboard_public_config table renamed to dashboard_public
models.Dashboard.IsPublic removed from the dashboard and replaced with models.PublicDashboard.isEnabled
Routing now uses a uuid v4 as an access token for viewing a public dashboard anonymously, PublicDashboard.Uid only used as database identifier
Frontend utilizes uuid for auth'd operations and access token for anonymous access
Default to time range defined on dashboard when viewing public dashboard
Add audit fields to public dashboard

Co-authored-by: Owen Smallwood <owen.smallwood@grafana.com>, Ezequiel Victorero <ezequiel.victorero@grafana.com>, Jesse Weaver <jesse.weaver@grafana.com>
2022-06-22 13:58:52 -08:00
Yuriy Tseretyan
ee5bcf2b96
make test more stable (#51268) 2022-06-22 12:53:16 -04:00
gotjosh
90646e7f41
Alerting: Don't stop the migration when alert rule tags are invalid (#51253)
* Alerting: Don't stop the migration when alert rule tags are invalid

As we migrate we expect the `alertRuleTags` on a dashboard alert to be a JSON object. However, it seems this is not really validated by Grafana and an user can change the format to something else that the JSON parser is not able to marshal into a `map[string]string`.

Let's do a bit better by "attempting" to parse the tags and if we can't we'll simple return an empty map. The data is still there so if the user wishes they can go back, fix the data and attemp the migration again.
2022-06-22 17:39:17 +01:00
Yuriy Tseretyan
4b42cd3c1d
Alerting: State manager to use clock (#51219)
* manager to use clock, to be able to mock real time
2022-06-22 12:18:42 -04:00
Tania
405df77e3e
Add a feature toggle for custom branding (#51168) 2022-06-22 17:05:52 +02:00
Yuriy Tseretyan
4d02f73e5f
Alerting: Persist rule position in the group (#50051)
Migrations:
* add a new column alert_group_idx to alert_rule table
* add a new column alert_group_idx to alert_rule_version table
* re-index existing rules during migration

API:
* set group index on update. Use the natural order of items in  the array as group index
* sort rules in the group on GET
* update the version of all rules of all affected groups. This will make optimistic lock work in the case of multiple concurrent request touching the same groups.

UI:
* update UI to keep the order of alerts in a group
2022-06-22 10:52:46 -04:00
Alexander Emelin
cef81a6478
Search: Update bluge version (#50377) 2022-06-22 15:49:26 +03:00
Eric Leijonmarck
421f7a999a
Auth: Case insensitive ids duplicate usagestats (#50724)
* WIP

* update for prometheus

* usagestats: tests pass for user duplicate entries

* metrics: added duplicate user entries

* usagestats: adds metrics gauge for duplicate users

* usagestats: skip test for mysql

* sql in oneplace

* only use prometheus register to not panic

* usagestats: RegisterMetricsFunc with loginstats

* fix: remove unused commited code

* refactor: move test to authinfoservice

* Update pkg/models/stats.go

Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>

* removed prometheus metrics, due to sql cpu requirement

* Added: has_duplicate_user_entries and fix tests

* remove unused test

* fix: empty else statement removal

* missing argument to authinfoservice

Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
2022-06-22 14:16:28 +02:00
Alexander Emelin
54e9408cfd
Search: Build indexes on start for all orgs (#50762) 2022-06-22 13:12:07 +03:00
George Robinson
6e44b36a30
Alerting: Add support for images in Kafka alerts (#50758) 2022-06-22 11:03:08 +01:00
Alexander Emelin
1ca2e2b6c2
Search: Sync state on read for HA consistency (#50152) 2022-06-22 12:21:43 +03:00
George Robinson
99516360c9
Alerting: Add support for images in VictorOps alerts (#50759) 2022-06-22 10:00:50 +01:00
Karl Persson
2698e37291
RBAC: Add access control metadata to folder dtos (#51158)
* RBAC: Add access control metadata to Folder dto

* Add access control metadata to folder dto response

* Add test to verify that access control metadata is attached

* Attach access control metadata to multiple folders

* Add access control metadata to frontend folder dto
2022-06-22 10:29:26 +02:00
Yuriy Tseretyan
157c12211d
Alerting: State manager to use tick time to determine stale states (#50991)
* use correct stale timestamp
* calculate stale using tick time instead of time.now

* remove unused dependency on sql store
2022-06-22 00:16:53 +02:00
Josh Hunt
dcf786f3a9
I18n: Add default locale server config option (#51035)
* I18n: Set default locale in server config and expose in grafanaBootData

* put default locale behind feature flag

* update tests now that default locale is behind feature flag

* little bit of PR feedback

* update sample.ini
2022-06-21 11:12:49 +01:00
George Robinson
c8466d285c
Alerting: Add support for image annotation in Alertmanager alerts (#50686) 2022-06-21 09:06:00 +01:00
Daniel Underwood
6f2c0d467f
Alerting: notifiers/discord: Fix group mention documentation (#51071)
This change updates the UI to document the correct Group Mention format for Discord Contact Points.

The Discord API documentation (https://discord.com/developers/docs/reference#message-formatting) uses `<@&ID>` for Group Mentions, not the bare `@` shown in the alerting UI. Testing on 8.5 shows that bare `@` isn't working there.
2022-06-21 05:34:49 +00:00
George Robinson
67046c5e79
Alerting: Add support for images in Threema alerts (#50734) 2022-06-20 15:45:35 +01:00
Torkel Ödegaard
3c3293df78
TopNav: Adds new feature toggle for upcoming nav~ (#51115) 2022-06-20 16:25:43 +02:00
George Robinson
7235480be5
Alerting: Use ErrImagesDone in Discord and SensuGo (#51106) 2022-06-20 14:39:27 +01:00
George Robinson
18c3456d13
Alerting: Support up to N fake images (#51111) 2022-06-20 14:34:53 +01:00
Gilles De Mey
81a5436c1e
Alerting: Adds Mimir to Alertmanager data source implementation (#50943) 2022-06-20 12:56:38 +02:00
George Robinson
62c2b1ec78
Alerting: Add ErrImagesDone to return from withStoredImages (#51098) 2022-06-20 10:56:28 +01:00
George Robinson
2dbaf259a7
Alerting: Update test funcs for notifications (#51013) 2022-06-20 09:05:21 +01:00
Yuriy Tseretyan
81089b956a
Alerting: Update authorization rules for RouteGetNamespaceRulesConfig (#50965)
* use authorizeAccessToRuleGroup
* use toGettableRuleGroupConfig in get by namespace
* add comments for controller methods
2022-06-17 13:55:31 -04:00
Matthew Jacobson
5dee2ed24c
Alerting: Add first Grafana reserved label grafana_folder (#50262)
* Alerting: Add first Grafana reserved label g_label

g_label holds the title of the folder container the alert. The intention of this label
is to use it as part of the new default notification policy groupBy.

* Add nil check on updateRule labels map

* Disable gocyclo lint on schedule.ruleRoutine

will remove later in a separate refactoring PR to reduce complexity.

* Address doc suggestions

* Update g_folder for rules in folder when folder title changes

* Remove global bus in FolderService

* Modify tests to fit new common g_folder label

* Add changelog entry

* Fix merge conflicts

* Switch GrafanaReservedLabelPrefix from `g_` to `grafana_`
2022-06-17 13:10:49 -04:00
Artur Wierzbicki
40b152e813
Search: fix anonymous user access (#51045) 2022-06-17 20:36:10 +04:00
Alexander Weaver
9bbfeedadf
Alerting: Create algorithm to process receiver changes and keep them consistent internally (#50738)
* Algorithm to fix up receivers

* Extract for tests

* Add tests, fix bug

* Add test which demonstrates how it fixes up broken groups

* Fix package prefix
2022-06-17 10:19:22 -05:00
Artur Wierzbicki
644503f5e6
Previews: use ETag header (#51008)
* use etag header for previews

* use unix millis rather than tz-dependant string
2022-06-17 18:02:03 +04:00
Kristin Laemmert
72f934de01
backend/dashboardsnapshot service: move models (#50898)
* backend/dashboard snapshots: refactor leftover models and mocks
* Move all dashboard snapshot-related models into the dashboardsnapshotservice package
* Remove leftover dashboard-related mocks from the mockstore
2022-06-17 09:09:01 -04:00
Torkel Ödegaard
c6ab87008a
Dashboard: Remove super old prop that has not been used in years (#50826) 2022-06-17 14:55:35 +02:00