Commit Graph

9628 Commits

Author SHA1 Message Date
Ashley Harrison
ac66e14054
Navigation: rename Grafana Machine Learning to just Machine Learning (#58893)
rename Grafana Machine Learning to just Machine Learning
2022-11-17 14:31:03 +00:00
Karl Persson
6e3cb2e3ed
Oauth: Remove unused function for oauth implementations (#58887)
* Oauth: remove unused function

* Oauth: remove unused Oauth types
2022-11-17 15:03:15 +01:00
Jo
7e9d94cfda
Chore: Extract server lock error so it can be used with errors.As (#58899)
chore: extract server lock Error so it can be used with error.As
2022-11-17 15:02:17 +01:00
Dimitris Sotirakis
d0dcbe34b2
grafana.com: Make beta and test releases not stable (#58883)
If version is beta or test, don't mark it as stable
2022-11-17 12:44:53 +02:00
Eric Leijonmarck
2a6ed76e54
[Docs] Edit terraform example and doc for file generation (#58822)
* docs: update terraform example and doc for file generation

* docs: updated the documnettaion to include the help command with fields included

* Update pkg/cmd/grafana-cli/commands/commands.go

* docs: add help command
2022-11-17 05:24:07 -05:00
Sofia Papagiannaki
ab36252c86
Quota: Fix failure when checking session limits (#58865) 2022-11-17 00:30:27 +01:00
sam boyer
c4528f9bd8
codejen: Update to latest codejen (#58866) 2022-11-16 15:08:01 -05:00
Marcus Efraimsson
79f1a7a4fd
Database: Adds support for enable/disable SQLite Write-Ahead Logging (WAL) via configuration (#58268)
Adds support for enable/disable SQLite Write-Ahead Logging (WAL) via configuration.
Enables SQLite WAL for E2E tests.
2022-11-16 19:29:33 +01:00
João Calisto
f254a37d35
Middleware: Add CSP Report Only support (#58074)
* Middleware: Add CSP Report Only support

* Update docs/sources/setup-grafana/configure-grafana/_index.md

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>

* Update docs/sources/setup-grafana/configure-grafana/_index.md

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>

* Update csp documentation wording

* Update conf/sample.ini

Co-authored-by: Dave Henderson <dave.henderson@grafana.com>

* Update docs/sources/setup-grafana/configure-grafana/_index.md

Co-authored-by: Dave Henderson <dave.henderson@grafana.com>

* Update docs/sources/setup-grafana/configure-grafana/_index.md

Co-authored-by: Dave Henderson <dave.henderson@grafana.com>

* Update docs/sources/setup-grafana/configure-grafana/_index.md

Co-authored-by: Dave Henderson <dave.henderson@grafana.com>

* Update pkg/middleware/csp.go

Co-authored-by: Dave Henderson <dave.henderson@grafana.com>

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
Co-authored-by: Dave Henderson <dave.henderson@grafana.com>
2022-11-16 17:11:26 +00:00
Gabriel MABILLE
8756c4d91f
RBAC: Add tests on AddAppLinks (#58843)
* RBAC: Add tests on AddAppLinks
2022-11-16 17:44:33 +01:00
Kyle Brandt
1953d473c0
SSE: Keep value name from numeric table (#58831)
fixes #48868
2022-11-16 10:39:28 -05:00
Artur Wierzbicki
7bf3e28e8f
Chore: skip flaky tests (#58835)
skip flaky tests
2022-11-16 10:23:49 -05:00
Ryan McKinley
934fb2f0ee
QueryData: fix header parsing to support expressions (#58826)
fixes #58821
2022-11-16 10:17:24 -05:00
Gabriel MABILLE
a8c48b6801
RBAC: Cover plugin includes (#57582)
* RBAC: Add action to plugin includes

* Adding the feature toggle check

* Cue update

* Extract include access control to method

* Suggestion to prevent log when RBAC is disabled

Co-authored-by: ievaVasiljeva <ieva.vasiljeva@grafana.com>

* Rename IsRBACReady to RequireRBACAction

Co-authored-by: ievaVasiljeva <ieva.vasiljeva@grafana.com>
2022-11-16 15:54:04 +01:00
Yuri Tseretyan
332630c2e0
kindsys: Make kind generators run in Windows (#58794) 2022-11-16 09:21:11 -05:00
matt abrams
74010fd05d
Admin: Fix broken links to image assets in email templates (#58729)
fix broken links to image assets
2022-11-16 14:17:39 +01:00
sam boyer
78f0340031
plugindef: Move pluginmeta out of coremodels as standalone thema lineage (#56765)
* Get pluginmeta mostly moved over to pkg/plugins/plugindef

* Remove dead func

* Fix up pfs, use sync.Once in plugindef

* Update to latest thema

* Chase Endec->Codec conversion in Thema

* Comments on slash header gen; use ToSlash

* Also generate JSON schema for plugindef

* Generate JSON Schema as well

* Fix slot loading from kindsys cue decls

* Remove unused vars

* skip generating plugin.schema.json for now

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2022-11-15 14:48:31 +01:00
Ashley Harrison
028751a18a
Navigation: Add quick actions button (#58707)
* initial implementation for quick add

* add new isCreateAction prop on NavModel

* adjust separator margin

* switch to primary button

* undo changes to plugin.json

* remove unused props from interface

* use a consistent dropdown overlay type

* memoize findCreateActions

* add prop description

* use a function so that menus are only rendered when the dropdown is open
2022-11-15 12:08:15 +00:00
Torkel Ödegaard
84a69135a7
Scene: Variables and support for declaring variable dependencies and getting notified or re-rendered when they change (#58299)
* Component that can cache and extract variable dependencies

* Component that can cache and extract variable dependencies

* Updates

* Refactoring

* Lots of refactoring and iterations of supporting both re-rendering and query re-execution

* Updated SceneCanvasText

* Updated name of file

* Updated

* Refactoring a bit

* Added back getName

* Added comment

* minor fix

* Minor fix

* Merge fixes

* Merge fixes

* Some review fixes

* Updated comment

* Added forceRender function

* Add back fail on console log
2022-11-15 12:54:24 +01:00
Sofia Papagiannaki
93b4b9154e
Chore: Restore folder properties (#58743)
* Chore: Fix folder URL

* Restore more folder properties

* Fixup
2022-11-15 12:58:12 +02:00
Karl Persson
98dbc637cc
Auth: Always include oauth and saml settings for frontend (#58705)
* Auth: Always include oauth and saml settings
2022-11-15 10:50:37 +01:00
Gabriel MABILLE
d999b5bda0
RBAC: remove redundant role name field from plugin role registrations (#58166)
* RBAC: Remove name from role registration

* Inline accesscontrol service

* test fix

* use fmt

Co-Authored-By: marefr <marcus.efraimsson@gmail.com>

Co-authored-by: marefr <marcus.efraimsson@gmail.com>
2022-11-15 09:51:40 +01:00
Artur Wierzbicki
eff5450ff1
Search: Revert "load dashboard performance improvements" (#58730)
Revert "Search: load dashboard performance improvements (#57509)"

This reverts commit 1df8a85a42.
2022-11-15 02:25:13 -05:00
Ryan McKinley
d33939da55
DataSourceWithBackend: Add plugin id to the request headers (#58082) 2022-11-14 19:35:50 -05:00
kay delaney
59d2cf2ff7
Snapshots: Allow user with viewer permissions to delete own snapshots (#58572)
Also allows deletion of snapshots whose original dashboard is
in a folder which the viewer has explicit edit permissions for
2022-11-14 19:13:33 +00:00
Sofia Papagiannaki
9855e74b92
Chore: Refactor quota service (#58643)
Chore: Refactor quota service (#57586)

* Chore: refactore quota service

* Apply suggestions from code review
2022-11-14 21:08:10 +02:00
Yuri Tseretyan
28d39d35fd
Alerting: Update state manager to save state transitions in one batch (#58358)
* change stale results handler to not update database but return transitions
* save all transitions in one call
2022-11-14 10:57:51 -05:00
Misi
4915d21c25
OAuth: Feature toggle for access token expiration check and docs (#58179)
* Add feature toggle for access token expiration check

* Add docs for configuring refresh tokens

* Update docs

* Update docs based on review

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>

* Improve documentation

* Change access_type default to Offline

* Update docs/sources/setup-grafana/configure-security/configure-authentication/gitlab/index.md

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>

* Update docs/sources/setup-grafana/configure-security/configure-authentication/google/index.md

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>

* Update pkg/services/featuremgmt/registry.go

Co-authored-by: Eric Leijonmarck <eric.leijonmarck@gmail.com>

* Regenerate toggles

* Update Generic OAuth docs

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
Co-authored-by: Eric Leijonmarck <eric.leijonmarck@gmail.com>
2022-11-14 16:47:46 +01:00
Jo
121631daae
Fix: Email and username trimming and invitation validation (#58442)
* fix: email and username trimming and invitation validation

* Trim leading and trailing whitespaces from email and username on signup

* Check whether the provided email address is the same as where the invitation sent

* Align tests

Co-authored-by: Mihaly Gyongyosi <mgyongyosi@users.noreply.github.com>
2022-11-14 13:11:26 +01:00
Leo
a71f74220a
Navigation: Remove monitoring texts for items under Monitoring section (#58522)
* rename Synthetic monitoring with Synthetics

* improved text override
2022-11-14 10:01:23 +01:00
Karl Persson
f4531b4ee1
Omit error from http response (#58443) 2022-11-14 09:42:31 +01:00
Ryan McKinley
5934407443
Storage: add an admin write flavor that can explicitly set the user/time (#58618) 2022-11-12 11:36:18 -08:00
ying-jeanne
69b5a9c752
Chore: [Nested Folder] Add db migration at service start time (#58590)
* add db migration at service start time

* make changes for the 3 db

* revert migrator

* fix feature toggle check

Co-authored-by: Serge Zaitsev <serge.zaitsev@grafana.com>
2022-11-12 09:51:46 -05:00
Victor Marin
6e776d0fec
MSSQL: Add connection timeout setting in configuration page (#58631)
* MSSQL add connection timeout

* add docs

* Update docs and add min value to the timeout setting
2022-11-11 14:04:08 -05:00
Alex Moreno
78bb8c10ce
Alerting: Allow none provenance alert rule creation from provisioning API (#58410) 2022-11-11 19:58:45 +01:00
gotjosh
d748979048
Alerting: Implement the Webex notifier (#58480)
* Alerting: Implement the Webex notifier

Closes https://github.com/grafana/grafana/issues/11750

Signed-off-by: gotjosh <josue.abreu@gmail.com>
2022-11-11 17:27:13 +00:00
ismail simsek
1c5039085b
Prometheus: Make Prometheus streaming parser as default client (#58365)
* Introduce a new feature flag for prometheus buffered client

* Use querydata client as default and put buffered client behind the feature flag

* Remove prometheusStreamingJSONParser feature flag as it is not needed anymore

* Update tests

* Fix unit tests

* Update feature flag description
2022-11-11 17:53:12 +01:00
ismail simsek
8edeb1aa22
Prometheus: Handle errors in buffered client (#58504)
* Handle prometheus errors in buffered client

* Handle prometheus warnings

* Fix tests

* Add unit test for warnings
2022-11-11 15:49:46 +01:00
idafurjes
080ea88af7
Nested Folders: Support getting of nested folder in folder service wh… (#58597)
* Nested Folders: Support getting of nested folder in folder service when feature flag is set

* Fix lint

* Fix some tests

* Fix ngalert test

* ngalert fix

* Fix API tests

* Fix some tests and lint

* Fix lint 2

* Fix library elements and panels

* Add access control to get folder

* Cleanup and minor test change
2022-11-11 14:28:24 +01:00
George Robinson
bd87b46b15
Alerting: Improve test coverage for ConditionsCmd (#58603) 2022-11-11 09:27:35 +00:00
sam boyer
07e5f8117f
Reconcile coremodels, entities, objects under new kind framework (#56492)
* Update thema to latest

* Deal with s/Library/*Runtime/

* Commit new, working results of codegen

* We like pointers now

* Always take runtime arg for NewBase()

* Sketchy handwavy pass at entity meta framework

* Little nibbles

* Update pkg/framework/coremodel/entityframework.cue

Co-authored-by: Artur Wierzbicki <wierzbicki.artur.94@gmail.com>

* Move file into new framework location

* Introduce loaders, Go code

* Complete rename to kind

* Flesh out framework, add svg/dashboard examples

* Cruft removal

* Remove generated kind go files from gitignore

* Refine maturity concept, add SlotKind

* Update embed and go deps

* Export PrefixWithGrafanaCUE

* Make the loader actually work, holy crap

* Many small tweaks to type.cue

* Add Apache 2 licensing exceptions for kinds

* Add new kinds dir, start of generator

* Roll back to earlier oapi-codegen

* Introduce new grafana-specific CUE loaders

* Introduce new tidy code generators framework

* Catch up kind framework with tinkering

* Add slices for the generators

* Add write/verify step to main generator

* Many renames

* Split up kind framework cue files

* Use kind.Decl within generated kinds

* Create kind.SomeDecl wrapper type to cache lineages

* Better names again

* Get one generated implemented, hopefully

* Copy dashboard schema into new kind.cue

* Small fixes to make the initial gen work

* Put svg kind in its new home

* Add generated Go dashboard type

* More renames and cleanups

* Add base kind registry and generator

* Stop blacklisting *_gen.go files

This is not the Go best practice, anyway. All we actually want to ignore
for enterprise is generated wire files.

* Change codegen output directories

pkg/kind -> pkg/kinds
pkg/registry/kindreg -> pkg/registry/corekind

* Rename pkg/framework/kind to pkg/kindsys

* Add core structured kind generator

* Add plural and machine names to kind spec

* Copy playlist over to kind system

* Consolidate kindsys files

* Add raw kind generator

* Update CODEOWNERS for kind framework

* Touch up comments a bit

* More docs tweaks

* Remove generated types to reduce noise for review

* Split each generator into its own file

* Rename Slot kind to Composable kind

* Add handwavy types for customkind loading

* Guard against init calls to framework loader

* First pass at doc on extending the kind system

* Improve attribute example in docs

* Fix wire imports

* Add basic TS types generator

* Fix composable kind category def

* No need for a separate file with generate directive

* Catch dashboard schema up

* Rename generator types to something saner and generic

* Make version configurable in ts/go generators

* Add CommonMeta to ease property access

* Add kindsys prop indicating whether lineage is group

* Put all kind categories back in a single file

* Finish with kindsys group props

* Refactor maturity progression per discussion

- Replace "committed" with "merged"
- All kindcats can use all maturity levels, at least for now

* Convert ts veneer index generator to modular system

* Move over to new jennywrites framework

* Strip down old coremodel generator

* Use public version of jennywrites

* Pull latest thema

* Commit generated Go types

* Add header injection postprocessor

* Move sdboyer/jennywrites to grafana/codejen

* Tweak header output

* Remove dashboard and playlist coremodels

* Fix up backend dashboards devenv test

* Fix TS import patterns to new gen filename

* Update internal imports, remove coremodel registry

* Fix compilation errors, wire generation

* Export and replace the prefix dropper

* More Go struct and field name changes

* Last name fixes, hopefully

* Fix lint errors

* Last lint error

Co-authored-by: Artur Wierzbicki <wierzbicki.artur.94@gmail.com>
2022-11-10 12:36:40 -08:00
Ryan McKinley
f92d978386
Export: support export in postgresql (#58553) 2022-11-10 14:16:31 -05:00
Ashley Harrison
9cbbe65243
Move cloud link app to the Administration section (#58578) 2022-11-10 17:02:41 +00:00
Ivana Huckova
261d620f1c
Elasticsearch: Add feature toggle for backend migration (#58585)
* Elasticsearch: Add feature toggle for backend migration

* Update
2022-11-10 16:35:15 +01:00
Alex Moreno
45facbba11
Alerting: Remove url based external alertmanagers config (#57918)
* Remove URL-based alertmanagers from endpoint config

* WIP

* Add migration and alertmanagers from admin_configuration

* Empty comment removed

* set BasicAuth true when user is present in url

* Remove Alertmanagers from GET /admin_config payload

* Remove URL-based alertmanager configuration from UI

* Fix new uid generation in external alertmanagers migration

* Fix tests for URL-based external alertmanagers

* Fix API tests

* Add more tests, move migration code to separate file, and remove possible am duplicate urls

* Fix edge cases in migration

* Fix imports

* Remove useless fields and fix created_at/updated_at retrieval

Co-authored-by: George Robinson <george.robinson@grafana.com>
Co-authored-by: Konrad Lalik <konrad.lalik@grafana.com>
2022-11-10 16:34:13 +01:00
ying-jeanne
b13b58ebf8
Add move endpoint into folder service (#58575)
* add move endpoint

* change signatures
2022-11-10 09:06:52 -05:00
Leon Sorokin
778337e522
BarChart: Fix coloring from thresholds and value mappings (#58285) 2022-11-10 07:43:32 -06:00
idafurjes
30f0d66983
Folder: Add implementation for Update for nested folder (#58479)
* Add implementation for Update nested folder

* Remove parent uid from Update

* Fix update
2022-11-10 14:28:55 +01:00
Levente Balogh
181640b080
Connections: Support standalone plugin pages (#57772)
* feat(Connections): create sub-pages wrapped by `<Page>`

* feat(Connections): rename the Connections page and update routes

* feat(Connections): use new url for editing datasources

* refactor(Connections): remove unused tab components

* feat(Connections): update routes and nav titles

* tests: fix tests for Connections

* tests: fix typo in backend tests
2022-11-10 11:14:23 +01:00
George Robinson
c5ae1bcfe0
Alerting: Fix logging pointer address of DashboardUID and PanelID variables (#58539) 2022-11-10 09:58:38 +00:00
George Robinson
68600c224b
Alerting: Log when alert rule cannot be screenshot to help debugging (#58537) 2022-11-10 09:41:31 +00:00
Sofia Papagiannaki
bf5a08e039
API: Support creating a nested folder (#58508)
* API: Support nested folder creation

* Update swagger

* fixup

* Update pkg/api/dtos/folder.go

Co-authored-by: Serge Zaitsev <serge.zaitsev@grafana.com>

* Fix some tests

* create legacy folder url from title and uid

Co-authored-by: idafurjes <36131195+idafurjes@users.noreply.github.com>
Co-authored-by: Serge Zaitsev <serge.zaitsev@grafana.com>
Co-authored-by: Ida Furjesova <ida.furjesova@grafana.com>
2022-11-10 04:41:03 -05:00
ying-jeanne
accb4dea55
[Nested Folder] Delete folder methode (#58444)
* transfer DeleteFolder changes from larger PR

* finish some thingies

* add the simplest delete logics

* some intermedia steps

* fix tests

* add test

* fix some comments

Co-authored-by: yangkb09 <yangkb09@gmail.com>
2022-11-10 03:42:32 -05:00
Andres Martinez Gotor
1201170724
GoogleCloudMonitoring: Refactor query type definition (#58512) 2022-11-10 09:30:47 +01:00
Kristin Laemmert
70dac35348
chore(tests): return a copy of the map to avoid concurrency issues in tests (#58547) 2022-11-09 22:12:18 +01:00
Alexander Weaver
2bfdda5b68
Alerting: Break dependency between state and image packages (#58381)
* Refactor state and manager to not depend directly on image interface

* Move generic errors to models package

* Move NotAvailableImageService to state as its only references are in state tests

* Move NoopImageService to state package

* Move mock to state package

* Fix linter error

* Fix comment styling

* Fix a couple added references introduced by rebase

* Empty commit to kick build
2022-11-09 15:06:49 -06:00
Yuri Tseretyan
bad4f28d0d
Alerting: update test TestAlertingTicker to not rely on clock (#58544)
* extract method processTick
* make processTick return scheduled rules
* move state manager tests to state manager
* update test
* move all tests into one file
* remove unused fields
2022-11-09 15:08:57 -05:00
Sofia Papagiannaki
000b4f878d
Chore: Retry queries by default in tests (#58535) 2022-11-09 19:56:47 +02:00
George Robinson
7e852720e3
Alerting: Fix images cached on rule instead of dashboard panel signature (#58510) 2022-11-09 17:01:48 +00:00
George Robinson
b92a0223e3
Alerting: Improve debug logs in image service (#58507) 2022-11-09 16:32:58 +00:00
Sasha Melentyev
febcaeff3a
Chore: Use strings.ReplaceAll and preallocate containers (#58483) 2022-11-09 17:17:09 +01:00
George Robinson
acfa066ba2
Alerting: Change TestConditionsCmd to assert on mathexp.Results (#58434) 2022-11-09 16:07:43 +00:00
Giuseppe Guerra
33f02839f0
Plugins: CallResource: Use canonical MIME headers when writing response (#58506)
* Plugins: CallResource: use canonical MIME headers when writing response

* Plugins: add tests for canonical mime headers and Set-Cookie filter

* Removed extra new line
2022-11-09 15:47:32 +01:00
Gareth Dawson
fa5a304de8
Elasticsearch: fix typo (#58519) 2022-11-09 14:10:47 +00:00
Timur Olzhabayev
008c554d7f
Echo: Add config option to prevent duplicate page views for GA4 (#57619) 2022-11-09 15:09:19 +01:00
George Robinson
1290951b65
Alerting: Small improvements to staleResultsHandler (#58007) 2022-11-09 11:08:32 +00:00
George Robinson
fdeefaee42
Alerting: Reorder tests in classic_test.go (#58425) 2022-11-09 09:13:47 +00:00
Andres Martinez Gotor
9778d642df
GoogleCloudMonitoring: use typed struct in newInstanceSettings (#58440) 2022-11-09 09:38:06 +01:00
George Robinson
c646ff0ce3
Alerting: Fix screenshots were not cached (#58493) 2022-11-09 01:52:16 +00:00
Ryan McKinley
238a3f820c
Store: use "at" suffix for time base fields more consistently (#58486) 2022-11-08 17:42:32 -05:00
George Robinson
ad9ac85ee0
Alerting: Use hash of opts in singleflight (#58474) 2022-11-08 22:37:49 +00:00
George Robinson
72275e97d2
Use fnv64 for InmemCacheService (#58468) 2022-11-08 22:05:15 +00:00
Sofia Papagiannaki
4d2be7a277
Nested Folders: Use recursive query if the driver supports it (#58178)
* Nested Folders: Try first recursive query and fallback if it's not supported

* Apply suggestion from code review

Fix error msgID
2022-11-08 14:53:05 -05:00
Emil Tullstedt
75701695d8
pkg/web: avoid shared middleware slice (#58458) 2022-11-08 10:58:04 -05:00
Dan Cech
d593aede3d
properly format new .drone.yml in verify-drone (#58436) 2022-11-08 10:27:57 -05:00
Matias Chomicki
25f79ef2b9
Loki: enable Monaco Query Editor by default (#58080)
* feat(loki-monaco-editor): update tests

* chore(loki): use unified datasource mock function in tests

* chore: enable monaco feature flag in tests

* feat(loki-monaco-editor): add test case for disabled feature

* feat(loki-monaco-editor): enable by default

* Revert "feat(loki-monaco-editor): enable by default"

This reverts commit 08904f94a707a4fa32aa1e7f3f0de377575a7636.

* feat(loki-monaco-editor): enable from registry

* feat(loki-monaco-editor): make feature flag frontend only
2022-11-08 10:22:40 -05:00
Andres Martinez Gotor
42b2e630b7
GoogleCloudMonitoring: Refactor annotation code (#58417) 2022-11-08 15:41:17 +01:00
Kristin Laemmert
a255c32e1a
nested folders: support creation of nested folders in folder service when feature flag is set (#58364)
* nested folders: support creation of nested folders in folder service when feature flag is set
2022-11-08 08:59:55 -05:00
George Robinson
aa69a8463f
Revert "Alerting: Fix mathexp.NoData in ConditionsCmd (#56812)" (#58423)
This reverts commit 5fa0936b7e.
2022-11-08 13:35:58 +00:00
Julien Duchesne
786c7faff2
Grafana Enterprise Packaging: Set to conflict with grafana, not replace (#58189)
* Grafana Enterprise Packaging: Set to conflict with `grafana`, not replace
When `grafana` and `grafana-enterprise` are in the same RPM repository, grafana-enterprise takes precedence over Grafana
This is not what we want. Users should be able to install either OSS or Enterprise

* Set it only one way. It's how it's currently tested
2022-11-08 13:08:01 +01:00
George Robinson
5fa0936b7e
Alerting: Fix mathexp.NoData in ConditionsCmd (#56812)
This commit fixes an issue where mathexp.NoData would return an error
in ConditionsCmd (Classic Condition) instead of no data. It further
refactors the Execute method to make it easier to understand.
2022-11-08 11:41:57 +00:00
ying-jeanne
0e87d27e5b
Support folderUID in import dashboard service (#58415)
* add folder service and get folderid

* remove storage?
2022-11-08 06:36:18 -05:00
Kristin Laemmert
ef7145e4aa
feat(nested folders): Add CountAlertRulesInFolder to ngalert store (#58269)
* chore: refactor CountDashboardsInFolder to use the more efficient Count() sql function

* feat(nested folders): Add CountAlertRulesInFolder to ngalert store

This commit adds CountAlertRulesInFolder and a new model for the CountAlertRulesQuery. It returns a count of alert rules associated with a given orgID and parent folder UID. (the namespace referenced inside alert rules is the parent folder).

I'm not sure where this belongs in the ngalert service, so that will come in a future commit.
2022-11-08 11:51:00 +01:00
idafurjes
af2f51f196
Folder: Add folder service implementation (#58182)
* Folder: Add folder service implementation

* Add Move

* Add tests

* Add new servie method and adjust Update, Delete and Move

* Remove contains

* GetTree return children of depth one
2022-11-08 11:33:13 +01:00
Andreas Christou
5cfd983cc2
AzureMonitor - E2E tests drone update (#57100)
* Update e2e command with video flag

* Add Cloud Plugins E2E tests to drone

* Update env variable names

* Add vault Azure secrets

* Update e2e steps

* Update secrets path

* Update image and rebuild drone file

* Readd drone changes

* Rebuild drone

* Remake drone

* Correct reference to secret

* Remake drone file

* Remove unneeded step

* Clear values in Arg query
2022-11-08 11:27:54 +01:00
Sofia Papagiannaki
96cdf77995
Revert "Chore: Refactor quota service (#57586)" (#58394)
This reverts commit 326ea86a57.
2022-11-08 11:52:07 +02:00
Shirley
82d09e0647
CloudWatch: Refactor test mock by removing GetMetricsData from FakeMetricsAPI (#58355) 2022-11-08 10:28:50 +01:00
Sofia Papagiannaki
326ea86a57
Chore: Refactor quota service (#57586)
* Chore: refactore quota service

* Apply suggestions from code review
2022-11-08 10:25:34 +02:00
ismail simsek
93c1fbbe3f
Remove data comparison tool and feature flag (#58196) 2022-11-07 19:20:00 +01:00
Eric Leijonmarck
76947b10e2
Auth: conflicting users validation improvements (#58136)
* WIP

* add: better validation of conflict file

* add: better description of validation and ingest command

* add: check for at least one user to delete

* add: example in terraform to setup for conflicts

* Update pkg/cmd/grafana-cli/commands/conflict_user_command.go

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>

* Add: print of conflict block for error

- adds conflict block to error output for validation of the file to
  easier diagnose in the file

* fix: formatting of errors

* fix: info strings improvements

* add: default 0 to blocks to check for users

* fixed: tests

* test integration

* fix strings fmt

* set store in resolver

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
2022-11-07 18:12:17 +00:00
George Robinson
8353f307aa
Alerting: Fix test fails in some environments (#58251) 2022-11-07 16:34:37 +00:00
Ben Sully
480277f612
CallResource: don't set Content-Type header if status is 204 (#50780)
Grafana's HTTPServer ensures that the Content-Type header is always set
in the response to a CallResource call, but when the status code is
204 No Content this shouldn't be done; the body should be empty and no
Content-Type header should be set.

We ran into this in the Grafana ML plugin where we were sending an empty
response with status 204, but the frontend client saw that the content
type was JSON and tried to parse it, resulting in an error that made it
to the JS console.
2022-11-07 17:25:49 +01:00
Giordano Ricci
43436bd6f0
Explore: Remove explore2Dashboard feature toggle (#58329) 2022-11-07 16:06:40 +00:00
Yuri Tseretyan
3621cf5a12
Alerting: Update handling of stale state (#58276)
* delete all stale states in one lock
* do not use touched states to detect stale rely only on LastEvaluationTime maintained correctly
* fix tests to use correct eval time
* delete unused method
2022-11-07 11:03:53 -05:00
Neel
db1fd10ff1
Alerting: Append org ID to alert notification URLs (#57123) 2022-11-07 16:03:25 +00:00
Si Mon
bc280d0749
Datasource Loki: preserve header X-ID-Token (#57878) 2022-11-07 16:53:42 +01:00
Emil Tullstedt
89eba7a108
Server: Write internal server error on missing write (#57813) 2022-11-07 16:14:41 +01:00
Emil Tullstedt
1ba25b2baa
Preferences: Create indices (#48356) 2022-11-07 15:52:26 +01:00
Yuri Tseretyan
623de12e35
Alerting: Create AlertInstanceKey in one place (#58278)
* use method GetAlertInstanceKey
* do not add key if error
2022-11-07 09:35:29 -05:00
Levente Balogh
eb3ee35e1c
Frontend Routing: Always render standalone plugin pages using the <AppRootPage> (#57771)
* chore: fix go lint issues

* feat(Routing): route standalone plugin pages to the `AppRoutePage`

* feat(plugin.json): introduce a new field called `isCorePage` for `includes`

* chore: add explanatory comments for types

* refactor(AppRootPage): receive the `pluginId` and `pluginSection` through the props

Now we are able to receive these as props as the pluginId is defined on navLinks
that are registered by plugins.

* chore: update teests for AppRootPage

* fix: remove rebase issue

* tests(applinks): add a test for checking isCorePage plugin page setting

* refactor(applinks): update tests to use FindById() and be more resilient to changes

* fix: Go lint issues

* refactor(routes): use cleaner types when working with plugin nav nodes

Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>

* chore: fix linting issues

* t: remove `isCorePage` field from includes

Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>
2022-11-07 15:19:31 +01:00
Yuri Tseretyan
f9c88e72ae
Alerting: Update saveAlertStates in state manager to not return results (#58279) 2022-11-07 09:09:19 -05:00
Jo
2ce5dcfb91
ServiceAccounts: Add background service to check for token leaks (#53658)
* add secret scan service

* add token batching

* Apply suggestions from code review

Co-authored-by: Victor Cinaglia <victor@grafana.com>

* fix: finish constant renaming

Co-authored-by: Victor Cinaglia <victor@grafana.com>
2022-11-07 05:46:19 -05:00
Gabriel MABILLE
30fae33f66
RBAC: Allow role registration for plugins (#57387)
* Picking role registration from OnCall POC branch

* Fix test

* Remove include actions from this PR

* Removing unused permission

* Adding test to DeclarePluginRoles

* Add testcase to RegisterFixed role

* Additional test case

* Adding tests to validate plugins roles

* Add test to plugin loader

* Nit.

* Scuemata validation

* Changing the design to decouple accesscontrol from plugin management

Co-authored-by: Kalle Persson <kalle.persson@grafana.com>

* Fixing tests

Co-authored-by: Jguer <joao.guerreiro@grafana.com>

* Add missing files

Co-authored-by: Jguer <joao.guerreiro@grafana.com>

* Remove feature toggle check from loader

* Remove feature toggleimport

* Feedback

Co-Authored-By: marefr <marcus.efraimsson@gmail.com>

* Fix test'

* Make plugins.RoleRegistry interface typed

* Remove comment question

* No need for json tags anymore

* Nit. log

* Adding the schema validation

* Remove group to take plugin Name instead

* Revert sqlstore -> db

* Nit.

* Nit. on tests

Co-authored-by: ievaVasiljeva <ieva.vasiljeva@grafana.com>

* Update pkg/services/accesscontrol/plugins.go

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>

* Log message

Co-Authored-By: marefr <marcus.efraimsson@gmail.com>

* Log message

Co-Authored-By: marefr <marcus.efraimsson@gmail.com>

* Remove unecessary method. Update test name.

Co-authored-by: ievaVasiljeva <ieva.vasiljeva@grafana.com>

* Fix linting

* Update cue descriptions

* Fix test

Co-authored-by: Kalle Persson <kalle.persson@grafana.com>
Co-authored-by: Jguer <joao.guerreiro@grafana.com>
Co-authored-by: marefr <marcus.efraimsson@gmail.com>
Co-authored-by: ievaVasiljeva <ieva.vasiljeva@grafana.com>
2022-11-07 11:30:45 +01:00
Will Browne
09e8cff06e
Plugins: Make "README" the default markdown request param (#58264)
* Plugins: Make README the default markdown request param

* undo devdboard changes

* fix missing prefix

* rm newline

* re-add space UFFFFF
2022-11-07 11:16:17 +01:00
Ryan McKinley
a83fdc6b87
Live: remove json exact converter (#58282) 2022-11-04 18:33:02 -04:00
Ryan McKinley
eb1cc80941
Storage: include SQL implementation (#58018) 2022-11-04 17:30:22 -04:00
Yuri Tseretyan
978f1119d7
Alerting: Run state manager as regular sub-service (#58246) 2022-11-04 17:06:47 -04:00
Ryan McKinley
e6a9fa1cf9
ServiceAccounts: enable service accounts after IsRealUser change (#58263)
* suppor service accounts

* add: IsServiceAccount to scheduleUser in scheduler

Co-authored-by: eleijonmarck <eric.leijonmarck@gmail.com>
2022-11-04 15:53:35 -04:00
Yuri Tseretyan
dce8879145
Alerting: Update state manager to accept rule store as Warm method argument (#58244) 2022-11-04 14:23:08 -04:00
Ezequiel Victorero
ae30a0688a
PublicDashboards: refactor using new grafana error types (#58078) 2022-11-04 14:14:32 -03:00
Ryan McKinley
22628d1f7e
Storage: fix failing test (set IsServiceAccount=true) (#58257) 2022-11-04 12:37:25 -04:00
Will Jordan
d581b368bd
Alerting: Remove duplicate Slack notification title (#58107)
Move mentions to a markdown-formatted pretext field
to prevent issues mixing blocks and legacy-attachment content.
2022-11-04 17:09:24 +01:00
Alexander Weaver
cc8c1380e2
Alerting: Persist annotations from multidimensional rules in batches (#56575)
* Reduce piecemeal state fields

* Read data directly off state instead of rule

* Unify state and context into single struct

* Expose contextual information to layer above setNextState

* Work in terms of ContextualState and call historian in batches

* Call annotations service in batches

* Export format state and reason and remove workaround in unrelated test package

* Add new method to annotation service for batch inserting

* Fix loop variable aliasing bug caught by linter, didn't change behavior

* Incl timerange on annotation tests

* Insert one at a time if tags are present

* Point to rule from ContextualState rather than copy fields

* Build annotations and copy data prior to starting goroutine

* Rename to StateTransition

* Use new bulk-insert utility

* Remove rule from StateTransition and pass in directly to historian

* Simplify annotations logic since we have only one rule

* Fix logs and context, nilcheck, simplify method name

* Regenerate mock
2022-11-04 10:39:26 -05:00
Dan Cech
9ea6a43089
Build: clean up and document integration test convention (#58170)
* clean up and document integration test convention

* clarify integration test conventions

* clean up integration tests that don't follow convention

* mark testIntegration* functions as helpers to avoid confusion
2022-11-04 10:14:21 -04:00
Yuriy Tseretyan
ff5cc3e640
Chore: Update cloud monitoring and Azure data sources to support contextual logs (#57844)
* update cloud monitoring to use log from context
* update azure monitor to use contextual logger
2022-11-04 09:28:38 -04:00
Eric Leijonmarck
72d0c6b428
Auth: add IsServiceAccount to IsRealUser (#58015)
* add: IsServiceAccount to SignedInUser and IsRealUser

* fix: linting error

* refactor: add function IsServiceAccountUser()

By adding the function IsServiceAccountUser() we use it to identify for
ServiceAccounts in the HasUniqueID() since caching is built up on having
a uniqueID, see comment: https://github.com/grafana/grafana/pull/58015#discussion_r1011361880
2022-11-04 12:39:54 +00:00
Sofia Papagiannaki
d131733f55
Nested Folder: Modify store Update() (#58183)
* Nested Folder: Modify store Update()

* fixup
2022-11-04 10:04:24 +01:00
Ryan McKinley
3dfa49b376
Playlist: cleanup object store implementation (#58201) 2022-11-03 16:35:20 -07:00
Levente Balogh
376f4b0cc7
Navigation: Add pluginId to standalone plugin page NavLinks (#57769)
* feat(Navigation): add `pluginId` to NavLink and override sibling navlinks with the same URL

* test replacing page from plugin

* chore: fix go lint issues

* fix(NavLink): change `PluginId` to `PluginID`

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>

* fix(NavLink): make the `PluginId` -> `PluginID` change everywhere

* chore(navModel.ts): update explanatory comment for `pluginId`

Co-authored-by: Miklós Tolnai <miklos.tolnai@grafana.com>
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2022-11-03 21:19:42 +01:00
Jeff Levin
6fcc5b42c0
publicdashboards: split create/update api paths (#57940)
This PR splits the create and update paths for public dashboards and includes assorted refactors toward a proper REST API. Additionally, we removed the concept of a "public dashboard config" in favor of "public dashboard" 

Co-authored-by: juanicabanas <juan.cabanas@grafana.com>
Co-authored-by: Ezequiel Victorero <ezequiel.victorero@grafana.com>
2022-11-03 11:30:12 -08:00
ismail simsek
0367f61bb3
Share azureauth between prometheus clients (#58122)
* Move azureauth to upper package

* Refactor http transport options
2022-11-03 19:44:37 +01:00
Giuseppe Guerra
7996a1c8ad
Chore: Update grafana-plugin-sdk-go to v0.142.0 (#58115)
* Chore: Update grafana-plugin-sdk-go to v0.142.0

* Update tests and golden files for 207 status code

* Chore: Move update flag definition at the top in response_parser_test.go

* retrigger

Co-authored-by: Will Browne <will.browne@grafana.com>
2022-11-03 18:34:27 +01:00
Ryan McKinley
857e545c5a
FeatureFlags: set defaults in the registry rather than the ini file (#58106) 2022-11-03 17:34:01 +00:00
Sofia Papagiannaki
5c973e58bd
Nested Folders: Add tests for store methods (#57662)
* Nested Folders: Add store tests

* Fix parent order

* Fix update

* skip tests!

* Export test helpers for now
2022-11-03 14:21:41 +01:00
Todd Treece
d45fe6e25c
Chore: Add NewAnonymousSignedInUser to user service (#57537) 2022-11-03 14:03:29 +01:00
Villena Guillaume
e9dc7fb85c
Rendering: Add configuration options for renderKey lifetime (#57339)
* Add configuration options for `renderKey` lifetime

* Rename config key to `render_key_lifetime`

* Update conf/defaults.ini

Co-authored-by: Joan López de la Franca Beltran <5459617+joanlopez@users.noreply.github.com>

* Add `render_key_lifetime` to sample.ini

Co-authored-by: Joan López de la Franca Beltran <5459617+joanlopez@users.noreply.github.com>
2022-11-03 12:06:55 +01:00
Alex Moreno
3558cadb7e
Alerting: Add title and description to Webhook contact point (#58058)
* Add title and description to Webhook contact point

* Remove deprecation message
2022-11-03 10:52:07 +01:00
Alex Moreno
ba15d675e7
Alerting: Add values to annotations (#57738)
* Add values to annotations

* Fix imports

* Use State attrs instead of Result attrs

* Remove unnecessary variable
2022-11-03 10:35:34 +01:00
Eric Leijonmarck
fc1b647474
Auth: Add fixed repeat migration w. checks for subset of permissions (#58054)
* add: added a repeat migration w. fixed checks for permissions

* add: migration to migrations

* refactor: fix migration instead of making a new one

* fix: removed the old id

* fix: keep old name but change id

* add: migration for patched previous migration

* add: migration from missing file
2022-11-03 08:57:20 +00:00
Jo
eb84358aa7
Auth: Validate Azure ID token version on login is not v1 (#58088) 2022-11-03 09:47:44 +01:00
George Robinson
f2e4cb7c4e
Alerting: Fix feedback (#57922) 2022-11-02 22:36:14 +00:00
George Robinson
215ffee437
Alerting: Fix screenshot is not taken for stale series (#57982) 2022-11-02 22:14:22 +00:00
owensmallwood
7de093738d
PublicDashboards: Adds command to generate map of supported datasources (#57841)
generates map of supported datasources for pubdash
2022-11-02 13:35:57 -06:00
Dimitris Sotirakis
7a12132237
DEB/RPM Packages: Remove old package publishing steps (#58071)
* Remove old publish package steps

* Don't ignore publish packaging failures
2022-11-02 18:42:01 +00:00
Leo
932429a545
LibraryPanels: Replace folderID with folderUID (#56414)
* user essentials mob! 🔱

lastFile:pkg/services/libraryelements/writers.go

* user essentials mob! 🔱

lastFile:pkg/services/libraryelements/writers.go

* user essentials mob! 🔱

lastFile:pkg/services/libraryelements/writers.go

* user essentials mob! 🔱

lastFile:pkg/services/libraryelements/writers.go

* user essentials mob! 🔱

lastFile:pkg/services/libraryelements/database.go

* user essentials mob! 🔱

lastFile:pkg/services/libraryelements/writers.go

* user essentials mob! 🔱

lastFile:pkg/services/libraryelements/writers.go

* user essentials mob! 🔱

* support filterFolderUIDs in the frontend

* move common logic to a variable

* fixed FolderLibraryPanelsPage and improved unit test

* fix backend lint error

* fix formatting error

Co-authored-by: Joao Silva <joao.silva@grafana.com>
Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
Co-authored-by: eledobleefe <laura.fernandez@grafana.com>
Co-authored-by: joshhunt <josh@trtr.co>
2022-11-02 16:49:02 +01:00
Yuriy Tseretyan
3a5ddbfbdf
use logger context in cloudwatch (#57842) 2022-11-02 10:14:02 -04:00
Yuriy Tseretyan
e3a4bde622
Alerting: Condition evaluator with cached pipeline (#57479)
* create rule evaluator
* load header from the context
* init one factory
* update scheduler
2022-11-02 10:13:39 -04:00
Yuriy Tseretyan
d9c40ca41e
Chore: Update sqleng, elasticsearch, tempo and opentsdb plugins to support contextual logs. (#57777)
* make sql engine use pick log context for logs
* update tempo to get log context
* update opentsdb to use log context
* update es client to use log context
2022-11-02 10:03:50 -04:00
Carl Bergquist
06705a49e2
Instrumentation: Log plugin and datasource info for each plugin request. (#54769)
Signed-off-by: bergquist <carl.bergquist@gmail.com>
2022-11-02 14:51:51 +01:00
Kristin Laemmert
706b301285
feat(nested folders): add CountDashboardsInFolder (#57847)
* feat(nested folders): add CountDashboardsInFolder

This commit adds a new method to the Dashboard service and stores: CountDashboardsInFolder. The command struct takes a folderUID, but the store implementation still depends on the parent folder ID. This is temporary; eventually we will replace all references to FolderIDs (associated with Dashboards) with folder UIDs.

There are some unfortunate additional test changes that were necessary after generating the service & store mocks; it looks like that hasn't been generated since the last change(s).

* more test updates
* don't forget the service test
* that didn't end up used, so bye for now
* agree to disagree with the linter
2022-11-02 09:15:50 -04:00
George Robinson
4c581b5f85
Alerting: Fix response is not returned for invalid Duration in Provisioning API (#58046) 2022-11-02 08:21:23 -04:00
Gabriel MABILLE
101ce57a94
RBAC: Allow listing user permissions with scope (#57538)
* RBAC: Allow listing user permissions with scope

* Add docs

* Document the api endpoint

* Update docs

Co-authored-by: Garrett Guillotte <100453168+gguillotte-grafana@users.noreply.github.com>

* Split endpoint in two

* document reloadcache

* Update docs/sources/developers/http_api/access_control.md

* Fix test

* Ieva's nit.

* Simplify flag description

Co-authored-by: Garrett Guillotte <100453168+gguillotte-grafana@users.noreply.github.com>
2022-11-02 10:48:11 +01:00
Ryan McKinley
0c3ed0219e
Storage: fix dummy implementation and tests (#58019) 2022-11-01 20:33:36 -04:00
juanicabanas
fb5401b8b9
PublicDashboards: Orphaned public dashboard item list modified (#58014)
PublicDashboards: Orphaned public dashboard item list modified
2022-11-01 16:56:19 -03:00
Alexander Weaver
ea8c5ce929
SQLStore: Create utility for bulk inserts (#57632)
* Add batchsize to dialects

* Some intermediary progress

* Reflection-based implementation

* Validate batch size

* Implement a few simple tests

* Fix linter error

* Add debug message when falling back to default batch size
2022-11-01 13:24:32 -05:00
Ryan McKinley
5736b46962
Storage: add support for snapshots, dataframes, and raw json objects (#57934) 2022-11-01 08:28:13 -07:00
Ryan McKinley
22648d8581
GRN: minor cleanup (#57924) 2022-11-01 11:09:39 -04:00
Santiago
a3f828de8a
Alerting: Fix flaky test in notifiers (#57927)
* Alerting: Fix flaky test in notifiers

* remove TODO comment
2022-11-01 11:39:14 -03:00
unknowndevQwQ
6dd3584f77
Server: Make unix socket permission configurable (#52944) 2022-11-01 15:04:01 +01:00
Petr Stupka
e99f75f0ca
Alerting: Linking external images securely - Azure Blob (#1) (#56598) 2022-11-01 13:02:17 +01:00
Carl Bergquist
3188af9be3
metrics: expose when the binary was built as an gauge (#57951)
Signed-off-by: bergquist <carl.bergquist@gmail.com>
2022-11-01 13:00:47 +01:00
Lion Ralfs
1f7c84f125
CloudWatch: Fix all-log-groups endpoint when called without logGroupNamePrefix (#57483) 2022-11-01 08:50:04 +01:00
juanicabanas
48120f2594
PublicDashboards: Delete public dashboard in public dashboard table (#57766)
PublicDashboards: delete button added in public dashboard table in order to delete a public dashboard.

Co-authored-by: Jeff Levin <jeff@levinology.com>
2022-10-31 17:16:07 -04:00
Ryan McKinley
6e3a6cce61
Storage: move http wrapper into its own subpackage (#57929) 2022-10-31 13:37:05 -07:00
George Robinson
b0a927b138
Alerting: Add debug logs in validateAndGetPrefix (#57002) 2022-10-31 16:40:28 +00:00
Alexander Weaver
0dfd78c88c
Attempt to preserve UID from migrated channel (#57639) 2022-10-31 11:29:07 -05:00
Ryan McKinley
9149544086
Store: Add SQL tables for SQL based object store (dev mode only) (#57785) 2022-10-31 11:28:19 -04:00
Ieva
5c1a1c8318
change json command parameter names from userID to userId and teamID to teamId (#57902) 2022-10-31 14:32:28 +00:00
Ryan McKinley
3527cad9dc
Store: protobuf based GRN/identifier (#57714) 2022-10-31 07:26:16 -07:00
Ezequiel Victorero
46093c1267
PublicDashboards: do not return errors when resource not found from store layer (#57838) 2022-10-31 11:22:27 -03:00
Andres Martinez Gotor
9391a8ab9b
Google Cloud Monitoring: Set frame interval to draw null values (#57768) 2022-10-31 14:48:32 +01:00
Ieva
2546437e20
add an endpoint for updating several managed permissions with one call (#57893) 2022-10-31 11:46:58 +00:00
Torkel Ödegaard
19b961465c
TopNav: Make it possible to to have sections without children (#57815) 2022-10-31 11:01:34 +01:00
Karl Persson
052d1426f9
Oauth: Display friendly error message when role_attribute_strict=true and no valid role found (#57818)
* Oauth: change error type to a struct that unwraps into a social error

* Oauth: Handle empty role in error and fix unwrap

* Oauth: provide more informatio in error

* Oauth: return InvalidBasicRoleError

* Oauth: Fix tests

* Login: Remove casing

* Oath: Change to warning logs
2022-10-31 09:11:31 +01:00
Karl Persson
1cc6dde836
GenericOauth: Only fetch user data from api if api_url is configured (#57827) 2022-10-28 21:44:09 +00:00
idafurjes
d7bee33398
Add implementation for Create and GetParents of foder store (#57829)
* Add Move implementation

* Remove Move from store

* Add Create and GetParents implementation for folder store
2022-10-28 20:07:25 +02:00
Yuriy Tseretyan
3294918e9f
Alerting: Update state manager to support nil stores and metrics (#57791) 2022-10-28 13:10:28 -04:00
Yuriy Tseretyan
d848cc629b
Alerting: Refactor rule interval validation to be reusable (#57792) 2022-10-28 14:40:11 +00:00
Yuriy Tseretyan
fa043efb2c
Fix: correctly close trace span in Prometheus and Loki data sources (#57774)
* rename span for loki
2022-10-28 10:17:56 -04:00
Kyle Brandt
6126f56ef0
Prometheus: Do not drop errors in streaming parser (#57698)
- Fixes #57692
- and also takes care of #42776 when using the streaming parser, not an ideal fix for #42776 but makes explore work better I think. https://github.com/grafana/grafana/issues/57365 might be a better longer term solution
2022-10-28 10:11:06 -04:00
Shirley
c2e9e797b3
CloudWatch: fix non-deterministic test (#57831) 2022-10-28 10:05:55 -04:00
idafurjes
6b483a8dca
Add implementation for folder store methods (#57700)
* Add implementation for folder store methods

* Add Move implementation

* Add back comment and fix query

* Remove Move from store

* Adjust GetChildren

* Fix errutil error declaration and usage

* Add org id to get children query
2022-10-28 15:35:49 +02:00
Kyle Brandt
2cd9cbd359
Prometheus: Chore - Remove incorrect FrameType from exemplar frame (#57695) 2022-10-28 09:15:01 -04:00
Kristin Laemmert
6a6fdbc1f9
chore: updates to the new folder model (#57776) 2022-10-28 08:23:39 -04:00
Andrej Ocenas
0845ac2f53
Profiling: Add Phlare and Parca datasources (#57809)
* Add phlare datasource

* Rename

* Add parca

* Add self field to parca

* Make sure phlare works with add to dashboard flow

* Add profiling category and hide behind feature flag

* Update description and logos

* Update phlare icon

* Cleanup logging

* Clean up logging

* Fix for shift+enter

* onRunQuery to set label

* Update type naming

* Fix lint

* Fix test and quality issues

Co-authored-by: Joey Tawadrous <joey.tawadrous@grafana.com>
2022-10-28 13:33:37 +02:00
Kevin Minehart
fd16cad7da
Only provide version ot build-frontend-packages if it's a valid semver (has 2 digits) (#57808) 2022-10-28 05:04:59 -04:00
Jeff Levin
bf672f960a
public dashboards: rename api functions (#57789)
This PR imposes better naming conventions on public dashboards api

* rename api functions and remove use of _config_ noun

* fix tests

Co-authored-by: Ezequiel Victorero <ezequiel.victorero@grafana.com>
2022-10-27 17:08:11 -08:00
Jeff Levin
6b7d6fe0cb
public dashboards: rename route paths (#57787)
This PR fixes the naming of routes for public dashboards to be more accurate and descriptive.

Co-authored-by: Ezequiel Victorero <ezequiel.victorero@grafana.com>
2022-10-27 14:41:56 -08:00
Alex Moreno
c08c14f8dd
Alerting: Add custom title to pushover contact point (#57530)
* Add custom title to pushover contact point

* Update pkg/services/ngalert/notifier/channels/pushover.go

Co-authored-by: Santiago <santiagohernandez.1997@gmail.com>

* Use simplejson

* Use more verbose variable names

Co-authored-by: Santiago <santiagohernandez.1997@gmail.com>
2022-10-27 19:07:01 +02:00
Will Browne
9f77bd4728
Plugins: Use public store instead of internal registry (#57631)
* Plugins: Use public store instead of internal registry

* update comments

* fix import

* fix test
2022-10-27 18:44:28 +02:00
Yuriy Tseretyan
facf2b1ee8
Chore: Update prometheus, loki, graphite and influx plugins to support contextual logs. (#57708) 2022-10-27 12:05:06 -04:00
Selene
bff9671b81
Rendering: Check timeout error when the request failed (#57654)
* Check timeout error when the request failed

* Update error and check

* Uses errors.As to fix the lint
2022-10-27 17:27:03 +02:00
Alex Moreno
10fdfa8583
Alerting: Change handling of settings to pagerduty contact point (#57524)
* Add custom title to pagerduty contact point

* Fix tests by saving decrypted key

* Use simplejson
2022-10-27 16:20:10 +02:00
Alex Moreno
f8d12af021
Add custom title to googlechet contact point (#57517)
* Add custom title to googlechet contact point

* Update pkg/services/ngalert/notifier/channels/googlechat.go

Co-authored-by: Santiago <santiagohernandez.1997@gmail.com>

* Use simplejson

Co-authored-by: Santiago <santiagohernandez.1997@gmail.com>
2022-10-27 16:19:48 +02:00
Alex Moreno
3d437117ad
Alerting: Add custom title to discord contact point (#57506)
* Add custom title to discord contact point

* Update pkg/services/ngalert/notifier/channels/discord.go

Co-authored-by: Santiago <santiagohernandez.1997@gmail.com>

* Use simplejson

Co-authored-by: Santiago <santiagohernandez.1997@gmail.com>
2022-10-27 16:17:18 +02:00
Alex Moreno
1ab0af1eb2
Alerting: Add custom title to DingDing contact point (#57498)
* Add custom title to DingDing contact point

* Update pkg/services/ngalert/notifier/channels_config/available_channels.go

Co-authored-by: Santiago <santiagohernandez.1997@gmail.com>

* Update pkg/services/ngalert/notifier/channels/dingding.go

Co-authored-by: Santiago <santiagohernandez.1997@gmail.com>

* Add error checking before URL templating

* Remove comment

* Use simplejson

Co-authored-by: Santiago <santiagohernandez.1997@gmail.com>
2022-10-27 16:16:36 +02:00
Alex Moreno
fb62660df7
Alerting: Add title and description to VictorOps contact point (#57458)
* Add title and description to VictorOps contact point

* Update pkg/services/ngalert/notifier/channels_config/available_channels.go

Co-authored-by: Santiago <santiagohernandez.1997@gmail.com>

Co-authored-by: Santiago <santiagohernandez.1997@gmail.com>
2022-10-27 16:12:14 +02:00
Alex Moreno
73a9e2a115
Add title and description to Threema contact point (#57429) 2022-10-27 16:11:38 +02:00
Alex Moreno
6839154720
Alerting: Add missing custom title and description to Line contact point (#57388)
* Add title and description to Line receiver

* Fix labal names for LINE contact point
2022-10-27 15:27:04 +02:00
Alex Moreno
1dcc432537
Alerting: Add missing custom title and description fields in Kafka contact point (#57361)
* Add description and details to Kafka notifier

* Fixed testing and add new logic testing

* Add proper description to kafka contact point UI

* Update pkg/services/ngalert/notifier/channels_config/available_channels.go

Co-authored-by: Santiago <santiagohernandez.1997@gmail.com>

* Update pkg/services/ngalert/notifier/channels_config/available_channels.go

Co-authored-by: Santiago <santiagohernandez.1997@gmail.com>

Co-authored-by: Santiago <santiagohernandez.1997@gmail.com>
2022-10-27 15:25:54 +02:00
Shirley
96beb3a3f1
Cloudwatch: refactor parsing metric data queries (#57624) 2022-10-27 14:10:49 +02:00
idafurjes
50fb47dba0
Chore: Remove methods from sqlstore (#57545)
* Remove methods from sqlstore

* Remove commented out code

* Remove GetUserById from tests

* Adjust fake for get user profile

* Adjust test

* Adjust go mod files

* Try fix test

* Test adjustment

* Adjust test 2

* Remove commented out code
2022-10-27 11:44:09 +02:00
Artur Wierzbicki
1df8a85a42
Search: load dashboard performance improvements (#57509)
* fix windows storage init

* fixxx

* close session asap

* fix span end

* error handling

* add comment

* simplify

* simplify

* fix limit

* pass readDashboardCtx to summary builder

* add string slice validation
2022-10-27 14:52:42 +08:00
Santiago
cdb5d4230a
Alerting: Fix "Not Implemented" responses (#57710)
* fix swagger spec, return 404 instead of 501 when an endpoint does not exist

* update number of paths in authorization_test.go
2022-10-26 23:35:52 -03:00
Yuriy Tseretyan
0a4121cef8
Alerting: Contextual log provider for rule key (#57476)
* create contextual log context provider
* use contextual provider in scheduler
* init logger in the package
* use context for log context
* use context in state manager
2022-10-26 19:16:02 -04:00
Ryan McKinley
7346280316
LibraryPanels: Load library panels in the frontend rather than the backend (#50560)
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2022-10-26 15:38:20 -07:00
Yuriy Tseretyan
2d20c8db7b
Chore: Expression engine to support relative time range (#57474)
* make TimeRange interface and add relative range
* make Execute methods support the current time
* update resample to support relative time range
* update DSNode to support relative time range
* update query service to create queries with absolute time
* make alerting evaluator create relative time ranges
2022-10-26 16:13:58 -04:00
Ezequiel Victorero
7b819284c1
PublicDashboards: use orgId when querying dashboards (#57696) 2022-10-26 14:49:43 -03:00
Ezequiel Victorero
fe9c0c881e
PublicDashboards: remove function with business logic from database layer and use it at service layer (#57684) 2022-10-26 12:53:33 -03:00
Kristin Laemmert
6c982e5b71
some file moving and struct renaming (#57686) 2022-10-26 11:52:01 -04:00
Emil Tullstedt
1e2b7c5368
Errors: Add HTTP writer for errutil.Error (#57661) 2022-10-26 16:57:53 +02:00
Kristin Laemmert
b346ae0310
feat: add new Folder table migration & define nested folder interfaces (#56882)
* feat: add new Folder table migration

Add a new folder table to support the Nested Folders feature.

https://github.com/grafana/grafana/issues/56880

* register nested folders feature flag (unused)

* feat: nested folder service (experiment)

This commit adds a NestedFolderSvc interface and stubbed out implementation as an alternative to the existing folder service. This is an experimental feature to try out different methods for backwards compatibility and parallelization, so that Grafana can continue to store folders in the existing (non-nested) manner while also using the new nested folder service.

Eventually the new service will (hopefully) become _the_ service, at which point the legacy service can be deprecated (or remain, with the new service methods replacing the original. whatever makes sense at the time).


* nested folders: don't run the new migration

This commit removes the nested folder migration from the list of active migrations so we can merge this branch and continue development without impacting Grafana instances built off main.
2022-10-26 10:15:14 -04:00
Erik Sundell
94aa090fb0
Cloudwatch: Refactor namespaces resource request (#57590)
* add route tests

* remove not used method

* pr feedback

* change variable name
2022-10-26 15:54:23 +02:00
juanicabanas
e81ce1dae7
PublicDashboards: Fix GET public dashboard that doesn't match
PublicDashboards: Fix GET public dashboard that doesn't match
2022-10-26 09:25:24 -04:00
Jo
77437f2c89
Add multi-auth devenv (#57609)
* add authentik devenv

* remove direct dependency on spew

* use cn

* add authentik instructions

* add backup instructions
2022-10-26 13:46:50 +02:00
Ieva
92531c5596
move data source permission model to enterprise repo (#57615) 2022-10-26 11:49:45 +01:00
Ryan McKinley
a3acfb1a48
Chore: Register a feature flag for "newDBLibrary" (#57468) 2022-10-25 18:20:41 -07:00
Ezequiel Victorero
860380d893
PublicDashboards: refactor following naming convention for services (#57625) 2022-10-25 21:40:42 -03:00
Michael Mandrus
5879805e4b
PublicDashboards: Fix unsafe code snippets (#57641)
* return an error if we can't extract queries from a panel

* check for null or undefined
2022-10-25 20:16:10 -04:00
Ryan McKinley
e6575bab76
Playlist: allow using object store as the backend (#57467) 2022-10-25 16:51:01 -07:00
Artur Wierzbicki
6abd4cd8e8
Chore: pointerify dummy server (#57640) 2022-10-25 19:27:31 -04:00
Ezequiel Victorero
c5e420a94c
PublicDashboards: move methods from store to service (#57599) 2022-10-25 16:29:18 -03:00
Shirley
76a3a1eda7
CloudWatch: migrate tests to metrics data query request parsing level, add tests (#57431) 2022-10-25 15:53:54 +02:00
Artur Wierzbicki
a63c529ad1
Chore: add query_retries=3 to querylibrary_integration_test.go (#57607) 2022-10-25 09:52:56 -04:00
Kristin Laemmert
225ed4cc0a
GRN parsing service (#56750)
* GRN parsing service
* move GRN package into infra and update fields
* remove orgID from GRNs (collapse into tenantID)
2022-10-25 09:07:24 -04:00
Erik Sundell
5daa87d7a1
Cloudwatch: Remove unused code (#57593)
* remove not used code and refactor check health

* fix broken test

* remove not used variable
2022-10-25 15:03:51 +02:00
Erik Sundell
4c654ddb76
Cloudwatch: Refactor metrics resource request (#57424)
* refactor metrics request

* Update pkg/tsdb/cloudwatch/routes/dimension_keys_test.go

Co-authored-by: Shirley <4163034+fridgepoet@users.noreply.github.com>

* return metric struct value intead of pointer

* make it possible to test hard coded metrics service

* test all paths in route

* fix broken test

* fix one more broken test

* add integration test

Co-authored-by: Shirley <4163034+fridgepoet@users.noreply.github.com>
2022-10-25 14:00:54 +02:00
Todd Treece
53d7404e2b
Chore: Add appcontext.WithUser and appcontext.User (#57534) 2022-10-25 07:51:24 -04:00
sh0rez
beaaabd770
live: explicitely reply with http 200 (#57428)
`pkg/web` triggers a panic when a http handler chain does not return any
response to the client.
This has been put in place, because it usually means a middleware along
the way did not call the next one.

In this specific case however, the handlers meant to return 200, but did
not do so explicitely, instead relying on the default behavior of `net/http`
2022-10-25 11:45:54 +02:00
Karl Persson
7386f8652c
RBAC: Improve performance of dashboard filter query (#56813)
* RBAC: Move UserRolesFilter to domain package

* Dashboard Permissions: Rewrite rbac filter to check access in sql

* RBAC: Add break when wildcard is found

* RBAC: Add tests for dashboard filter

* RBAC: Update tests

* RBAC: Cover more test cases

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
2022-10-25 11:14:27 +02:00
Erik Sundell
8adbacb18e
Cloudwatch: Refactor datasource instance factory method (#57452)
* wip

* fix broken test
2022-10-25 09:52:12 +02:00
Joey Tawadrous
d9a6c3f398
FlameGraph: Add newly designed flame graph icon (#57514)
* Add newly designed flame graph icon

* Update expectedListResponse
2022-10-25 07:18:17 +01:00
Artur Wierzbicki
e485ddd13d
Store: don't marshall/unmarshall the dashboard when building a summary (#57520)
* dont pretty print the dashboard

* stop marshalling the dashboard

* do not sanitize for searchV2

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2022-10-25 09:39:17 +08:00
Artur Wierzbicki
749b3b6263
Storage: Fix initialization on windows (#57504) 2022-10-25 09:27:22 +08:00
Galen Kistler
f93c3acc51
Prometheus: Flavor/version configuration (#57554)
* Revert "Revert "Prometheus: Type and flavor configuration (#56496)" (#57552)"
This reverts commit 2432ce619a.
* Adds new fields and documentation for Prometheus datasource configuration: prometheus type, and version
2022-10-24 14:53:11 -05:00
Guilherme Caulada
cfd9e72da5
Add dashboards to the navtree on public dashboards (#57542) 2022-10-24 16:34:27 -03:00
Galen Kistler
2432ce619a
Revert "Prometheus: Type and flavor configuration (#56496)" (#57552)
This reverts commit 7ecbc98b3e.
2022-10-24 12:33:11 -05:00
Galen Kistler
7ecbc98b3e
Prometheus: Type and flavor configuration (#56496)
* Adding two new fields to the data JSON in the prometheus datasource configuration: prometheusType, and prometheusVersion.
* Version field will attempt to auto-detect via buildinfo API when prometheus Type is selected
2022-10-24 09:26:32 -05:00
Erik Sundell
017da781cf
Cloudwatch: Refactor dimension values resource request (#57346)
* refactor dimension values backend

* fix test file name
2022-10-24 15:04:25 +02:00
Shirley
9ebed91eed
CloudWatch: Refactor to extract DataQuery grouping by region out of request parsing (#57392)
* CloudWatch: Extract request parsing grouping by region from ParseQueries

* Rename ParseQueries to ParseMetricDataQueries
2022-10-24 14:57:32 +02:00
idafurjes
1bda67ab11
Chore: Delete unused mocks (#57512)
* Chore: Delete unused mocks

* Add back used methods

* Add back used mocks 2

* Add back used mocks 3

* Add back used mocks 4

* Add back the alerting mocks

* Remove mock variables

* Add bacl needed mock var
2022-10-24 14:00:22 +02:00
Karl Persson
78c849ac29
RBAC: Fetch service account permissions in oss (#57343) 2022-10-24 12:11:59 +02:00
Eric Leijonmarck
924d6a82a3
add: postgresql as a database for resolving conflicts (#57466) 2022-10-24 10:59:26 +01:00
Artur Wierzbicki
6e3de8d016
gRPC Server: Fix logging unauthenticated request error (#57490) 2022-10-23 03:51:23 +08:00
Ezequiel Victorero
1f3d34ecda
PublicDashboards: service and store methods rename (#57463) 2022-10-21 18:25:20 -03:00
Alexander Weaver
de46c1b002
Alerting: Improve logs in state manager and historian (#57374)
* Touch up log statements, fix casing, add and normalize contexts

* Dedicated logger for dashboard resolver

* Avoid injecting logger to historian

* More minor log touch-ups

* Dedicated logger for state manager

* Use rule context in annotation creator

* Rename base logger and avoid redundant contextual loggers
2022-10-21 16:16:51 -05:00
Ryan McKinley
910154c102
ObjectStore: Add folder to kind registry (#57461) 2022-10-21 16:48:32 -04:00
owensmallwood
0b8fb543fc
Public Dashboards: Can toggle annotations in modal (#57312)
adds toggle for pubdash annotations
2022-10-21 13:42:14 -06:00
Kristina
5d7d54d076
Auth: Write the redirect cookie if denied - do not write a blank redirect (#57381)
* Write the redirect cookie if denied - do not write a blank redirect

* Remove redundant code, reverse polarity
2022-10-21 09:53:17 -05:00
bikashmishra100
98053cfde8
Tempo: Add start time and end time parameters while querying traces (#48068)
* Add start time and end time parameters while querying tempo traces

* Added configurable time shift to query by trace id

* Test that the URL is formatted correctly

* Added test to check for time shift

* Improved label and tooltip of new time shift settings

Co-authored-by: André Pereira <adrapereira@gmail.com>
2022-10-21 15:38:10 +01:00
Yuriy Tseretyan
245c1ee3d3
Chore: Add last downsampling function to Resample expression (#57379) 2022-10-21 10:03:43 -04:00
Karl Persson
d55e5b8862
[main] Login email before username (#57400)
* Swap order of login fields

* Validate email field before validating the username field.

Co-authored-by: linoman <2051016+linoman@users.noreply.github.com>
2022-10-21 15:21:21 +02:00
Ezequiel Victorero
5b9959014c
PublicDashboards: refactor service (#57372) 2022-10-21 09:37:38 -03:00
Marcus Efraimsson
6f8fcae01b
[main] Plugin fixes (#57399)
* Plugins: Remove support for V1 manifests

* Plugins: Make proxy endpoints not leak sensitive HTTP headers

* Security: Fix do not forward login cookie in outgoing requests

(cherry picked from commit 4539c33fce)

Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
2022-10-21 13:54:55 +02:00
lean.dev
552d9d70eb
PublicDashboards: Validate access token (#57298)
Adding validation for access token
2022-10-20 16:43:33 -03:00
Alexander Weaver
5ee4744d62
Alerting: Improve operational logs in sender package (#57134)
* Audit logs in sender package

* Fix casing and touch up a few key names

* Avoid logging entire alert struct

* Log configuration ID being applied

* Revert change to errorf rather than log

* Tune levels further and remove some redundancies

* Adjust logger naming and standardize log context

* Adjust logger naming in router

* Move log and get rid of dead error handling code
2022-10-20 14:19:04 -05:00
Yuriy Tseretyan
f3c219a980
Alerting: update format of logs in scheduler (#57302)
* Change the severity level of the log messages
2022-10-20 13:43:48 -04:00
Josh Hunt
8cebaf345d
User: Fix externalUserId not being populated (#57341) 2022-10-20 18:12:53 +01:00
Guilherme Caulada
96a97f9827
Build: Add github release command to build/cmd (#56349)
* Add github release command to build/cmd

* Use go-github library and implement dry-run

* Make tag optional and default to metadata

* Fix minor bug with tag default

* Make some refactors to ease testing

* Add tests for publish github command

* Refactor publish github tests

* Refactor test helper function name

* Isolate local test
2022-10-20 11:11:53 -03:00
mikkancso
a4e66a2a01
Connections: New "Connect data" page with data source catalog (#56772)
* remove Plugins and CloudIntegrations tab and add ConnectData tab

* ConnectData: add Search component and use it

* ConnectData: add DataSourcePluginList component

* add CardGrid component

* add CategoryHeader component

* ConnectData: restructure content

DataSourcePluginList is removed, because its responsibilities are
actually the same as ConnectData's responsibilities.

NoResults was added as a reusable component, and was moved out of
CardGrid, since there could be more CardGrid on one page, but only one
NoResults.

* fix spacer

* use LoadingPlaceholder

* CardGrid: add margin

* generalize CardGridProps

* move isLoading and error into CardGrid

We'd like CardGrid to be reusable, even multiple times within a page.
In this case, it's better UX if we show the loading or error states per
card grid, not for the whole page.

* ConnectData: fix NoResults condition

* fix and add meaningful tests

* fix indentation

* move isLoading and error back to ConnectData

* make `url` required for CardGrid items
2022-10-20 15:53:10 +02:00
Erik Sundell
b0c2ca6c1b
Cloudwatch: Refactor dimension keys resource request (#57148)
* use new layered architecture in get dimension keys request

* go lint fixes

* pr feedback

* more pr feedback

* remove not used code

* refactor route middleware

* change signature

* add integration tests for the dimension keys route

* use request suffix instead of query

* use typed args also in frontend

* remove unused import

* harmonize naming

* fix merge conflict
2022-10-20 12:53:28 +02:00
Jo
7f3536a6d2
OAuth: Fix misleading warn log related to oauth and increase logged content (#57336)
* only emit warn log when sync is not skipped. Fix warn log that had wrong recommendation

* log presence of refresh token
2022-10-20 05:50:12 -04:00
Shirley
cadc6088db
CloudWatch: move QueryData input parsing types to separate package (#57165)
* CloudWatch: move parse request types separate package

* Move metric query constants, unexport metricDataQuery json decoding type

* Unexport isSearchExpression
2022-10-20 11:21:13 +02:00
Karl Persson
764d5b9929
RBAC: Cleaup team api rbac tests (#57265)
* RBAC: Remove the access control evaluator fake

* API: Change to use access control implementation instead of mocks with
rbac disabled in tests

* Tests: Set cfg and access control defaults after applying options

* Tests: Rewrite team legacy access control tests

* Tests: Add helper function to create user with permissions

* Tests: set fake quota service as default

* Team: Add ExpectedTeamDTO and set in query result

* RBAC: Revert change

* RBAC: Add deprecation notice to mock
2022-10-20 09:11:47 +02:00
Ryan McKinley
ed1176adc8
Storage: export dashboards + playlists to object store (#57313) 2022-10-19 17:05:51 -07:00
Alexander Weaver
3ddb28bad9
Find-and-replace 'err' logs to 'error' to match log search conventions (#57309) 2022-10-19 17:36:54 -04:00
Ezequiel Victorero
3e6bdf0439
PublicDashboards: filter by permissions on audit list (#57228) 2022-10-19 17:24:00 -03:00
Yuriy Tseretyan
3e6bc28de5
Alerting: Change severity level of fetcher log messages (#57299) 2022-10-19 16:00:47 -04:00
juanicabanas
4418d78440
PublicDashboards: Delete public dashboard when dashboard is deleted (#57291)
PublicDashboards: Delete public dashboard when dashboard is deleted
2022-10-19 16:47:08 -03:00
Alexander Weaver
4eb8e4ff66
Alerting: Add traceability headers for alert queries (#57127)
* Define EvaluationContext

* Refactor ConditionEval to use new context struct

* Refactor QueriesAndExpressionsEval to use EvaluationContext

* Remove dead field from AlertExecCtx

* Refactor Validate to use EvaluationContext

* Get rid of privately used AlertExecCtx

* Move EvaluationContext to new file and add helper

* Add builder pattern and bind rule info to context

* Extract header logic and add rule UID header

* Fix missing call
2022-10-19 14:19:43 -05:00
Santiago
85cda0db69
Alerting: Templated URLs for webhook type contact points (#57296)
* templated URLs for webhooks

* clear tmplErr before using tmpl() again
2022-10-19 16:14:53 -03:00
Selene
8a35cb57fa
Fix null pointer (#57292) 2022-10-19 13:20:03 -04:00
Gabriel MABILLE
717bd4a6c0
RBAC: Add a feature toggle for primitives we provide to OnCall (#57289) 2022-10-19 18:10:09 +02:00
Ryan McKinley
15517f8329
SQLX: Expose sqlxdb query functions (#57227) 2022-10-19 07:33:40 -07:00
Ryan McKinley
de3737b5de
Store: Add resolver service (#57112) 2022-10-19 07:33:26 -07:00
Galen Kistler
0b66abba18
add case for empty influxdb 1 versions, so the health check doesn't fail (#56426) 2022-10-19 08:15:32 -05:00
Kristin Laemmert
05709ce411
chore: remove sqlstore & mockstore dependencies from (most) packages (#57087)
* chore: add alias for InitTestDB and Session

Adds an alias for the sqlstore InitTestDB and Session, and updates tests using these to reduce dependencies on the sqlstore.Store.

* next pass of removing sqlstore imports
* last little bit
* remove mockstore where possible
2022-10-19 09:02:15 -04:00
Dimitris Sotirakis
e829b50149
CI: Add CreateTempDir func and use it in publish packages logic (#57171)
* Add CreateTempDir func and use it in publish packages logic

* Fill err return in defer func
2022-10-19 12:58:22 +02:00
Karl Persson
9adaf1565c
RBAC: Allow to list users for dashboard / folder admins (#57080)
* RBAC: Use query struct in tests

* RBAC: If access control enforcement is disabled don't filter out users
when fetching permissions
2022-10-19 11:53:59 +02:00
Dimitris Sotirakis
0b72c36527
Replace json decoder with io.ReadAll (#57178) 2022-10-19 12:51:24 +03:00
Gábor Farkas
0491c19712
elastic: backend-mode: fix trimEdges functionality (#56985) 2022-10-19 10:40:42 +02:00
aimuz
c0cc85b5f1
Alerting: Add support for wecom apiapp (#55991)
This change adds new functionality to the wecom alerting contact point. In addition to a webhook address, you can now send alerts to the wecom apiapp endpoint.

Based on https://github.com/grafana/grafana/discussions/55883

Signed-off-by: aimuz <mr.imuz@gmail.com>
2022-10-19 12:17:37 +08:00
owensmallwood
b2408dd7c5
Publicdasboards: Add annotations support (#56413)
adds annotations support for public dashboards
2022-10-18 19:48:20 -06:00
Michael Mandrus
2a8a82e2af
PublicDashboards: Don't filter datasources from FrontendSettings in a public dashboard (#57208)
* add filter skip to avoid issues with RBAC

* update comment
2022-10-18 15:44:33 -04:00
Misi
9c954d06ab
Auth: Refresh OAuth access_token automatically using the refresh_token (#56076)
* Verify OAuth token expiration for oauth users in the ctx handler middleware

* Use refresh token to get a new access token

* Refactor oauth_token.go

* Add tests for the middleware changes

* Align other tests

* Add tests, wip

* Add more tests

* Add InvalidateOAuthTokens method

* Fix ExpiryDate update to default

* Invalidate OAuth tokens during logout

* Improve logout

* Add more comments

* Cleanup

* Fix import order

* Add error to HasOAuthEntry return values

* add dev debug logs

* Fix tests

Co-authored-by: jguer <joao.guerreiro@grafana.com>
2022-10-18 18:17:28 +02:00
Artur Wierzbicki
984ec00aac
Search: load dashboards optimization (#56933)
* search: load dashboards optimization

* search: load dashboards optimization

* search: close dashboard channel, return error when context is done

* search: refactor

* search: return err on ctx done

* search: remove sleep
2022-10-18 23:53:15 +08:00
juanicabanas
71f79b9de0
PublicDashboards: Fix hidden queries execution (#57004)
PublicDashboards: Fix hidden queries execution
2022-10-18 10:47:24 -03:00
ying-jeanne
ed98d7bc27
Chore: remove busmock (#57170) 2022-10-18 13:31:56 +00:00
Eric Leijonmarck
fa45742abc
Quota(fix): remove service accounts from quota count (#56700) 2022-10-18 12:26:38 +01:00
Gabriel MABILLE
3963ed3754
RBAC: Allow access to /dashboards when user has dashboards create (#56712)
* RBAC: Allow access to dashboards when user has dashboards create

* Remove eval any that I didn't add on purpose
2022-10-18 11:15:52 +02:00
Shirley
65939ce5b1
CloudWatch: Move logger to its own package and minor refactoring (#57107)
* Move log to its own package

* Rename test-data to testdata

* Change alias to string type

* Remove parseQueries from a method of cloudWatchExecutor
2022-10-18 04:21:18 -04:00
Erik Sundell
36734f3cef
CloudWatch: Move hard coded metrics, namespaces and dimensions to its own package (#57089)
* move hard coded metrics to its own package

* remove comment
2022-10-18 09:23:47 +02:00
Matthew Jacobson
0db339d82f
Alerting: Improve notification policies created during migration (#52071)
* Alerting: Improve notification policies created during migration

Previously, migrated legacy alerts were connected to notification policies through
a `rule_uid` label in a 1:1 fashion. While this correctly mimicked pre-migration routing,
it didn't create a notification policy structure that is easy to view/modify. In addition,
having one policy per migrated alert is, in some ways, counter to the recommended approach of
Unified Alerting.

This change replaces `rule_uid`-based migrated notification policies with a private
label called `__contacts__`. This label stores a list of double quoted strings containing the names of
all contact points an AlertRule should route to (based on legacy notification channels). Finally,
one notification policy is created per contact point with each matching AlertRules via regex on this
`__contacts__` label.

The result is a simpler, clearer, and easier to modify notification policy structure, with the
added benefit that you can see which contact points an AlertRule is being routed to from the
AlertRule creation page.
2022-10-18 00:47:39 -04:00
Jeff Levin
7146f2731c
Public Dashboards: audit log paths and add traceId where user facing error is different (#56914)
Audit all paths for publicdashboards and implement traces where user facing error is different from the internal error.
2022-10-17 13:17:24 -08:00
Santiago
6ad405e256
fix swagger spec for receivers API response (#57124) 2022-10-17 16:58:55 -03:00
Yuriy Tseretyan
888bdfd4ad
Alerting: Use correct response body for silence post API (#57114) 2022-10-17 15:43:37 -04:00
Sofia Papagiannaki
46fb4081ba
SQLStore: Optionally retry queries if sqlite returns database is locked (#56096)
* SQLStore: Retry queries if sqlite returns database is locked

* Configurable retries

* Apply suggestions from code review

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
2022-10-17 21:23:44 +03:00
Dimitris Sotirakis
c96b6a6ab0
CI: Move CreateTempFile - use it for rpm/deb packages (#56990)
* Move CreateTempFile - use it for rpm/deb packages

* Fix typo

* Fix tests:
2022-10-17 16:23:57 +01:00
Selene
ba6c715708
Chore: Delete unused db in orgs and use db in datasources (#57085)
* Delete unused db in orgs and use db in datasources

* Sort imports
2022-10-17 16:27:56 +02:00
Karl Persson
21792fdf37
RBAC: Make uid for managed role names deterministic during migrations (#56620)
* RBAC: Change the generate uid function to be deterministic so we can avoid collision

* RBAC: Use fmt.Errorf

* RBAC: Add comment

* RBAC: Export GenerateManagedRoleUID
2022-10-17 12:15:20 +02:00
Torkel Ödegaard
9f5e691994
Theme: Inter font (behind feature toggle) (#56441)
* Theme: Inter font change with new line-height

* Add it behind feature toggle

* make buildVariant easier to read + enforce integer multiples of 2 (#56486)

* Minor update

* Update

Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
2022-10-15 16:22:33 +02:00
Alexander Weaver
129a28919b
Alerting: Cache result of dashboard ID lookups (#56587)
* Create caching dashboard resolver

* A couple tests for dashboard resolving

* Log warning on not found

* Additional polish + review nits

* Move to singleflight instead of a plain mutex

* Store errors instead of -1 in cache and use reflection when reading

* Address linter error

* One more linter error
2022-10-14 15:48:02 -05:00
Kristin Laemmert
c61b5e85b4
chore: replace sqlstore.Store with db.DB (#57010)
* chore: replace sqlstore.SQLStore with db.DB

* more post-sqlstore.SQLStore cleanup
2022-10-14 15:33:06 -04:00
Michael Mandrus
ea8549b8c2
Datasources: Support mixed datasources in a single query (#56832)
* initial cut at refactor - need to run more tests

* fix unit tests

* change newly unused function to test helper

* create unit tests for parsing query requests that cover a range of cases

* add some comments

* rename function to avoid dev confusion
2022-10-14 10:27:06 -04:00
Josh Hunt
2e16d5499e
Dashboard: Add dashboard validation warning to save drawer (#55732)
* add api route for validating a dashboard json

* add feature flag for showDashboardValidationWarnings

* tidy up

* comments and messages

* swagger specs

* fix typo

* more swagger

* tests!

* tidy test a little bit

* no more ioutil

* api will return different status code depending on validation error

* clean up

* handle 4xx errors

* remove console.log

* fix backend tests

* tidy up

* Swagger: Exclude alpha endpoints

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
2022-10-14 09:51:05 -04:00
George Robinson
2f85172718
Alerting: Remove blank comment (#56889) 2022-10-14 13:28:41 +01:00
Gabriel MABILLE
0f4d126109
AzureAD: Add option to force fetch the groups from the Graph API (#56916)
* Add a new option to systematically fetch AzureAD groups from the Graph API
2022-10-14 12:55:00 +02:00
Jorge Luis Betancourt
e4f2006cce
Elasticsearch: Fix calculation of trimEdges (#56148)
* Elasticsearch: Fix calculation of trimEdges

When a value of trimEdges is set greater than 1 we need to drop both the
first and last sample of the data from the response.

* Elasticsearch: Fix reading trimEdges from the query settings

Currently the trimEdges property in the JSON panel is stored as a string
and not directly as a number.

This caused that the reading of the value failed in the go backend
because the simplejson.Int() method doesn't properly handle this case.
This failure when decoding the value goes unnoticed because of the early
return causing the trimEdges configuration to be ignored.

* Refactor castToInt to also return an error

Add a new test case that sets the `trimEdges` property as a quoted
number.
2022-10-14 12:53:12 +02:00
sam boyer
7767002e12
dashboards: Use @grafanamaturity(NeedsExpertReview) in schema (#56888) 2022-10-14 05:10:39 -04:00
Alexander Weaver
145b970557
Propagate all headers on main QueryData (#56896) 2022-10-13 14:18:53 -05:00
juanicabanas
75a5777e36
PublicDashboards: Validate access token not to be duplicated and add retries. (#56755)
PublicDashboards: Validate access token not to be duplicated and add retries.
2022-10-13 11:32:32 -03:00
Ryan McKinley
3b4b528993
Storage: Dashboard summary builder cleanup (#56665) 2022-10-13 09:29:19 -04:00
Santiago
9996dbd577
use Prometheus' format for notification attempts durations (#56822) 2022-10-13 10:08:09 -03:00
Santiago
3c56fd8da0
Fix duplicated receivers in API response (#56829) 2022-10-13 10:01:28 -03:00
idafurjes
ef651daed2
Use org service instead of sqlstore (#56407)
* Use org service instead of sqlstore

* Remove methods from sqlstore

* Remove commented out code

* Fix lint

* Fix lint 2
2022-10-13 08:40:46 -04:00
Yaelle Chaudy
0295177bb0
Cloud Monitoring: Fix missing data when result is paginated (#56270)
* Added nextPageToken prop

* Adding first and pageToken condition to while loop

* clean up

* revert gitignore

* fix go lint

* Added logic to builder too

* Removed pageSize - was for local testing

* gofmt

* extracted doRequest function

* extracted doRequest in query too

* Adressed filter comments

* Adressed query comments

* go fmt

* removed pageSize added for testing

* go fmt again
2022-10-13 10:58:07 +02:00
Jeff Levin
cc27214dca
Public Dashboards: Add audit table (#54508)
This PR adds an audit table for public dashboards allowing a user to view all public dashboards on an instance of grafana. The public dashboards team is working on a proposal for adding RBAC support to the audit table for 9.3

Co-authored-by: juanicabanas <juan.cabanas@grafana.com>
2022-10-12 21:36:05 -08:00
Joe Blubaugh
c7c640d903
Alerting: Fix email image embedding on Windows. (#56766)
The email notifier was incorrectly handling Windows filepaths. This is
fixed by using the `path/filepath` package.
2022-10-13 10:24:00 +08:00
George Robinson
004bb7689d
Alerting: Fix mathexp.NoData for ConditionsCmd (#56816) 2022-10-12 17:34:28 +01:00
Alex
94ed744454
Auth: Make built-in login configurable (#46978) 2022-10-12 15:34:59 +00:00
Karl Persson
b1761908c2
RBAC: Add primary key to seed_assignment table (#56540)
* RBAC: Add seed_assignment migrations from enterprise

* RBAC: Create migration to add primary key to seed_assignment table
2022-10-12 15:18:07 +02:00
Gabriel MABILLE
5fcec05695
LDAP: log that organization mapping is skipped (#56796) 2022-10-12 08:41:11 -04:00
ying-jeanne
80ede174dd
update the feature toggle usage in backend (#56787) 2022-10-12 13:43:35 +02:00
Gabriel MABILLE
10c080dad1
LDAP: Add skip_org_role_sync configuration option (#56679)
* LDAP: Add skip_org_role_sync option

* Document the new config option

* Nit on docs

* Update docs/sources/setup-grafana/configure-security/configure-authentication/ldap.md

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>

* Docs suggestions

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
Co-authored-by: Jguer <joao.guerreiro@grafana.com>

* Add test, Fix disabled user when no role

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
Co-authored-by: Jguer <joao.guerreiro@grafana.com>
2022-10-12 13:33:33 +02:00
George Robinson
67d93ceea0
Alerting: Add doc comments to classic.go (#56724) 2022-10-12 10:55:48 +01:00
Ashley Harrison
dd9e1498f9
only render direct children on the landing page routes (#56720) 2022-10-12 10:01:33 +01:00
Matt
26bb139470
Fixes 48972 - Exposes channels.WebhookMessage (#56140) 2022-10-12 09:50:28 +01:00
Junaid Ali
33eb4a2807
Exclude full OAuth token details from printing out on stdout (#55426)
* remove token details from printing out on stdout

* Update login_oauth.go

* address comment
2022-10-11 17:20:49 +02:00
Sofia Papagiannaki
7e24e19230
Swagger: Remove license (#56716) 2022-10-11 17:06:36 +03:00
Giordano Ricci
f1a0a5cb47
Glue: improves validation & fix api docs for correlations (#56682) 2022-10-11 14:04:55 +01:00
Jorge Luis Betancourt
95b9fa3346
Alerting: Fix duration calculation when testing a rule (#56616)
When testing a rule within the legacy alerting the `timeMs` field could
sometimes show negative (and/or wrongly calculated) durations. This happens if the alert evaluation crosses a second boundary. This change uses the full timestamp to compute the eval duration.
2022-10-11 20:40:18 +08:00
Armand Grillet
74a79b517d
Update Alerting changelog (#56684)
Now simpler to use.
2022-10-11 10:55:18 +00:00
sam boyer
5641029a4a
coremodels: Always take runtime arg for NewBase() (#56677) 2022-10-11 05:39:29 -04:00
sam boyer
e5a6547a94
coremodels: Update to latest Thema with generics (#56602)
* Update thema to latest

* Deal with s/Library/*Runtime/

* Commit new, working results of codegen
2022-10-11 09:45:07 +01:00
George Robinson
52965de369
Alerting: Add doc comments to state struct and normalize fields (#56647) 2022-10-11 09:30:33 +01:00
Serge Zaitsev
53baecd71f
Chore: Move folder service into a separate package (#56591)
* Chore: move folder service interface into a separate package

* copy implementation into a standalone package

* move implementation and tests to the new folder package

* remove leftovers from wire

* add test doubles for folder service

* fix tests in library panels/elements

* fix provideservice in ngalert
2022-10-10 21:47:53 +02:00
Polina Boneva
129a5a29e7
PanelChrome: New Panel Header design Feature Flag (#56450)
* add feature toggle newPanelHeader

* add feature toggle newPanelHeader

* more explicit naming and description of PanelChrome feature flag
2022-10-10 18:03:16 +03:00
Andres Martinez Gotor
65e56c9fb8
Google Cloud Monitoring: Fix bucket bound for distributions (#56565) 2022-10-10 16:08:33 +02:00
Laura Benz
bc9a37ee8d
Glue: Add configuration support to PATCH (#56117)
* feat: add config to tests v0

* feat: add config to UpdateCorrelationCommand

* refactor: repair some tests

* refactor: repair another test

* refactor: repair last test

* refactor: remove possible test

* refactor: add comments

* refactor: add changes from code review

* refactor: implement more detailed patch

* feat: add tests for partial config update

* refactor: make error handling more detailed

Co-authored-by: Giordano Ricci <me@giordanoricci.com>

Co-authored-by: Giordano Ricci <me@giordanoricci.com>
2022-10-10 15:36:14 +02:00
George Robinson
802d67eeca
Alerting: Support values in notification templates (#56457)
We have received a lot of feedback regarding the ValueString in alert notifications. Perhaps one of the most frequent complaints about ValueString is that it is difficult to read because it contains a lot of information, and the information is shown as a JSON-like string. Users have often asked how it can be templated and the answer is that it can't.

Until now users have been able to add custom annotations to their alert rules which contains values via the $values variable added in previous versions of Grafana. However, these custom annotations must be added for each of the user's alert rule, instead of once in a template that all of their alerts can be notified via.

This commit adds then the much requested feature to support values in notification templates. Users can then create a single template that prints the annotations, labels and values of their alerts in a format of their choice!
2022-10-10 13:40:21 +01:00
Joe Blubaugh
7312a2dab0
Alerting: Mark all tests that interact with the database as Integration tests. (#54875)
Previously, two tests were not explicitly marked as integration tests
and so were not run against all 3 supported databases in the CI
environment.
2022-10-10 01:54:54 -04:00
Ryan McKinley
b24be6c0fc
ObjectStore: add a kind registry (#56507) 2022-10-08 12:05:46 -04:00
Nathan Marrs
ac91df0ea2
Canvas: Add demo dashboards (#56351)
Co-authored-by: drew08t <drew08@gmail.com>
Co-authored-by: Adela Almasan <adela.almasan@grafana.com>
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2022-10-07 21:34:18 -04:00
Yuriy Tseretyan
3487e68d15
Alerting: Fix migration to create rules with group index 1 (#56511) 2022-10-07 17:20:01 -04:00
Yuriy Tseretyan
e2f1201382
Alerting: Fix migration to not add label "alertname" (#56509)
* do not add label alertname because it is overridden in state manager anyway
* update state manager to not consider labels with same value as dupe
2022-10-07 15:06:53 -04:00
Artur Wierzbicki
bf264d2f76
Query library: requiresDevMode dummy backend (#56466)
* query library - dummy backend

* fix tests

* dont explicitly marshall backend dataresponse

* skip integration tests

* null check for tests

* added query library to codeowners

* null check for tests

* lint
2022-10-07 11:31:45 -07:00
Ivana Huckova
23e04c0f9c
Elasticsearch: Add integration tests for http header handling (#56542)
* Elasticsearch: Add integration test

* Fix lint
2022-10-07 18:21:48 +02:00
Andres Martinez Gotor
76868bad04
AzureMonitor: Allow multiple resources in the API for Metrics (#56118) 2022-10-07 14:57:01 +02:00
Gabriel MABILLE
7595ed0668
FIX: Remove RBAC datasource permissions upon datasource deletion (#56530)
* FIX: Remove RBAC datasource permissions upon datasource deletion

* Use scope provider instead

* Fix test
2022-10-07 08:30:15 -04:00
Emil Tullstedt
22756913ba
Errutil: Update documentation for Go 1.19 (#55807) 2022-10-07 12:47:43 +02:00
Joey Tawadrous
74c809f544
Plugins: Introduce new Flame graph panel (#56376)
* Flamegraph

* Updated flame graph width/height values

* Fix top table rendering issue

* Add feature toggle for flamegraph in explore

* Update tests

* Hide flamegraph from dash panel viz list if feature toggle not enabled

* Show table if no flameGraphFrames

* Add flame graph to testdata ds

* Minor improvement
2022-10-07 11:39:14 +01:00
George Robinson
762688d67f
Alerting: Fix pq: missing FROM-clause for table "a" (#56453)
This commit fixes a bug where changing the Folder or Rule Group of an existing rule returns the following error in PostgreSQL "pq: missing FROM-clause for table a"
2022-10-07 10:18:49 +01:00
Joe Blubaugh
13067b39da
Alerting: Update replacement of prometheus-alertmanager (#56519)
grafana.com/grafana/prometheus-alertmanager has been updated to a
version that fixes some bugs upstream. This change just updates that
dependency and a few shared ones.
2022-10-07 17:10:20 +08:00
Dimitris Sotirakis
df2abf09c2
Use io.ReadAll instead of json.Decode (#56528) 2022-10-07 04:27:18 -04:00
Ivana Huckova
eef3f28447
Loki: Add integration tests for http header handling (#56478)
* Loki: Add integration tests for http header handling

* Fix linting
2022-10-07 10:16:41 +02:00
Emil Tullstedt
bb479e030a
RBAC: Redirect to /login when forceLogin is set (#56469) 2022-10-07 08:18:56 +02:00
Jeff Levin
331110bde5
refactor public dashboards middleware testing (#55706)
This PR refactors how we add the orgId to the context on a public dashboard paths. We also split out accessToken handling into its own package and rework status code for "RequiresValidAccessToken". We will be modeling all endpoints to use these status codes going forward. Additionally, it includes a scaffold for better middleware testing and refactors existing tests to table drive tests.
2022-10-06 12:35:19 -08:00
Ryan McKinley
609abf00d1
ObjectStore: Write json as json when possible (#56433) 2022-10-06 15:48:53 -04:00
Yuriy Tseretyan
7b6437402a
Alerting: Refactor state manager's cache (#56197)
* remove ResetAllStates because it's not used
* refactor cache to accept logs, metrics and url as method args
* update manager Warm method to set the entire state at once
* remove unused reset method
* introduce ruleStates
* change getOrCreate to belong to ruleStates
* update Get to not return error
2022-10-06 15:30:12 -04:00
Misi
1de0f4453e
Chore: Make NewCookieOptions exported in cookies.go (#56476) 2022-10-06 20:00:54 +02:00