Commit Graph

13318 Commits

Author SHA1 Message Date
Alex Khomenko
f3953b4955
Notification Banner: Add feature toggle (#87686) 2024-05-13 12:32:34 +03:00
Karl Persson
7125a2e455
Anon: Add support to resolve anonymous identity (#87486) 2024-05-13 11:06:14 +02:00
Bruno
14ccf7f6d1
Cloud migrations: return errutil.Error in http responses (#87448) 2024-05-13 00:22:46 -04:00
Bruno
6a3ab71d77
cms: clean up model file (#87179)
* move CreateAccessTokenResponseDTO to api.go

* remove unused types

* run make swagger-clean && make openapi3-gen
2024-05-13 00:22:19 -04:00
Karl Persson
0f3080ecb8
AuthN: Fix signout redirect url (#87631)
* Add missing return

* Use sign out redirect url from auth config if configured

* remove option from auth.jwt that is not used
2024-05-12 19:53:19 +02:00
Michael Mandrus
ef51a64b57
Feature Toggles: Hide featureToggleAdminPage toggle from docs and note that it is cloud only. (#87660)
update featureToggleAdminPage feature toggle to be hidden from docs and specify cloud only
2024-05-10 21:34:53 +03:00
Ryan McKinley
f880abc292
QueryService: Move raw http.Handler to rest.Connector (#87595)
* query connector

* improve error wrappers

* return 400 for missing datasource (not 404)

* fix errors

* message
2024-05-10 21:01:17 +03:00
Andreas Christou
49e6bf26b3
AzureMonitor: Refactor Log Analytics backend (#87429)
* Remove unneeded error check

* Refactor to reduce cyclomatic complexity

* Add util function for parsing resultformat

* Make use of util

* Remove unneeded types

* Move types to their own file

* Move getApiUrl to utils

* Move traces functions to separate file

- Add separate helper for building trace string queries

* Add helper for determining resources

* Add test for RetrieveResources

* Don't append twice

* Refactor tests
2024-05-10 17:11:54 +01:00
linoman
926ee0f62e
SAML: add referemce to azure ad limitations (#87571)
* update the url for Azure AD limitations

* add warnings of using Azure AD with SAML
2024-05-10 15:12:31 +02:00
linoman
cd98aaf89b
Chore: Add login protection when user is trying different uppercase letters (#87588)
* add login protection when the user is trying different uppercase letters
2024-05-10 13:49:59 +02:00
Ieva
167151b211
Chore: Remove use of deprecated method in AC code (#87541)
* switch from using cfg to using featuremgmt for checking a feature toggle in AC code

* merge test fixes
2024-05-10 11:56:52 +01:00
Alexander Zobnin
0302b75721
Access control: Use search options for computing permissions cache key (#87589) 2024-05-10 12:06:52 +03:00
Misi
896882b004
Chore: Implement GetOAuthProviders in FakeSocialService (#87590)
Implement GetOAuthProviders in FakeSocialService
2024-05-10 11:48:05 +03:00
Alexander Weaver
a6a9ab4008
Alerting: Do not store series values from past evaluations in state manager for no reason (#87525)
Do not store previous execution results on states
2024-05-09 15:51:55 -05:00
lean.dev
b009536329
Caching: Implement mtls-enabled memcached integration (#84171)
* fix merge

* fix conflicts

* updating generated feature toggle code

* Fix go mod owner

* fix merge

* add dependency

* fix dependencies

* workspace sync

* go get

* work sync

* trying something

* fix

* add docs for tls config

* work sync

* adjust go mod

* try something

* move import to the correct file

---------

Co-authored-by: Michael Mandrus <michael.mandrus@grafana.com>
2024-05-09 15:12:08 -04:00
Yuri Tseretyan
356a29592b
Alerting: Add two sets of provisioning actions for rules and notifications (#87149) 2024-05-09 13:19:07 -04:00
Alexander Weaver
36ef611cf4
Alerting: Add database migration for recording rule fields (#87012)
* Create recording rule fields in model

* Add migration

* Write to database, support in version table

* extend fingerprint

* Force fields to be empty on validate

* Another storage spot, tests for fingerprint

* Explicitly set defaults in provisioning API

* Tests for main API validation

* Add diff tests even though fields are unpopulated for now

* Use struct tag approach instead of FromDB/ToDB hooks as it better handles nulls when deserializing

* test for deser

* Backout RecordTo for now since it's not decided in the doc

* back out of migration too

* Drop datasourceref for now

* address linter complaints

* Try a single outer struct with all fields embedded
2024-05-09 12:12:44 -05:00
Kyle Brandt
baed7d6dbe
Scopes: Fix logic in find call (#87565)
With Find, if the parent query parameter is empty or not provided, we want to list the top level of the forest.
2024-05-09 11:52:56 -04:00
Todd Treece
fa2f6578b3
Chore: Add info about K8s folder structure to README (#87508)
---------

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2024-05-09 16:43:07 +03:00
Stephanie Hingtgen
1bc6738d92
Chore: Upgrade go from 1.21.0 to 1.21.10 (#87479) 2024-05-09 15:57:08 +03:00
Ieva
105313f5c2
RBAC: Adding action set resolver for RBAC evaluation (#86801)
* add action set resolver

* rename variables

* some fixes and some tests

* more tests

* more tests, and put action set storing behind a feature toggle

* undo change from cfg to feature mgmt - will cover it in a separate PR due to the amount of test changes

* fix dependency cycle, update some tests

* add one more test

* fix for feature toggle check not being set on test configs

* linting fixes

* check that action set name can be split nicely

* clean up tests by turning GetActionSetNames into a function

* undo accidental change

* test fix

* more test fixes
2024-05-09 10:18:03 +01:00
Diego Augusto Molina
acf17c7fb1
Unified Storage: Add SQL template package (#87524)
* added sqltemplate package

* addded example

* fix linting issues

* improve code readability

* fix documentation
2024-05-08 17:58:18 -03:00
Todd Treece
80f10e2a09
GRPC Server: Add README (#87442) 2024-05-08 15:29:43 -04:00
Todd Treece
6e4d35e1ee
Scopes: Add a /find query endpoint (#87457)
---------

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2024-05-08 13:35:11 -04:00
Todd Treece
de438eae2e
K8s: Prevent the use of arbitrary namespaces (#83636) 2024-05-08 09:30:08 -07:00
Todd Treece
f342217158
K8s: Add path rewriter filter (#87456) 2024-05-08 18:08:43 +03:00
Alexander Zobnin
d1c582815a
Access control: Fix searching permissions from cache (#87489)
* Fix searching permissions from cache

* Write permissions to cache
2024-05-08 16:08:21 +02:00
Marcus Efraimsson
41b29ff93c
Chore: Migrate to use buf for protobuf generation (#87407)
* Chore: Migrate to use buf for protobuf generation

* fix codeowners

* fixes after review

* docs/tooling for installing buf

* add back codeowners

* Update upgrading-dependencies.md

Co-authored-by: Giuseppe Guerra <giuseppe.guerra@grafana.com>

* sdk v0.229.0

---------

Co-authored-by: Giuseppe Guerra <giuseppe.guerra@grafana.com>
2024-05-08 15:42:40 +02:00
Ieva
9a824bdf0a
RBAC: Don't set empty action sets (#87398)
* don't set empty action sets

* extend comment
2024-05-08 15:09:46 +03:00
Karl Persson
be5ced4287
Identity: Use typed version of namespace id (#87257)
* Remove different constructors and only use NewNamespaceID

* AdminUser: check typed namespace id

* Identity: Add convinient function to parse valid user id when type is either user or service account

* Annotations: Use typed namespace id instead
2024-05-08 14:03:53 +02:00
Dan Cech
1884b03511
Provisioning: Look up provisioned folders by UID when possible (#87465)
look up provisioned folders by uid when possible
2024-05-07 15:38:53 -04:00
Charandas
a9da6ce1d5
ext_jwt: streamline expected aud in access tokens and id tokens (#87401) 2024-05-07 11:20:16 -07:00
Alexander Weaver
6c47968f6c
Alerting: Do not retry rule evaluations with "input data must be a wide series but got type long" style errors (#87343)
add typed error for series must be wide, do not retry
2024-05-07 11:31:07 -05:00
Nihal
5fb87de321
Auth: Added support to filter for parent teams in GitHub connector's team membership filter (#86754)
* added changes for parent teams in team_ids. see https://github.com/grafana/grafana/issues/85916

Signed-off-by: Syed Nihal <syed.nihal@nokia.com>

* added unit test

Signed-off-by: Syed Nihal <syed.nihal@nokia.com>

* addressed review comments to consider case where parent object can be null

Signed-off-by: Syed Nihal <syed.nihal@nokia.com>

* addressed review comment

Signed-off-by: Syed Nihal <syed.nihal@nokia.com>

---------

Signed-off-by: Syed Nihal <syed.nihal@nokia.com>
2024-05-07 18:19:20 +02:00
Karl Persson
2d8570e85e
IDToken: Reuse claims from authlib (#87437)
* bump authlib version

* Reuse claims from authlib
2024-05-07 16:46:43 +02:00
Eric Leijonmarck
6b218b11cf
Actionsets: fix remove printf (#87439)
fix: remove printf
2024-05-07 16:36:01 +03:00
Alexander Zobnin
82dea4b3e5
Access control: Cache basic roles and teams permissions (#87043)
* RBAC: Cache basic roles permissions

* Cache teams permissions

* Set cache TTL to 1 minute

* Add OSS implementation

* Fetch basic role permissions correctly

* fix conflict_user_command

* Fix teams permissions query

* Add traces for GetUserPermissions

* Fix folders tests

* Fix colflict user command

* Update store mock

* Fix linter error

* Reuse GetUserPermissions for fetching basic roles

* tests for GetTeamsPermissions

* pre-allocate slice capacity

* Fix linter
2024-05-07 15:23:11 +02:00
Leonor Oliveira
ee2f6a7b49
Force interface implementation also on legacy storage (#87414)
* Force interface implementation also on legacy storage

* Add DeleteCollection to folders and dashboards

* Fix integration tests

* Fix tests
2024-05-07 15:02:30 +02:00
Karl Persson
37af1ae58e
IDToken: Set typ header (#87430)
TokenSigning: Set typ header
2024-05-07 13:59:23 +02:00
Gábor Farkas
4f7ed97aad
mysql: fix dispose-method not called in external-mode (#87330) 2024-05-07 09:54:30 +02:00
Leonor Oliveira
0a2c5065a0
Choose mode. Turn DualWriter into a real interface. Better Logging (#87291)
* Choose mode. Add log field on top level dualwriter

* Add logs

* Turn DualWriter into a full interface. Fix tests

* Lint

* Use struct for dualWriter interface

* Use struct

* Default should be legacyStore for all entities

* Fix test. Get rid of extra concrete type

* Remove comment

* Add comment

* Temp set dualwriter mode 2 for playlists while configs are not in place

* Add modes type + add comment on what each mode does

* Don't require watcher interface for now

* Use storage implementation on mode 2

* Update pkg/apiserver/rest/dualwriter_mode2.go

Co-authored-by: Todd Treece <360020+toddtreece@users.noreply.github.com>

* Pass log values to the context

* test

* Update pkg/apiserver/rest/dualwriter_mode3.go

Co-authored-by: Dan Cech <dcech@grafana.com>

---------

Co-authored-by: Todd Treece <360020+toddtreece@users.noreply.github.com>
Co-authored-by: Dan Cech <dcech@grafana.com>
2024-05-06 23:18:28 +02:00
Aaron Godin
0bc8992dfa
Revert #86466 (#87405)
Revert "Apply plugin route ReqAction to ds_proxy authorization (#86466)"

This reverts commit 53f94ac50d.
2024-05-06 14:40:32 -05:00
Dan Cech
41bee274fd
Chore: Fix error handling in postDashboard, remove UserDisplayDTO, fix live redis client initialization (#87206)
* clean up error handling in postDashboard and remove UserDisplayDTO

* replace GetUserUID with GetUID and GetNamespacedUID, enforce namespace constant type

* lint fix

* lint fix

* more lint fixes
2024-05-06 14:17:34 -04:00
jackyin
ba8b4bde3a
fix ipv6 startup fail #81870 (#87108)
* fix ipv6 startup fail #81870

* ipv6 startup fail

* ipv6 startup fail
2024-05-06 14:17:03 -04:00
Eric Leijonmarck
601485c74d
Actionsets: Fix downgrade of permission to add the actionset permission (#87328)
* check for missingActions empty and add actionset

* spelling
2024-05-06 10:16:26 +01:00
Misi
9236c5a5cf
Auth: Add OrgRoleMapper service (#86973)
* Add OrgRoleMapper

* Address feedback, add more tests

* Prevent resetting assignments when global org mapping fails

* Provide a parsing function instead of recalculating the org_mapping on every mapping

* Introduce strict role parsing/mapping

* Introduce MappingConfiguration

* Handle other edge case

* Add tests

* lint

* Apply documentation update suggestions

* Apply GetDefaultOrgMapping suggestions from code review

* Apply suggestions for cleaning up unnecessary err in ParseOrgMappingSettings

* Apply suggestions from code review

* Address feedback suggestions

* Cleanup

* Reduce cognitive complexity of ParseOrgMappingSettings

---------

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
2024-05-06 09:25:47 +02:00
Ryan McKinley
333ed377d6
Prometheus: Avoid parsing unused legacy datasource property (#87224)
* query cleanup

* parse query

* more comments
2024-05-05 15:00:53 +03:00
Jon Cole
8e96821c16
Azure: get custom cloud list from grafana-azure-sdk-go package (#86717)
* Get custom cloud list from grafana-azure-sdk-go for frontend settings

* Remove getAzureClouds() and call CustomClouds() directly

* remove unused type
2024-05-04 13:17:51 +03:00
Charandas
0c59baf62d
ext_jwt: switch to new authlib (#87157) 2024-05-03 12:59:37 -07:00
Matthew Jacobson
babfa2beac
Alerting: Hook up GMA silence APIs to new authentication handler (#86625)
This PR connects the new RBAC authentication service to existing alertmanager API silence endpoints.
2024-05-03 15:32:30 -04:00
Gilles De Mey
5e25afe6e9
Alerting: New settings page (#84501) 2024-05-03 17:42:42 +02:00
Juan Cabanas
d1434fad3a
ShareModal: Share link redesign under newDashboardSharingComponent FF (#87011) 2024-05-03 12:02:18 -03:00
Prem Saraswat
196134b0b4
Storage Server: Avoid incorrect parsing of connection string (#85293)
Storage Server: avoid incorrect parsing of connection string

In storage server, a connection string is generated to connect to the
backing database. In case of Postgres, we were generating the string
like `"user=grafana pass= host=postgres.example port=4567"`.

This triggered an edge case in `pq` (the go postgres driver) to parse
`pass` to be equal to `host=postgres.example`, and host being reset to
default value.

Using single quotes in the connection string fixed this.

Signed-off-by: Prem Kumar <prem.saraswat@grafana.com>
2024-05-03 10:54:39 -04:00
Andreas Christou
28df41fd96
MSSQL: Add HostName method (#87309)
* Add HostName method

* Add test

* Fix lint
2024-05-03 15:45:34 +01:00
Scott Lepper
1a2bbd61fd
sql expressions: improve parser (#87277)
sql expressions: improve parser
2024-05-03 08:08:07 -04:00
Santiago
b76a9e4d31
Alerting: Implement GetStatus in the remote Alertmanager struct (#84887)
* Alerting: Implement GetStatus in the remote Alertmanager struct

* update tests

* fix tests, extract AlertmanagerConfig from PostableConfig

* get the remote AM config instead of the Grafana one from the remote AM

* pass grafana AM config in test

* return error in GetStatus instead of logging it (internal AM)
2024-05-03 13:59:02 +02:00
Andres Martinez Gotor
b6f899d953
Migrate wrong datasource UIDs (#86598) 2024-05-03 13:32:07 +02:00
ismail simsek
3317691615
InfluxDB: Support cardinality queries with backend mode (#87264)
support cardinality queries
2024-05-03 12:50:00 +02:00
Georges Chaudy
dd0e646e92
k8s: remove dependency on app_mode development (#85474)
* k8s: remove dependency on app_mode development

* remove dev conditions on storage server

* remove logic to drop entity tables
2024-05-03 11:28:15 +03:00
Carl Bergquist
7a6bef8f9c
Scopes: Adds kinds for browsing the scope node tree. (#86975)
Signed-off-by: bergquist <carl.bergquist@gmail.com>
2024-05-03 09:48:54 +02:00
Karl Persson
a22350f8f4
IDToken: add namespace (#87242) 2024-05-02 18:55:28 -07:00
Scott Lepper
cbe3e3a5e0
fix: sql expressions parser with join (#87263) 2024-05-02 14:48:05 -04:00
Galen Kistler
840aeddbd1
Logs: Explore panel default visualization feature flag (#87189)
* add logsExploreTableDefaultVisualization feature flag

* use feature flag in calculating initial visualization type

* add feature flag to tracking
2024-05-02 10:28:15 -05:00
Ryan McKinley
b7df129b78
FeatureToggles: Write enabled flags to the logs on startup (#87225) 2024-05-02 18:19:34 +03:00
Arati R
4db5ec28a1
Storage: Enable mode 2 dual writing for playlists (#87245)
Enable mode 2 dual writing for playlists
2024-05-02 16:52:29 +02:00
Fayzal Ghantiwala
df25e9197e
Alerting: Get grafana-managed alert rule by UID (#86845)
* Add auth checks and test

* Check user is authorized to view rule and add tests

* Change naming

* Update Swagger params

* Update auth test and swagger gen

* Update swagger gen

* Change response to GettableExtendedRuleNode

* openapi3-gen

* Update tests with refactors models pkg
2024-05-02 15:24:59 +01:00
Arati R
9e6de035c0
Storage: Add mode 2 dual writing improvements (#87204)
* Fix mode 2 List test
* Set origin timestamp during conversion to k8s resource
* Add instructions for updating a playlist
* Handle partial deletions of a collection in mode 2
2024-05-02 16:06:51 +02:00
Gabriel MABILLE
8802282ebc
RBAC: fix panic role not found permission sync (#87217) 2024-05-02 15:19:56 +02:00
Kevin Yu
6851ad9f8c
CloudWatch: Fix apostrophes in dimension values not being escaped (#87182) 2024-05-02 06:15:11 -07:00
Mihai Doarna
a979417700
SSO: Update ssoSettingsApi flag to general availability (#87216)
* update ssoSettingsApi flag to general availability

* generate files
2024-05-02 16:00:52 +03:00
Karl Persson
d8fbbdefea
Identity: Use typed namespace id (#87121)
* Use typed namespace id
2024-05-02 14:50:56 +02:00
Scott Lepper
4fd2cb6014
fix: sql expressions - sql parser table name case (#87196)
* fix: sql parser table name case
2024-05-02 08:43:20 -04:00
Serge Zaitsev
ad5613d7d4
Chore: Remove cfg from folder service (#87212)
remove cfg from folder service
2024-05-02 13:18:54 +02:00
Ieva
28dd1ddd8e
RBAC: Do not set permissions on data sources with wildcard UID in OSS (#87220)
do not set permissions on DS with wildcard UID
2024-05-02 13:18:29 +03:00
Serge Zaitsev
6ddb8aeae3
Chore: Moving to slog (folders) (#87000)
* moving folders to slog

* trying to fix the tests

* fix per-logger filters in slog

* allow using slog.Default()

* bring cfg back to keep the pr small

* fix tests

* back to the roots
2024-05-02 09:14:12 +02:00
owensmallwood
efff4c0bbd
Unified Storage: Redacts logged env var values for entity api db password (#87191)
redacts logged env var values for entity api db password
2024-05-01 12:15:44 -06:00
owensmallwood
40558899e4
Unified Storage: Adds health check service for entity server (#86471) 2024-05-01 11:36:44 -06:00
Ieva
a9ac648cf6
Chore: Improve some confusing logs (#87185)
improve some confusing logs
2024-05-01 19:42:05 +03:00
lean.dev
0719f73f35
Cloud Migration: Remove ID migration in favor of UID (#86550)
* - Added migration to add a new collumn UID to both migration and migration_run tables.
- Added migration to set UID for records already existent in the database before adding a new column.
- Added UID field to CloudMigration and CloudMigrationRun dtos (model.go)

* Fix db migration

* Updating store and model

* Updating API to use UID

* fix typo

* update openapi specs and generated endpoints

* fix spec

* update openapi specs and generated endpoints

* Fixing db mapping

* Fix frontend

* fix migration

* remove migration uid from run fetch endpoint

* Revert "merge"

This reverts commit d654e4c530, reversing
changes made to 5fe0b483eb.

* manual merge

* rename some funcs for consistency

* make interfaces consistent

* validate uids

* update generated frontend api

* fix enterprise spec

* manually resolve api

* try again

* try yet again

* once more

---------

Co-authored-by: Josh Hunt <joshhunt@users.noreply.github.com>
Co-authored-by: Michael Mandrus <michael.mandrus@grafana.com>
Co-authored-by: joshhunt <josh@trtr.co>
2024-05-01 12:29:25 -04:00
Arati R
61f3d08c3f
Storage: Add List support for pagination (#87093)
* Add origin keys to List request
* Check origin keys requirement in the sql entity server's List method
* Refactor mode 2 List
* Check origin keys before making Storage List call

---------

Co-authored-by: Dan Cech <dcech@grafana.com>
2024-05-01 08:42:47 +02:00
bornohin6
7ce1254913
CloudMigration: Remove details from the migration run list (#87104)
Remove details from the migration run list
2024-04-30 11:44:35 -07:00
Kevin Yu
a54df47976
CloudWatch: Add labels for Metric Query type queries (#85766)
* CloudWatch: Fix metric query with group by not being labelled in alerts

* just use one key for the labels

* not needed

* unused function

* add tests

* pr comments

* fetch dimensions to build labels for MetricQuery type queries

* pr comments

* group cache related tests and use fresh cache for non-cache related tests

* don't cache empty values
2024-04-30 09:06:16 -07:00
William Wernert
93519f70ca
Alerting: Also fix HCL field name for MuteTimeIntervals (#87079)
* Correct HCL field name for MuteTimeIntervals

* Update test
2024-04-30 16:14:01 +01:00
Ieva
5e060d2d99
Data source: Maintain the default data source permissions when switching from unlicensed to licensed Grafana (#87119)
set managed data source permissions upon resource creation for unlicensed Grafana, remove them on deletion
2024-04-30 16:05:30 +01:00
Aaron Godin
53f94ac50d
Apply plugin route ReqAction to ds_proxy authorization (#86466)
* Apply plugin route ReqAction to ds_proxy authorization

Co-authored-by: Eric Leijonmarck <eleijonmarck@users.noreply.github.com>

* fix: move ds_proxy route Evaluator out of plugins pkg

* move DataSourceProxy route authorization to method

---------

Co-authored-by: Eric Leijonmarck <eleijonmarck@users.noreply.github.com>
2024-04-30 09:19:34 -05:00
Steve Simpson
5c89b8fe12
gRPC Server: Make message size limits configurable. (#86982)
* gRPC Server: Make message size limits configurable.

* Fix mistake, don't add opts twice

* Apply suggestions from code review

Co-authored-by: Todd Treece <360020+toddtreece@users.noreply.github.com>

---------

Co-authored-by: Todd Treece <360020+toddtreece@users.noreply.github.com>
2024-04-30 16:18:03 +02:00
Gábor Farkas
3d80693456
postgres: simpler test (#86331) 2024-04-30 15:27:20 +02:00
Marcus Efraimsson
2fc99375df
Chore: Upgrade otel dependencies (#86994)
* Chore: Upgrade otel dependencies

* sdk changes

* ignore deprecated go.opentelemetry.io/otel/exporters/jaeger for now

* use latest commit from sdk branch

* sdk v0.228.0
2024-04-30 15:12:45 +02:00
Mihai Doarna
76d94b35c9
SSO: fix settings merge for SAML fields (#86970)
* fix sso settings merge for saml fields

* change func name
2024-04-30 15:10:27 +03:00
Andreas Christou
125ac18fa3
AzureMonitor: Enable session ID header for Log Analytics (#86320)
* Enable option

- Update sdk

* Sync go.work
2024-04-30 13:10:04 +01:00
Karl Persson
a2cba3d0b5
User: Add tracing (#87028)
* Inject tracer in tests

* Annotate with traces

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
2024-04-30 13:15:56 +02:00
Arati R
ec6f59a678
Chore: Update protoc-gen-go (#87116)
Update protoc-gen-go
2024-04-30 12:14:33 +02:00
Misi
1cb3f332a1
Chore: Remove extra sql select from the Insert function of userimpl.store (#87060)
Remove getAnyUserType
2024-04-30 08:54:20 +02:00
Yuri Tseretyan
052082a927
Alerting: Refactor Alert Rule Generators (#86813) 2024-04-29 21:52:15 -04:00
William Wernert
70ff229bed
Alerting: Use expected field name for receiver in HCL export (#87065)
* Use expected field name for receiver in hcl

Terraform provider expects `contact_point` instead of `receiver` in
notification settings on a rule.
2024-04-29 18:13:29 +01:00
Isabella Siu
7b392d40a0
Auth: Sign sigV4 request after adding headers (#87063) 2024-04-29 13:07:45 -04:00
Santiago
36a0499128
Alerting: Implement CreateSilence in the forked Alertmanager (remote primary mode) (#85716) 2024-04-29 18:47:25 +02:00
Santiago
1af2e69625
Alerting: Implement DeleteSilence in the forked AM (remote primary) (#85721) 2024-04-29 17:23:41 +02:00
Eric Leijonmarck
8a1f43a65d
User: Remove the lowercasing in the query for login conflict (#87032)
* refactor: remove the lowercasing in the query for login conflict

* refactor: move function into the closure gs
2024-04-29 12:24:14 +01:00
Ieva
cee713e34c
Chore: Add tracing to team service (#86999)
* add tracing to team service

* another test fix

* pass in context for team creation and membership checking
2024-04-29 11:32:03 +01:00
Steve Simpson
fbaa847a3c
Alerting: Pass logger into NewRemoteLokiBackend. (#87029)
Tiny refactor to allow a logger to be passed into NewRemoteLokiBackend.
2024-04-29 12:10:23 +02:00
Karl Persson
c4cfee8d96
User: support setting org and help flags though update function (#86535)
* User: Support setting active org through update function

* User: add support to update help flags through update function
2024-04-29 08:53:05 +02:00
Hugo Kiyodi Oshiro
7783b16e47
Plugins: Make grafana-com API URL usage consistent (#86920)
Plugins: Fix grafana-com API URL usage
2024-04-26 16:47:38 +02:00
Mihai Doarna
45effc48d9
Auth: ignore non-OAuth2 providers when creating social connectors (#86989)
ignore non-oauth2 providers when creating social connectors
2024-04-26 17:14:31 +03:00
Yuri Tseretyan
dff7cb9afb
Alerting: Move alertmanager api silence code to separate files (#86947)
* Move alertmanager api silence code to separate files unchanged

* Replace with silence model instead interface

---------

Co-authored-by: Matt Jacobson <matthew.jacobson@grafana.com>
2024-04-25 15:20:37 -04:00
Marcus Efraimsson
fbcb9a3677
Chore: Upgrade/fix deps after thema removal (#86763)
* Chore: Upgrade/fix deps after thema removal

* github.com/deepmap/oapi-codegen v1.14.0

* github.com/deepmap/oapi-codegen v1.15.0

* github.com/deepmap/oapi-codegen v1.16.0

* fix for dep used in enterprise

* github.com/deepmap/oapi-codegen/v2 v2.0.0

* oapi-codegen/v2 v2.1.0, kin-openapi v0.122.0, sdk

* keep kin-openapi at v0.122.0 and allow SDK to use v0.124.0

* remove github.com/deepmap/oapi-codegen v1 dep

* fix owner

* add back github.com/deepmap/oapi-codegen v1 dep

* upgrade github.com/influxdata/influxdb-client-go/v2 to get rid of deepmap/oapi-codegen

* migrate to oapi-codegen/runtime

* sdk

* sdk v0.227.0
2024-04-25 20:52:09 +02:00
Matthew Jacobson
3397e8bf09
Alerting: Improve error when receiver or time interval used by rule is deleted (#86865)
* Alerting: Improve error when receiver used by rule is deleted

* Remove RuleUID from public error and data

* Improve fallback error in am config post

* Refactor to expand to time intervals

* Fix message on unchecked errors to be same as before
2024-04-25 13:36:00 -04:00
Eric Leijonmarck
e394e16073
Auth: Force lowercase login/email for users (#86359)
* [WIP]: Force lowercase login/email for user CRUD

* warn and remove use of userCaseInsensitiveLogin check

* remove log warning

* reimplementation of the caseinsensitive

* need to decide if we want the conflict check or not

* remvoved the tests for conflict user by getEmail, getLogin

* added tests for user lowercase migration

* wip: emails next

* tests for email lowercasing

* review comments

* optimized login and email lookup before migrating
2024-04-25 17:31:17 +01:00
Ieva
748b3c855c
Chore: Clean up team membership code (#86914)
remove unused code, clean up commands
2024-04-25 16:46:24 +01:00
Mihai Doarna
4bf9405ce4
SSO: add SSO settings to secrets migrator (#86913)
* add sso settings to secrets migrator

* unify SSO settings in all log lines
2024-04-25 18:30:23 +03:00
Marcus Efraimsson
ac152ca416
Chore: Upgrade grpc-ecosystem/go-grpc-middleware to v2 (#86724)
* Chore: Replace deprecated prometheus grpc middleware

* go mod tidy without enterprise

* with updated sdk branch

* sdk v0.226.0

* remove deprecated opentracing support for outgoing plugin requests

* migrate to github.com/grpc-ecosystem/go-grpc-middleware/v2

* fix
2024-04-25 17:25:48 +02:00
Mihai Doarna
28e86c3edb
Mention the migrator in the secrets service readme (#86922)
mention the migrator in the secrets service readme
2024-04-25 17:44:55 +03:00
Karl Persson
cd724d74aa
Authn: move namespace id type (#86853)
* Use RoleType from org package

* Move to identity package and re-export from authn

* Replace usage of top level functions for identity

Co-authored-by: Misi <mgyongyosi@users.noreply.github.com>
2024-04-25 12:54:36 +02:00
Timur Olzhabayev
ed89354eaa
Chore: Adding debug logging to signature checks (#86915)
Adding debug logging to signature checks
2024-04-25 11:53:10 +01:00
George Robinson
c049e5bbfc
Alerting: Update grafana/alerting to bb4f4f4 (#86827) 2024-04-25 10:47:01 +01:00
Erik Sundell
a3ef463499
Grafana packages: Remove E2E workspace (#86416)
* remove e2e package code and any code referencing it

* update code owners

* remove more references to e2e package

* remove unrelated file
2024-04-25 07:12:43 +02:00
Ieva
8028d1c3e1
Chore: Update tests to use team membership hooks (#86846)
* update tests to use team membership hooks

* linting
2024-04-24 16:55:42 +01:00
Sofia Papagiannaki
a5a3ee9fa3
SQLStore: Disable redundant create and drop unique index migrations on dashboard table (#86857)
SQLStore: Disable create and drop unique index migrations
2024-04-24 15:25:43 +01:00
Alexander Zobnin
60ed6bfc33
Search: Fix slow query when user does not have roles assigned (#86791)
* Search: Fix slow query when user does not have roles assigned

* Check all required actions and skip if not found
2024-04-24 13:23:08 +03:00
Charandas
d46b163810
Authn (jwt_auth): add tracing spans for validating newer use cases (#86812) 2024-04-24 02:40:00 -07:00
Serge Zaitsev
522a98c126
Chore: Make Cfg field private in SQLStore (#85593)
* make cfg private in sqlstore

* fix db init in tests

* fix case

* fix folder test init

* fix imports

* make another Cfg private

* remove another Cfg

* remove unused variable

* use store cfg, it has side-effects

* fix mutated cfg in tests
2024-04-24 10:38:40 +02:00
Piotr Jamróz
f6e472f879
Explore: Show a drawer with tabs for the library and query history (#86279)
* Create basic feature toggle

* Rename context to reflect it contains query history and query library

* Update icons and variants

* Rename hooks

* Update tests

* Fix mock

* Add tracking

* Turn button into a toggle

* Make dropdown active as well

This is required to have better UI and an indication of selected state in split view

* Update Query Library icon

This is to make it consistent with the toolbar button

* Hide query history button when query library is available

This is to avoid confusing UX with 2 button triggering the drawer but with slightly different behavior

* Make the drawer bigger for query library

To avoid confusion for current users and test it internally a bit more it's behind a feature toggle. Bigger drawer may obstruct the view and add more friction in the UX.

* Fix tests

The test was failing because queryLibraryAvailable was set to true for tests. This change makes it more explicit what use case is being tested

* Remove active state underline from the dropdown

* Allow closing Query Library drawer from the toolbar

* Simplify dropdown design
2024-04-24 10:32:11 +02:00
Karl Persson
0fa983ad8e
AuthN: Use typed namespace id inside authn package (#86048)
* authn: Use typed namespace id inside package
2024-04-24 09:57:34 +02:00
dependabot[bot]
2c5b684b85
Chore(deps): Bump google.golang.org/api from 0.162.0 to 0.176.0 (#86794)
* Chore(deps): Bump google.golang.org/api from 0.162.0 to 0.176.0

Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.162.0 to 0.176.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.162.0...v0.176.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* but does it work across all workspaces

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kristin Laemmert <mildwonkey@users.noreply.github.com>
2024-04-23 12:32:16 -04:00
dependabot[bot]
18a4c56539
Chore(deps): Bump go.opentelemetry.io/collector/pdata from 1.0.1 to 1.5.0 (#86091)
* Chore(deps): Bump go.opentelemetry.io/collector/pdata

Bumps [go.opentelemetry.io/collector/pdata](https://github.com/open-telemetry/opentelemetry-collector) from 1.0.1 to 1.5.0.
- [Release notes](https://github.com/open-telemetry/opentelemetry-collector/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-collector/blob/main/CHANGELOG-API.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-collector/compare/pdata/v1.0.1...pdata/v1.5.0)

---
updated-dependencies:
- dependency-name: go.opentelemetry.io/collector/pdata
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* go work sync

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kristin Laemmert <mildwonkey@users.noreply.github.com>
2024-04-23 11:58:17 -04:00
Kristin Laemmert
9553923eb7
Chore: Fix failing ssosettingimpl test (#86792)
Chore: Fix failing ssosetting test
2024-04-23 11:36:34 -04:00
George Robinson
2049f766c6
Remove fmt.Println of client certificate (#86773) 2024-04-23 15:15:52 +01:00
Laura Fernández
2fb38a34ac
Navigation: Add a return to previous button when navigating to different sections (#86764) 2024-04-23 15:56:04 +02:00
Mihai Doarna
bf15329492
SSO: run the validation on upsert with all secrets in settings (#86579)
* run the validation on upsert with all secrets in settings

* rename social to reloadable
2024-04-23 16:50:16 +03:00
Santiago
a6be12c037
Alerting: Implement SaveAndApplyConfig in the forked Alertmanager (remote primary) (#84659)
* Alerting: Implement SaveAndApplyConfiguration in the forked Alertmanager struct

* call SaveAndApplyConfig on the remote first, log errors for the internal

* add comments explaining why we ignore errors in the internal AM

* restore go.work.sum
2024-04-23 15:45:35 +02:00
Steve Simpson
a6ad2380bf
Alerting: Refactor api_prometheus.go request handlers. (#86639)
This splits the request handlers into two functions, one which is the actual
handler and one which is independent from the Grafana `ReqContext` object. This
is to make it easier to reuse the implementation in other code.

Part of the refactoring changes the functions which get query parameters from
the request to operate on a `url.Values` instead of the request object.

The change also makes the code consistently use `req.Form` instead of a
combination of `req.URL.Query()` and `req.Form`, though I have left
`api_ruler` as-is to avoid this PR growing too large.
2024-04-23 14:50:26 +02:00
Santiago
c77ab53819
Alerting: implement SaveAndApplyConfig in the remote Alertmanager struct (#84642)
* implement SaveAndApplyConfig in the remote Alertmanager struct

* remove ID from CreateGrafanaAlertmanagerConfig call

* decrypt, test that we decrypt, refactor

* fix duplicated declaration in test

* rephrase comment, remove unnecessary conversion to slice of bytes

* fix test
2024-04-23 14:37:10 +02:00
Santiago
8b7c2a459b
Alerting: Implement SaveAndApplyDefaultConfig in the forked Alertmanager (remote primary mode) (#85668)
* Alerting: Implement SaveAndApplyDefaultConfig in the forked Alertmanager (remote primary)

* log the error for the internal AM instead of returning it
2024-04-23 14:36:40 +02:00
Mihai Doarna
4d9e35ba57
SSO: add configurableProviders list to SSO service (#86622)
* add configurableProviders list to sso service

* address feedback
2024-04-23 10:00:43 +03:00
Fabrizio
0b2e748bd8
Loki: Fix setting of tenant ID (#86433) 2024-04-22 21:02:56 +01:00
Alexander Weaver
c32953e52c
Alertign: Create feature toggle for recording rules (#86696)
create toggle for recording rules
2024-04-22 12:53:16 -05:00
Yuri Tseretyan
9735a8a080
Alerting: Distinguish conflict violation errors (#86634)
* update generator to set ID = 0 and do not set 0 if unique is needed
* return proper message when the constraint violation
2024-04-22 12:28:46 -04:00
Julian Siebert
14f018e3fc
Docs: Use correct description for "og_priority" (#80889) 2024-04-22 13:53:18 +00:00
Kristina
2247d6c415
Short Links: Add setting for changing expiration time (#86003)
* Add setting for changing shortlink expiration time

* Add docs, add better language

* put all the numbers in the duration 🤷

* 🙄

* update language to be correct and clear

* Add max limit and more documentation
2024-04-22 07:39:24 -05:00
Steve Simpson
54290f2ac4
Alerting: Fix TestRouteGetRuleStatuses as much as possible. (#86666)
This test has been skipped for a long time, so it doesn't work anymore. I've
fixed the test so it works again, but left some tests disabled which were
apparently flaky. If we see the other test cases flaking, we'll have to
disable it again.

Fixes:
- Use fake access control for most test cases, and real one for FGAC test cases.
- Check that "file" in API responses the full folder path, not folder title.
2024-04-22 12:36:50 +02:00
Timur Olzhabayev
951916c668
Chore: Making the plugin install commands respect the config parameter (#86578)
Currently the grafana cli plugin commands are not reacting to the --config parameter. This PR make it possible to use config to define the plugin endpoints via config as an alternative to providing the --repo flag.
2024-04-22 10:29:25 +02:00
Steve Simpson
f07f48616a
Alerting: Fix panic when limit_alerts=0. (#86640)
Oversight in the TopK function meant if k=0, then we'd panic when checking
element zero in the heap, because no items are ever allowed into the heap.
2024-04-22 10:14:19 +02:00
Michael Mandrus
45a7f649fe
CMS: Create local implementation of cloud migration for dev use (#86637)
* add developer mode property to config

* create cms stub

* cleanup

* implement and wire up gcom stub

* fix errors

* don't document the flag
2024-04-20 23:51:58 -04:00
Andreas Christou
ae84d16a6f
MSSQL: Simplify proxy logic (#86278)
* Simplify proxy dialer creation

- Set new dialer on connector
- Create MSSQL connector in a similar fashion to postgres

* Update test

* Fix lint

* More lint

* Use correct driver name
2024-04-19 22:03:26 +01:00
Steve Simpson
6ea97e41fb
Alerting: Consistently return Prometheus-style responses from rules APIs. (#86600)
* Alerting: Consistently return Prometheus-style responses from rules APIs.

This commit is part refactor and part fix. The /rules API occasionally returns
error responses which are inconsistent with other error responses. This fixes
that, and adds a function to map from Prometheus error type and HTTP code.

* Fix integration tests

* Linter happiness

* Make linter more happy

* Fix up one more place returning non-Prometheus responses
2024-04-19 21:03:20 +02:00
Robert Horvath
86a9533863
Chore: Replace backend platform codeownership (#86010)
* Replace backend platform codeownership

* fix go.mod with work sync

* fix go.mod

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>

---------

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>
Co-authored-by: Dave Henderson <dave.henderson@grafana.com>
2024-04-19 19:12:59 +02:00
Eric Leijonmarck
ddabef9895
RBAC: Add actionsets struct and write path (#86108)
* Add actionsets struct and failing test

* update from review

* review comments

* review comments update

* refactor: create interface

* actionset service

* fix tests

* move from wireoss to wire

* Apply suggestions from code review

remove unnecessary comments

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

* nil for the actionsetservice

* Revert "nil for the actionsetservice"

This reverts commit e3d3cc8171.

---------

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
2024-04-19 15:38:14 +01:00
Santiago
529f55cfe8
Alerting: Remove isDefault field from receivers (Alertmanager configuration) (#86605)
Alerting: Remove isDefault field from receivers in the Alertmanager configuration
2024-04-19 15:44:20 +02:00
Santiago
309a7e7684
Alerting: Implement SaveAndApplyDefaultConfig in the remote Alertmanager struct (#85005)
* Alerting: Implement SaveAndApplyDefaultConfig in the remote Alertmanager struct

* send the hash of the encrypted configuration

* tests, default config hash in AM struct

* add missing default config to test

* restore build directory

* go work file...

* fix broken test

* remove unnecessary conversion to []byte

* go work again...

* make things work again with latest main branch changes

* update error messages in tests for decrypting config
2024-04-19 15:11:07 +02:00
Santiago
a2ce8fefed
Alerting: Use a struct when sending a Grafana AM configuration to the remote Alertmanager (#86451)
* Alerting: Use a struct when sending a Grafana AM configuration to the remote Alertmanager

* remove '-distroless' from mimir image name
2024-04-19 13:04:18 +02:00
Steve Simpson
5f7612834e
Alerting: Refactoring in api_prometheus.go to allow code reuse. (#86575)
Preparing these functions to be used by some other part of the codebase,
which does not have a `contextmodel.ReqContext`, only the normal request
structure (`url.Values`, etc). This is slightly messy because of how
Grafana allows url parameters to be in the URL or in the request body,
so we need to make sure to invoke the form parsing logic in `ReqContext`.
2024-04-19 12:52:01 +02:00
Alex Khomenko
44e1bce55a
Feature toggles: Remove dashboardEmbed toggle (#86587) 2024-04-19 12:48:08 +02:00
Steve Simpson
73873f5a8a
Alerting: Optimize rule status gathering APIs when a limit is applied. (#86568)
* Alerting: Optimize rule status gathering APIs when a limit is applied.

The frontend very commonly calls the `/rules` API with `limit_alerts=16`. When
there are a very large number of alert instances present, this API is quite
slow to respond, and profiling suggests that a big part of the problem is
sorting the alerts by importance, in order to select the first 16.

This changes the application of the limit to use a more efficient heap-based
top-k algorithm. This maintains a slice of only the highest ranked items whilst
iterating the full set of alert instances, which substantially reduces the
number of comparisons needed. This is particularly effective, as the
`AlertsByImportance` comparison is quite complex.

I've included a benchmark to compare the new TopK function to the existing
Sort/limit strategy. It shows that for small limits, the new approach is
much faster, especially at high numbers of alerts, e.g.

100K alerts / limit 16: 1.91s vs 0.02s (-99%)

For situations where there is no effective limit, sorting is marginally faster,
therefore in the API implementation, if there is either a) no limit or b) no
effective limit, then we just sort the alerts as before. There is also a space
overhead using a heap which would matter for large limits.

* Remove commented test cases

* Make linter happy
2024-04-19 11:51:22 +02:00
Ryan McKinley
5a8384a245
QueryService: Add feature toggles to better support testing (#86493) 2024-04-19 12:26:21 +03:00
Will Browne
8a5c0cfdc0
Plugins: Pass cancellable context during API server creation (#86545) 2024-04-19 09:22:14 +03:00
Sofia Papagiannaki
aa825f5dee
Chore: Fix Swagger/OpenAPI instructions (#86541)
Update README.md
2024-04-19 09:16:38 +03:00
Matthew Jacobson
a20197229e
Alerting: Prevent simplified routing zero duration GroupInterval and RepeatInterval (#86561)
Prevent zero duration GroupInterval and RepeatInterval
2024-04-18 21:08:38 -04:00
Matthew Jacobson
71445002b7
Alerting: Fix simplified routing group by override (#86552)
* Alerting: Fix simplified routing custom group by override

Custom group by overrides for simplified routing were missing required fields
GroupBy and GroupByAll normally set during upstream Route validation.

This fix ensures those missing fields are applied to the generated routes.

* Inline GroupBy and GroupByAll initialization instead of normalize after
2024-04-18 21:08:14 -04:00
ismail simsek
28a683cf28
InfluxDB: Remove influxdbSqlSupport feature toggle (#86518)
Remove influxdbSqlSupport feature toggle
2024-04-18 16:29:27 +02:00
Vanilla
817f787947
Cli: Check missing plugin parameter of plugin update command (#86410)
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2024-04-18 15:46:04 +02:00
Andres Martinez Gotor
eac02a61e1
Return plugin error when requesting settings (#86052) 2024-04-18 14:29:02 +02:00
Mihai Doarna
57848bbe23
Auth: encrypt/decrypt SAML secrets in SSO settings service (#85253)
encrypt/decrypt saml secrets in sso settings service
2024-04-18 15:16:59 +03:00
Andres Martinez Gotor
0f4a47b180
Plugin load errors: Add more well-known errors (#85960) 2024-04-18 13:04:22 +02:00
Andreas Christou
420067a7e1
MSSQL: Add SQL_VARIANT converter and update test (#85823)
Add SQL_VARIANT converter and update test
2024-04-17 16:49:51 -05:00
Michael Mandrus
df4c8c3cbc
CloudMigrations: Move business logic out of api layer (#86406)
* move run migration to the cloudmigrationimpl layer

* add migration run list logic down a layer

* remove useless comments

* pull cms calls into their own service
2024-04-17 15:43:09 -04:00
Kyle Brandt
46efe41e33
Prometheus: (Instrumentation) Add rawExpr (pre-interpolation) to traces (#86449) 2024-04-17 19:53:38 +02:00
Will Browne
dceb83ab42
Plugins: Expose backendplugin for client proto interface (#86207)
* first pass

* tidy

* add err check

* remove comment

* simplify

* remove unused stuff

* add backend()

* use SDK commit

* add codeowners for go.mod

* fix go.mod

* bump SDK

* go work sync
2024-04-17 18:47:01 +02:00
Leonor Oliveira
9baf96dbd2
Storage: dualwriter update implementation (#85844)
* Add update methods for the dual writer

* improve errors

* [WIP] add tests for the update method

* Move example package to its own package so it can be used by the rest package. Finish tests

* Add codeowners

* Use Pod as a dummy resource

* :int

* Lint

* [REVIEW] rename var

* [REVIEW] don't rely on legacy storage at all in mode4

* Update pkg/apiserver/rest/dualwriter_mode2.go

Co-authored-by: Arati R. <33031346+suntala@users.noreply.github.com>

* [REVIEW] improve comment

* Update pkg/apiserver/rest/dualwriter_mode1.go

Co-authored-by: Dan Cech <dcech@grafana.com>

* [REVIEW] improve mode3

* Lint

* Move test files

* Update pkg/apiserver/rest/dualwriter_mode2.go

Co-authored-by: Arati R. <33031346+suntala@users.noreply.github.com>

* Lint

* Update pkg/apiserver/rest/dualwriter_mode4_test.go

Co-authored-by: Arati R. <33031346+suntala@users.noreply.github.com>

* Fix error

* Lint

* Update pkg/apiserver/rest/dualwriter_mode2.go

Co-authored-by: Arati R. <33031346+suntala@users.noreply.github.com>

* Don't set the flag to true as updatedObj creates an object in case it's not found

* Lint

* Lint

* Add tests on update

* Lint

---------

Co-authored-by: Arati R. <33031346+suntala@users.noreply.github.com>
Co-authored-by: Dan Cech <dcech@grafana.com>
2024-04-17 08:32:34 -06:00
Aaron Godin
d409d8e860
IAM - Fix error messages for resource permissions endpoints (#85773)
* IAM: fix many error messages in access-related code to provide more information

* Remove debug statement

* Refactor resourcepermissions package to use errutil

* Replace a few more errors with errutil and wrap errors found in users and teams services

* Apply diff of openAPI spec
2024-04-17 08:53:28 -05:00
Karl Persson
1a6777cb93
User: use update function for password updates (#86419)
* Update password through Update function instead

* Remove duplicated to lower

* Refactor password code
2024-04-17 15:24:36 +02:00
Andre Pereira
93c24403b3
Explore: Move app to under explore > traces (#86436)
Move app to under explore > traces
2024-04-17 14:18:06 +01:00
Kristin Laemmert
03b795844c
SQLStore: Improve recursive CTE support detection (#86397)
sqlstore: improve recursive CTE support detection

Vitess returns a not supported error, not a parse error

Co-authored-by: Derek Perkins <derek@nozzle.io>
2024-04-17 08:37:47 -04:00
Leonor Oliveira
dcfaf7e434
Storage: Add dualwriter test mocks (#86243)
* WIP: add mocks for dual writer

* Test dualwriter mode1

* Re-add non implementation errors

* Use testify assert

* Write tests for mode2.

* Lint

* Remove comment

* Update pkg/apiserver/rest/dualwriter_mode2_test.go

Co-authored-by: Arati R. <33031346+suntala@users.noreply.github.com>

* [REVIEW improve readability and call fn legacy fn

* [REVIEW] rename mocks and setupFns

* [REVIEW add missing test case

* [REVIEW] add test case with getting object from storage and not legacy

* Add deleteCollection

* Test deleteCollection

* Rename file

---------

Co-authored-by: Arati R. <33031346+suntala@users.noreply.github.com>
2024-04-17 11:25:19 +02:00
Yuri Tseretyan
e9d6135e33
SSE: Threshold expression to use simple functions (#86062)
* replace math expression with predicates
2024-04-16 13:35:41 -04:00
Eric Leijonmarck
9c1ef8b16e
Auth: Remove caseinsensitive check on update user (#86286)
* Removal: case insensitive check on update

* refactor and removal of test for duplicate user

* refactor to still shadow user variable
2024-04-16 17:47:17 +01:00
Matthew Jacobson
533bed6d94
Alerting: Fix simplified routes '...' groupBy creating invalid routes (#86006)
* Alerting: Fix simplified routes '...' groupBy creating invalid routes

There were a few ways to go about this fix:
1. Modifying our copy of upstream validation to allow this
2. Modify our notification settings validation to prevent this
3. Normalize group by on save
4. Normalized group by on generate

Option 4. was chosen as the others have a mix of the following cons:
- Generated routes risk being incompatible with upstream/remote AM
- Awkward FE UX when using '...'
- Rule definition changing after save and potential pitfalls with TF

With option 4. generated routes stay compatible with external/remote AMs, FE
doesn't need to change as we allow mixed '...' and custom label groupBys, and
settings we save to db are the same ones requested.

In addition, it has the slight benefit of allowing us to hide the internal
implementation details of `alertname, grafana_folder` from the user in the
future, since we don't need to send them with every FE or TF request.

* Safer use of DefaultNotificationSettingsGroupBy

* Fix missed API tests
2024-04-16 12:14:39 -04:00
Arati R
79eab65f94
Storage: Add mode-specific DeleteCollection implementations (#86065)
* Add DeleteCollection methods to modes 1 and 4
* Add DeleteCollection implementations for modes 2 and 3
2024-04-16 17:05:31 +02:00
Nick Richmond
d3fee607e2
Expressions: sort numeric metrics behind feature toggle (#85911)
* feat: sort numeric metrics behind feature toggle

* chore: upgrade `dataplane/sdata` to latest tag

* chore: `go work sync`
2024-04-16 10:52:47 -04:00
Ieva
036f826b87
AuthZ: Further protect admin endpoints (#86285)
* only users with Grafana Admin role can grant/revoke Grafana Admin role

* check permissions to user amdin endpoints globally

* allow checking global permissions for service accounts

* use a middleware for checking whether the caller is Grafana Admin
2024-04-16 15:48:12 +01:00
Karl Persson
0f06120b56
User: Clean up update functions (#86341)
* User: remove unused function

* User: Remove UpdatePermissions and support IsGrafanaAdmin flag in Update function instead

* User: Remove Disable function and use Update instead
2024-04-16 16:33:50 +02:00
owensmallwood
8c8885ef23
Storage Api: Adds traces (#85391)
- adds traces and improved logging to the unified storage server
- add a configurable logger to the gRPC server service
2024-04-16 08:30:51 -06:00
Kyle Brandt
a12669951b
Prometheus: Add BE support for Adhoc Filters (#85969)
---------

Co-authored-by: ismail simsek <ismailsimsek09@gmail.com>
2024-04-16 16:56:50 +03:00
Karl Persson
8520892923
User: Fix GetByID (#86282)
* Auth: Remove unused lookup param

* Remove case sensitive lookup for GetByID
2024-04-16 15:24:34 +02:00
Gábor Farkas
2379498228
mysql additional decoupling steps (#86168)
* mysql additional decoupling steps

* updated snapshot test
2024-04-16 11:50:41 +02:00
Gábor Farkas
9015bfa3f4
mssql: decouple sqleng (#86130)
* mssql: decouple sqleng

* fix codeowners-file
2024-04-16 08:00:14 +00:00
Ryan McKinley
ba510d1a7d
Playlists: Enable kubernetesPlaylists by default in OSS (#86259) 2024-04-16 09:19:35 +02:00
Brendan O'Handley
f85470d652
Prometheus: Use the frontend package in Prometheus and remove feature toggle (#86080)
* add history links for monaco completion provider folder

* add history links for monaco query field folder

* add history links for components folder

* add history links for configuration folder

* add history links for dashboard json folder

* add history links for gcopypaste folder

* add history link for variableMigration

* add history link for querybuilder/components/metrics-modal folder

* add history link for querybuilder/components/promqail folder

* add history links for querybuilder/components folder

* add history links for querybuilder/hooks folder

* add history links for querybuilder/shared folder

* add history links for querybuilder folder

* add history links for querycache folder

* add history links for src folder

* use frontend package and custom auth in module.ts

* remove files and fix import issues

* remove usePrometheusFrontendPackage

* remove extra files

* update betterer

* remove extra files after rebase

* fix betterer for rebase

* fix e2e flakiness
2024-04-15 16:45:23 -05:00
Charandas
2aedd9dacf
K8s: add ID token to requests outbound to new query endpoint (#86214) 2024-04-15 20:34:20 +02:00
Alexander Weaver
5b1498f98f
Alerting: Return a 400 and errutil error when trying to delete a contact point that is referenced by a policy (#85481)
Return a 400 and errutil error when trying to delete a contact point that is referenced by a policy
2024-04-15 09:25:28 -05:00
Gábor Farkas
7ce7584151
postgres: decouple sqleng (#86055) 2024-04-15 14:28:03 +02:00
Gábor Farkas
b02317d583
mysql: decouple sqleng (#86057) 2024-04-15 14:26:15 +02:00
Dave Henderson
44adfea049
Server: Fix 'server' subcommand double-registration (#86083)
fix 'server' subcommand double-registration

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>
2024-04-15 08:21:03 -04:00
linoman
51da96d94e
Auth: Add IsClientEnabled and IsEnabled for the authn.Service and authn.Client interfaces (#86034)
* Add `Service. IsClientEnabled` and `Client.IsEnabled` functions

* Implement `IsEnabled` function for authn clients

* Implement `IsClientEnabled` function for authn services
2024-04-15 10:54:50 +02:00
Leonor Oliveira
d17af78e79
Storage: dualwriter delete implementation (#86000)
* Add delete methods

* Remove duplicated const

* Add tests

* Lint

* Lint

* Remove duplicated test file

* Update pkg/apiserver/rest/dualwriter_mode2.go

Co-authored-by: Arati R. <33031346+suntala@users.noreply.github.com>

* Update pkg/apiserver/rest/dualwriter.go

Co-authored-by: Arati R. <33031346+suntala@users.noreply.github.com>

* Update pkg/apiserver/rest/dualwriter_mode2.go

Co-authored-by: Arati R. <33031346+suntala@users.noreply.github.com>

* Add missing dependency

* Return if object deletion goes wrong

* Add a more complete log

---------

Co-authored-by: Arati R. <33031346+suntala@users.noreply.github.com>
2024-04-15 10:48:31 +02:00
Giuseppe Guerra
eec9d3dbc4
Plugins: Removed feature toggle pluginsDynamicAngularDetectionPatterns (#85956)
* Plugins: Removed feature toggle pluginsDynamicAngularDetectionPatterns

* re-generate feature toggles
2024-04-15 10:37:28 +02:00
Yuri Tseretyan
12605bfed2
Alerting: Update fixed roles to include silences permissions (#85826)
* update fixed roles to include silences
* add silence actions to managed permissions
* update documentation
2024-04-12 12:37:34 -04:00
Ieva
56f4664875
RBAC: add a feature toggle for action sets (#86064)
* add a feature toggle for action sets

* update feature toggle name
2024-04-12 17:19:25 +01:00
Faye Lin
a94ab259c6
Expression: Fix a bug of the display name of the threshold expression result (#85912)
* replace ReferenceVar with RefID when creating the math command for the ThresholdCommand

* Fix the Hysteresis test
2024-04-12 17:46:14 +02:00
Steve Simpson
ad7f804255
Alerting: Fix evaluation metrics to not count retries (#85873)
* Change evaluation metrics to only count once per eval, and add new metrics.

* Cosmetic: Move eval total Inc() to orginal place.
2024-04-12 16:20:46 +02:00
lean.dev
c8d185502b
Fixes CMS url for dev environment (#86056) 2024-04-12 14:19:38 +00:00