Hugo Häggmark
7204a64717
LibraryElements: Creates usage stats for panels and variables ( #34476 )
...
* LibraryPanels: Adds usage collection
* Refactor: renames Panel and Variable consts
* Chore: initialize stats
* Refactor: moves library element migrations to migration namespace
2021-05-24 06:11:01 +02:00
Sofia Papagiannaki
23939eab10
[Alerting]: namespace fixes ( #34470 )
...
* [Alerting]: forbid viewers for updating rules if viewers can edit
check for CanSave instead of CanEdit
* Clear ngalert tables when deleting the folder
* Apply suggestions from code review
* Log failure to check save permission
Co-authored-by: gotjosh <josue@grafana.com >
2021-05-20 15:49:33 +03:00
Ganesh Vernekar
95ee5f01b5
NGAlert: Do not pick a random default channel if no default exists ( #34465 )
...
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com >
2021-05-20 10:30:09 +02:00
Ganesh Vernekar
e52f718a87
NGAlert: Migrate old notification channel config ( #33846 )
...
* NGAlert: Migrate old notification channel config
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com >
* Copy the required structs and functions
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com >
* Fix lint
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com >
* Fix review comments and error on discontinued channels
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com >
* Use both ID and UID to map channels, attach UID to channels
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com >
* Fix lint
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com >
* Bug fixes
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com >
* Use alert table instead of dashboard for channel IDs
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com >
* Fix offline reviews: don't add empty receivers and routes, add receiver for unmigrated channels
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com >
* Handle multiple default channels, pick default from used channels
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com >
* Include default channels in all receivers
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com >
2021-05-19 21:10:12 +02:00
Kyle Brandt
e291203528
Alerting: a usage stat for ualerting ( #34390 )
...
collects `stats.alert_rules.count` , where alert_rules is the nextgen system
2021-05-19 10:31:25 -04:00
Kyle Brandt
b987237c9b
Alerting: Remove UALERT_MIG env guard from dashboard rule migration ( #34384 )
...
Rules/notifications/etc migration will now be activated with feature flag alone.
When the feature flag is enabled dashboard alerts are migrated into the system.
When the feature flag is removed, all migrated and newly created alerts in the new system are deleted.
2021-05-19 09:37:56 -04:00
David Parrott
bbb7bbf891
Alerting: Remove back end logic for supporting KeepLastState ( #34242 )
...
* Removed back end logic for supporting KeepLastState
* Map keep_state correctly in migrations
2021-05-18 10:55:43 -07:00
Carl Bergquist
4710566514
bus: add ctx for all signed in user queries ( #33970 )
...
Signed-off-by: bergquist <carl.bergquist@gmail.com >
2021-05-18 18:24:42 +02:00
gotjosh
eb74994b8b
Alerting: Modify configuration apply and save semantics - v2 ( #34143 )
...
* Save default configuration to the database and copy over secure settings
2021-05-14 19:49:54 +01:00
Owen Diehl
baca873a84
extracts alertmanager from DI, including migrations ( #34071 )
...
* extracts alertmanager from DI, including migrations
* includes alertmanager Run method in ngalert
* removes 3s test shutdown timeout
* lint
2021-05-13 14:01:38 -04:00
Conor Evans
83abaa8bdf
Quota: Do not count folders towards dashboard quota ( #32519 )
...
For dashboard quota fix so that folders are not counted as dashboards.
Fixes #31317
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com >
2021-05-12 23:44:46 +02:00
Kyle Brandt
3da8db7f3f
Alerting: Run table migrations regardless of feature flag and move out of service ( #33996 )
2021-05-12 14:39:48 -04:00
idafurjes
f2fcf721eb
32540: Add org users with pagination ( #33788 )
...
* Add model for search org user and add handler for dispatch
* 32540_org_users_with_pagination: Add endpoint for search org users
* 32540_org_users_with_pagination: Add test for org user search handler
* 32540_org_users_with_pagination: fix indentation
* 32540_org_users_with_pagination: Remove newline
* 32540_org_users_with_pagination: Remove empty line
* 32540_org_users_with_pagination: Fix indentation
* Update pkg/api/org_users.go
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com >
* Update pkg/api/org_users.go
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com >
* Update pkg/models/org_user.go
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com >
* Update pkg/api/org_users_test.go
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com >
* Update pkg/api/org_users_test.go
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com >
* 32540_org_users_with_pagination: Use hs.SQLStore.SearchOrgUsers instead of bus
* Add model for search org user and add handler for dispatch
* 32540_org_users_with_pagination: Add endpoint for search org users
* 32540_org_users_with_pagination: Add test for org user search handler
* 32540_org_users_with_pagination: fix indentation
* 32540_org_users_with_pagination: Remove newline
* 32540_org_users_with_pagination: Remove empty line
* 32540_org_users_with_pagination: Fix indentation
* Update pkg/api/org_users.go
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com >
* Update pkg/api/org_users.go
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com >
* Update pkg/models/org_user.go
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com >
* Update pkg/api/org_users_test.go
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com >
* Update pkg/api/org_users_test.go
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com >
* 32540_org_users_with_pagination: Use hs.SQLStore.SearchOrgUsers instead of bus
* 32540_org_users_with_pagination: Add test for the sqlstore
* 32540_org_users_with_pagination: Fix sqlstore test
* Update pkg/api/org_users.go
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com >
* Update pkg/api/org_users_test.go
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com >
* Update pkg/api/org_users_test.go
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com >
* Update pkg/services/sqlstore/org_users.go
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com >
* Update pkg/services/sqlstore/org_users.go
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com >
* Update pkg/services/sqlstore/org_test.go
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com >
* Update pkg/services/sqlstore/org_test.go
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com >
* 32540: Fix search org users method
* 32540: Fix sqlstore test
* 32540: Fix go-lint
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com >
2021-05-12 14:10:35 +02:00
afayngelerindbx
b0094b325e
Annotations: Prevent orphaned annotation tags cleanup when no annotations were cleaned ( #33957 )
...
Fixes #33948
Co-authored-by: Anatoly Fayngelerin <afayngelerin@dropbox.com >
2021-05-12 10:44:00 +02:00
Kyle Brandt
dc3e17ba5b
Alerting: Change rule migration to be based on feature flag ( #33792 )
...
makes it so the feature flag can be turned on off, and the migration will be cleared and rerun. All existing NG alert rules, configuration settings, etc are removed when disabling the feature flag.
for https://github.com/grafana/alerting-squad/issues/142
Co-authored-by: Sofia Papagiannaki <sofia@grafana.com >
2021-05-11 08:08:39 -04:00
Serge Zaitsev
7367cfc0a3
Add isolation level db configuration parameter ( #33830 )
...
* add isolation level db configuration parameter
* add isolation_level to default.ini and sample.ini
* add note that only mysql supports isolation levels for now
* mention isolation_level in the documentation
* Update docs/sources/administration/configuration.md
Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com >
Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com >
2021-05-10 17:54:13 +02:00
Serge Zaitsev
da13f88862
Redact sensitive values before logging them ( #33829 )
...
* use a common way to redact sensitive values before logging them
* fix panic on missing testCase.err, simplify require checks
* fix a silly typo
* combine readConfig and buildConnectionString methods, as they are closely related
2021-05-10 17:03:10 +02:00
Arve Knudsen
c2c1ec7d0f
Chore: Move from master to main branch ( #33693 )
...
* Chore: Move from master branch to main
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* CI: Upgrade build pipeline tool to v2
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
2021-05-06 16:29:29 +02:00
Dafydd
e642506dcb
use dynamic ID in test assertion for search ( #33320 )
2021-05-06 10:48:33 +02:00
ying-jeanne
bd66c8dde3
SQL data sources: Convert to return data frames ( #32257 )
...
Convert SQL data sources to return data frames.
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com >
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com >
Co-authored-by: Will Browne <will.browne@grafana.com >
Co-authored-by: Hugo Häggmark <hugo.haggmark@gmail.com >
2021-05-05 16:46:07 +02:00
Sofia Papagiannaki
540f110220
[Alerting]: Extend quota service to optionally set limits on alerts ( #33283 )
...
* Quota: Extend service to set limit on alerts
* Add test for applying quota to alert rules
* Apply suggestions from code review
Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com >
* Get used alert quota only if naglert is enabled
* Set alert limit to zero if nglalert is not enabled
Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com >
2021-05-04 19:16:28 +03:00
Kyle Brandt
57d46ea991
AlertingMigration: Separate info into multiple annos ( #33641 )
2021-05-03 11:42:31 -04:00
Sofia Papagiannaki
49e9f7e3b6
Chore: Fix mysql integration tests ( #33606 )
2021-05-02 19:49:38 +02:00
Kyle Brandt
efe856ae4e
AlertingMigration: Create alert_rule_version entry ( #33585 )
...
Create the alert rule version entry during the migration so it is consistent with rules created via api.
for https://github.com/grafana/alerting-squad/issues/123
2021-04-30 15:08:01 -04:00
Alexander Emelin
0c2bcbf2bc
Live: persisting last message in cache for broadcast scope ( #32938 )
2021-04-30 11:06:33 -07:00
Kyle Brandt
c25eab4eda
AlertMigration: remove alert_rule UID db check ( #33568 )
...
do not believe this is needed due to uniqueness promised by shortid lib
since there is no provisioning yet. https://github.com/teris-io/shortid
2021-04-30 13:35:26 -04:00
Kyle Brandt
713260f6fa
Alerting: Remove datasource (name) from migration ( #33544 )
...
no longer needed as of https://github.com/grafana/grafana/pull/33416
for https://github.com/grafana/alerting-squad/issues/126
2021-04-30 07:47:01 -04:00
Kyle Brandt
6c8ef2a9c2
Alerting: Alert Rule migration ( #33000 )
...
* Not complete, put migration behind env flag for now:
UALERT_MIG=iDidBackup
* Important to backup, and not expect the same DB to keep working until the env trigger is removed.
* Alerting: Migrate dashboard alert permissions
* Do not use imported models
* Change folder titles
Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com >
2021-04-29 13:24:37 -04:00
Christian Haudum
076e2ce06a
Return 404 when deleting non-existing API key ( #33346 )
...
The server needs to return a HTTP 404 (Not Found) when an API key that does not exist is deleted.
2021-04-28 13:30:09 +02:00
Dafydd
0dcd0281ab
Chore: avoid hard-coding IDs in integration tests ( #33152 )
...
* use dynamic user Ids in test
* use dynamic IDs in alert tests
* use dynamic IDs in dashboard test queries
* use dynamic IDs in org test queries
2021-04-21 11:22:46 +03:00
Dafydd
01150ae962
Allow skip migrations in tests via environment variable ( #32958 )
2021-04-15 11:32:49 +02:00
Sofia Papagiannaki
8848d825e0
[Alerting]: Use title instead of slug for retrieving the namespace ( #32957 )
...
* [Alerting]: Use title instead of slug for retrieving the namespace
* Apply suggestions from code review
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com >
2021-04-14 12:02:50 +03:00
Alexander Emelin
e288cd0836
fix sqlite3 tx retry condition operator precedence ( #32897 )
2021-04-13 18:26:54 +03:00
Dimitris Sotirakis
b867ceda9b
Generic OAuth: Prevent adding duplicated users ( #32286 )
...
* Add special check for generic oauth case
* Converted from Convey to testify
* Fix according to reviewer's comments
* More changes according to reviewer's comments
* Handle error if user is not found
* Move generic oauth test from user_test.go to user_auth_test.go
* Update pkg/services/sqlstore/user_auth_test.go
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com >
* Created genericOAuthModule const
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com >
2021-04-09 13:28:35 +02:00
Carl Bergquist
e1458391bb
API: Return 400 on invalid Annotation requests ( #32429 )
...
Signed-off-by: bergquist <carl.bergquist@gmail.com >
2021-03-29 15:47:16 +02:00
Arve Knudsen
5a0780801b
SQLStore: Close session in withDbSession ( #31775 )
...
* SQLStore: Close session in withDbSession
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* SQLStore.WithDbSession: Never use session from context
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
2021-03-18 14:27:59 +01:00
Arve Knudsen
87c3a2b790
PluginManager: Make Plugins, Renderer and DataSources non-global ( #31866 )
...
* PluginManager: Make Plugins and DataSources non-global
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Fix integration tests
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Replace outdated command
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* DashboardService: Ensure it gets constructed with necessary parameters
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Fix build
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* DashboardService: Ensure it gets constructed with necessary parameters
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Remove dead code
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Fix test
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Fix test
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Remove FocusConvey
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Fix test
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Remove dead code
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Undo interface changes
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Backend: Move tsdbifaces.RequestHandler to plugins.DataRequestHandler
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Rename to DataSourceCount
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Consolidate dashboard interfaces into one
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Fix tests
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Fix tests
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Fix test
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Fix tests
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Fix tests
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Fix tests
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Fix tests
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
* Fix dashboard integration tests
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
2021-03-17 16:06:10 +01:00
Giordano Ricci
0c2045109e
Chore: Collect elasticsearch version usage stats ( #31787 )
...
* Chore: Collect elasticsearch version usage stats
* Fix lint error
* use GetDataSources from sqlstore
* Apply review suggestions
* Return error if datasource type is not specified
* Update pkg/services/sqlstore/datasource.go
* fix undefined var
2021-03-17 09:14:53 +00:00
Joan López de la Franca Beltran
610999cfa2
Auth: Allow soft token revocation ( #31601 )
...
* Add revoked_at field to user auth token to allow soft revokes
* Allow soft token revocations
* Update token revocations and tests
* Return error info on revokedTokenErr
* Override session cookie only when no revokedErr nor API request
* Display modal on revoked token error
* Feedback: Refactor TokenRevokedModal to FC
* Add GetUserRevokedTokens into UserTokenService
* Backendsrv: adds tests and refactors soft token path
* Apply feedback
* Write redirect cookie on token revoked error
* Update TokenRevokedModal style
* Return meaningful error info
* Some UI changes
* Update backend_srv tests
* Minor style fix on backend_srv tests
* Replace deprecated method usage to publish events
* Fix backend_srv tests
* Apply suggestions from code review
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com >
Co-authored-by: Hugo Häggmark <hugo.haggmark@gmail.com >
* Apply suggestions from code review
* Apply suggestions from code review
Co-authored-by: Hugo Häggmark <hugo.haggmark@gmail.com >
* Minor style fix after PR suggestion commit
* Apply suggestions from code review
Co-authored-by: Ursula Kallio <73951760+osg-grafana@users.noreply.github.com >
* Prettier fixes
Co-authored-by: Hugo Häggmark <hugo.haggmark@gmail.com >
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com >
Co-authored-by: Ursula Kallio <73951760+osg-grafana@users.noreply.github.com >
2021-03-16 17:44:02 +01:00
Arve Knudsen
1716de88b5
DashboardService: Consolidate constructors ( #31886 )
...
* DashboardService: Consolidate constructors
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
2021-03-12 11:51:02 +01:00
Carl Bergquist
3b36636318
Annotations: Make the annotation clean up batch size configurable ( #31487 )
...
Signed-off-by: bergquist <carl.bergquist@gmail.com >
Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com >
2021-03-08 14:16:07 +01:00
Arve Knudsen
b79e61656a
Introduce TSDB service ( #31520 )
...
* Introduce TSDB service
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com >
Co-authored-by: Erik Sundell <erik.sundell87@gmail.com >
Co-authored-by: Will Browne <will.browne@grafana.com >
Co-authored-by: Torkel Ödegaard <torkel@grafana.org >
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com >
Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com >
2021-03-08 07:02:49 +01:00
Carl Bergquist
c899bf3592
log skipped, performed and duration for migrations ( #31722 )
...
Signed-off-by: bergquist <carl.bergquist@gmail.com >
2021-03-07 21:26:29 +01:00
Hugo Häggmark
466462de37
LibraryPanels: Adds permissions to getAllHandler ( #31416 )
...
* LibraryPanels: Adds permissions to getAllHandler
* Chore: adds a test to verify the permissions
* Chore: tests refactor
2021-02-24 14:06:22 +01:00
Carl Bergquist
95c8766f86
Usagestats: Exclude folders from total dashboard count ( #31320 )
...
Signed-off-by: bergquist <carl.bergquist@gmail.com >
2021-02-18 15:32:47 +01:00
Alex Khomenko
c21e45e428
Search: display sort metadata ( #31167 )
...
* Search: display metadata
* Search: update SortPicker icon
* Search: display folder meta data
* Search: reset sort picker on layout change
* Search: align tags in Card component
* Search: replace hyphen with dash
* Search: preserve sort state on layout change
* Search: update tests
* Search: fix tests
* Update pkg/services/search/hits.go
Co-authored-by: Agnès Toulet <35176601+AgnesToulet@users.noreply.github.com >
* Update public/app/features/search/components/SearchItem.tsx
Co-authored-by: Agnès Toulet <35176601+AgnesToulet@users.noreply.github.com >
* Update public/app/features/search/components/SearchItem.tsx
Co-authored-by: Agnès Toulet <35176601+AgnesToulet@users.noreply.github.com >
* Update public/app/features/search/types.ts
Co-authored-by: Agnès Toulet <35176601+AgnesToulet@users.noreply.github.com >
* Search: fix type error
* Search: add General folder name and adjust icon margin
Co-authored-by: Agnès Toulet <35176601+AgnesToulet@users.noreply.github.com >
2021-02-17 14:06:19 +02:00
Dafydd
e17198af83
WIP: Skip this call when we skip migrations ( #31216 )
2021-02-15 12:57:20 +01:00
dependabot[bot]
4f918e37f4
Chore(deps): Bump xorm.io/xorm from 0.8.1 to 0.8.2 ( #30773 )
...
* Chore(deps): Bump xorm.io/xorm from 0.8.1 to 0.8.2
Bumps xorm.io/xorm from 0.8.1 to 0.8.2.
Signed-off-by: dependabot[bot] <support@github.com >
* Fix limit for snapshots
* Fix limit for org and users
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com >
2021-02-15 09:59:39 +01:00
Agnès Toulet
3303e28b38
Search: add sort information in dashboard results ( #30609 )
...
* Search: add SortMeta in dashboard results
* fix integration tests
* trim SortMeta
* fix searchstore tests
* Update pkg/services/sqlstore/dashboard.go
Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com >
Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com >
2021-02-11 08:49:16 +01:00
Carl Bergquist
49e394e167
instrumentation: make the first database histogram bucket smaller ( #30995 )
...
Signed-off-by: bergquist <carl.bergquist@gmail.com >
2021-02-08 19:51:48 +01:00