Commit Graph

14346 Commits

Author SHA1 Message Date
Karl Persson
6f7528f896
Migration: Remove table aliasing in delete statement to make it work for mariadb (#95226)
Migration: remove table aliasing in delete statement to make it work in mariadb
2024-10-23 10:49:20 +02:00
Leonor Oliveira
a03652494c
Dual Writer simplification (#93852)
* All objects should have an UID

* Now with a different error message

* Simplify create on DW 2: use the same object to write to both storages

* Run only one test

* Add check for status code

* Add name if it's not present in mode2

* Populate UID in legacy

* Remove logs and commented code

* Change dualwriter1

* Remove commented code

* Fix list test

* remove get on update from dualwriter 2

* Get object before updating. Better var renaming

* Finish rebasing

* Comment test

* Uncomment tests

* Update legacy first. Add preconditions

* Remove preconditions

* Fix update test

* copy RV from unified to legacy objects

* revert changes to playlist xorm store

* Improve logging. Add go routines for mode3

* Add tests for async funcs in mode3

* Lint

* Lint

* Lint. Start to fix tests

* Fix watcher tests

* Fix store tests

* Fiinish fixing watcher tests

* Fix server tests

* add name check

* Update pkg/apiserver/rest/dualwriter_mode1.go

Co-authored-by: Bruno Abrantes <bruno.abrantes@grafana.com>

* All objects should have an UID

* Now with a different error message

* Simplify create on DW 2: use the same object to write to both storages

* Run only one test

* Add check for status code

* Add name if it's not present in mode2

* Populate UID in legacy

* Remove logs and commented code

* Change dualwriter1

* Remove commented code

* Fix list test

* remove get on update from dualwriter 2

* Get object before updating. Better var renaming

* Finish rebasing

* Comment test

* Uncomment tests

* Fix update test

* revert changes to playlist xorm store

* Improve logging. Add go routines for mode3

* Lint

* Fix watcher tests

* Fiinish fixing watcher tests

* Add mode 5 with etcd test case. Add early check to fail on populated RV in payload

* we can't set RV to the found object when updating

* Lint

* Don't fail on update playlists

* Name should not be different when updating and it should be not empty on creating

* Fix tests

* Update pkg/apiserver/rest/dualwriter_mode2.go

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

* Lint

* Fix mode 5 tests

* Lint

* Add generateName condition on every mode. Fix tests

* Lint

* Add condition on where name or generate name have to be set

* Fix test

* Lint

* Fix folders test

* We dont need to send name for mode1

* Fail if UID is not present

* Remove change from not running test

* Remove unused line

* Lint

* Update pkg/storage/unified/apistore/store.go

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

* Improve error message

* Fix broken watcher test

* Fail on name mismatch on update

* Remove log

* Make sure UIDs match on create in both stores

* Lint

* Write first to unified storage

* Remove uid setting

* Remove RV only in mode2

* Fix test. Remove log line

* test

* No need to asser on RV in mode3

* Remove RV check due to race condition

* Update dualwriter.go

Co-authored-by: Georges Chaudy <chaudyg@gmail.com>

* Update pkg/storage/unified/client.go

* remove unused parameter

* log an error for object is missing UID instead of returning an error

* remove obj.SetResourceVersion("")

* log an error for object is missing UID instead of returning an error

* FInalise merge

* Move RV check to where it was

* Remove name check

* Remove server check for backwards compatibility

* Remove unused fn

* Move test checks for another PR

* Dont commit go work sum changes

* Only log error if RV is present for now.

---------

Co-authored-by: Todd Treece <todd.treece@grafana.com>
Co-authored-by: Bruno Abrantes <bruno.abrantes@grafana.com>
Co-authored-by: Todd Treece <360020+toddtreece@users.noreply.github.com>
Co-authored-by: Georges Chaudy <chaudyg@gmail.com>
2024-10-23 10:29:41 +02:00
Gábor Farkas
3a719a2cfd
api: use alerting headers (#95118)
* api: use alerting headers

* improve code, add integration test

* better comment

* fixed test

* merged tests
2024-10-23 09:39:22 +02:00
owensmallwood
d9bc4f7395
Search poc: Add debug log for metric and update metric buckets (#95217)
* adds debug log for metric

* updates buckets
2024-10-23 09:35:17 +02:00
Matthew Jacobson
26162a53e6
Alerting: Allow config api receiver create/delete with alertingApiServer (#95207)
Previously all receiver modifications were denied with alertingApiServer
enabled. This allows pure creates and deletes through as these specific
cases can be handled simply and without risk of rbac shenanigans.
2024-10-22 16:54:05 -04:00
owensmallwood
9763199b53
Search Poc: Add metrics (#95111) 2024-10-22 12:25:08 -06:00
Gabriel MABILLE
7aeb1adff2
Fix: Check JSON data is not nil (#95189)
* Fix: Fix panic when json data are nil

* Use Interface()

* Feedback

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

* Need to check inside the if statement

---------

Co-authored-by: Eric Leijonmarck <eric.leijonmarck@gmail.com>
2024-10-22 18:09:44 +01:00
Will Browne
25abd57029
Plugins: Update to latest go plugin SDK (0.256.0) (#95065)
* update to latest go plugin SDK

* make update-workspace

* update alerting tests
2024-10-22 15:44:53 +01:00
Matthew Jacobson
4aad44e848
Alerting: Fix per-receiver RBAC for receivers with long names (#95084)
* Implement uidToResourceID

* add middleware

* Move uidToResourceID to alerting package

* Only hash uid if it's too long

* Use hashed uid in access control

* Move ReceiverUidToResourceId to ScopeProvider

* resolve uid in middleware only if param exists

* Tests

* Linting

---------

Co-authored-by: Yuri Tseretyan <yuriy.tseretyan@grafana.com>
2024-10-22 10:04:13 -04:00
Alexander Zobnin
e709de603d
Chore: Init auth model on server side (#95142)
* Chore: Init auth model on server side

* fix linter
2024-10-22 14:50:52 +02:00
Gabriel MABILLE
0704ae734f
AuthZ: Refactor authentication modes for the Authz package (#95120)
* AuthZ: Fix authentication modes for the Authz package

Co-Authored-By: Claudiu Dragalina-Paraipan <drclau@users.noreply.github.com>
2024-10-22 13:38:59 +02:00
Andrej Ocenas
3bf3290340
Grafana/ui: TimeRangePicker with automatic sync across instances (#94074) 2024-10-22 12:52:33 +02:00
Tito Lins
71d04a326b
Alerting: Support tls config for webhook receiver (#93513)
Adds the ability to configure tls settings on the webhook receiver (e.g. to skip server certificate validation)
2024-10-22 12:44:32 +02:00
Andrej Ocenas
5b1d99b8c4
Sidecar: Remove extension helpers and use the sidecar service directly (#94979) 2024-10-22 11:46:29 +02:00
linoman
3270a9c959
Session Refactor: Add auth module label to session's list (#94958)
* Add AuthModule to token API

* Add badge to UserSessions

* Change idp label rendering

* Render IdP label for User Profile page

* Add i18n labels
2024-10-22 10:57:36 +02:00
Alexander Akhmetov
d0481bb568
Alerting: Refactor state manager Warm method to accept instance store as an argument (#95098) 2024-10-22 09:45:50 +02:00
owensmallwood
bda27ec8c6
Unified Storage: Add watch latency metric (#93509)
* adds metric for watch latency

* registers storage metrics when creating a new ResourceServer

* defines the latency (in milliseconds) as the diff between now and the RV. Still need to wait until PR for switching RV to millisecond timestamp is rolled out.

* should be micro seconds not milli

* for watch latency, use diff between now and resource version and convert to seconds

* fix typo
2024-10-21 17:15:11 -06:00
Arati R.
f3a93a0303
K8s/Folders: Enhance k8s folder update (#95033)
* Put folder update behind feature toggle
* Set more fields when doing k8s update
* Check update in folder tests
* Uncomment remaining k8s handler methods
2024-10-21 19:08:03 +02:00
Arati R.
8abfcdbb78
Ks8/Folders: Fix status codes returned on create (#95055)
* Fix status codes returned by k8s folder handler
* Add test for status code when creating duplicate folder
2024-10-21 13:07:11 -03:00
owensmallwood
fb9cfd0d1b
Search PoC: Indexmapping per resource and transform to intermediate IndexedResource (#94906)
* Transforms raw US resource into an intermediate IndexableResource and indexes that. Pulls index mapping code out into different file. For now, we will hardcode which spec fields are indexed, per resource.

* Fixes a few bugs with field casing and timestamps not being formatted right (or not existing).

* adds readme section for using search with US

* extracts to function to transform from search hit to IndexedResource

* get folders when building index
2024-10-21 09:34:41 -06:00
Santiago
4f8f82f5f1
Alerting: Fix remote Alertmanager readiness check path (#95063) 2024-10-21 17:24:51 +02:00
Yuri Tseretyan
19a1d9d188
Fix: Initialize tracer in file provisioning (#95007)
initialize tracer
2024-10-21 10:03:58 -04:00
Karl Persson
b4366ebed2
Zanzana: bootstrap authz server (#95036)
Bootstrap authz extended server
2024-10-21 14:58:57 +02:00
Carl Bergquist
db06a5a5d3
scopes: test case for supporting queries using __name__ (#94954)
Signed-off-by: bergquist <carl.bergquist@gmail.com>
2024-10-21 08:18:40 -04:00
linoman
640bc0de97
SSO SAML: Remove SettingProvider settings from SSO interactions (#94900)
* Remove SettingProvider settings from SSO interactions

* Mock Settings Provider for SSO Settings test

* Ignore error from SettingsProvider

* Add test for backend
2024-10-21 11:28:55 +02:00
Dana Axinte
98e5048370
CloudMigration - Display different error messages for create migration errors (#94683)
* start on tokens

* more error messages

* more handling

* rephrased with suggestions from Daniel

* separate gms parse method

* use translation

* refactor initial idea to use error obj

* use error dto result

* handle gms client

* clean logs and comments

* fix tests

* tests for gms

* test and lint

* lint

* one more handling from gms

* typing in fe

* use error interface

* use validation error

* remove unused gms error

* use errorlib and helper function in fe

* regen api

* use same error util

* one more error to handle
2024-10-21 09:45:54 +01:00
William Wernert
0920e8bcc6
Alerting: Clear ignored fields of recording rules for API response (#95004)
* Clear ignored fields of recording rules for API response

* Move field clearing to compat function

* Run make update-workspace

* Cleanup changes
2024-10-19 01:03:12 +03:00
Scott Lepper
5700b4b13a
[search] - restart watch (#94981)
undo go sum change
2024-10-18 15:39:51 -04:00
Yuri Tseretyan
00bb3215cb
Alerting: Fix time-interval conversion to return bad request if payload is incorrect (#94995) 2024-10-18 13:16:03 -04:00
Yuri Tseretyan
672d5f92f2
Chore: Fix population of details when converting from errutil errors to K8s error (#94996) 2024-10-18 13:15:13 -04:00
lean.dev
3438196010
Anonymous User: Adds validator service for anonymous users (#94700) 2024-10-18 13:10:41 -03:00
William Wernert
053a806ab1
Alerting: Validate namespace when updating rules through the provisioning API (#94643)
* Also validate folder on provisioning update

* Move folder check before auth check

When checking for the existence of a folder we go through the folder
service which requires auth. Doing so prevents an unprivileged user from
accessing information about whether a particular folder exists or not.
2024-10-18 18:21:26 +03:00
Alexander Zobnin
2baf4883cc
Zanzana: add action sets to dashboard and folder schema (#94602) 2024-10-18 16:58:30 +02:00
Tobias Skarhed
d4546630df
Frontend Monitoring: Set correct default value in Go file (#94976) 2024-10-18 17:52:46 +03:00
Tobias Skarhed
bbc4dc3867
Frontend Monitoring: Add config option to enable all default instrumentations (#94862)
* Add config options to enable all faro instrumentation

* Fix ts error

* Fix type in test

* Add to default config files
2024-10-18 15:35:39 +02:00
Andre Pereira
bbe7029d0a
Tempo: Add support for /api/v2/traces/ and partial traces in Trace View (#94267)
* Request trace by id using v2, fallback for v1 when 404

* Show partial traces badge in Trace View

* update go work sum

* Fix tests

* some linting

* Fix tests and try to ignore linter

* Move no lint

* nolint:bodyclose

* merge main

* Fix null tags in array

* Fix test

* Update go.sum

* Update go.sum
2024-10-18 15:10:22 +03:00
Karl Persson
a82d01214d
Auth: Update authlib (#94947)
* Update authlib
2024-10-18 13:36:21 +02:00
Sam Jewell
ea71201ddc
ServerSideExpressions: Disable SQL Expressions to prevent RCE and LFI vulnerability (#94942)
* disable sql expressions

remove duckdb ref

* Run `make update-workspace`

---------

Co-authored-by: Scott Lepper <scott.lepper@gmail.com>
2024-10-18 11:28:26 +01:00
Gábor Farkas
cbe1e7d63f
expr: add explicit strict-mode const (#94838)
expr: add explicit strict-mode value
2024-10-18 10:46:27 +02:00
Marcus Efraimsson
42016dc359
Chore: Update SDK to v0.255.0 (#94894) 2024-10-18 10:42:32 +02:00
Gábor Farkas
34bb959835
expr: improved test (#94837) 2024-10-18 10:31:58 +02:00
Alexander Akhmetov
0b804e720f
Alerting: Add RuleGroup field to ListAlertInstancesQuery struct (#94615)
Alerting: add RuleGroup field to ListAlertInstancesQuery struct
2024-10-18 09:44:16 +02:00
Diego Augusto Molina
3e1f5559a6
Unistore Chore: Add database-level observability (#92266)
* add testing harness

* fix mockery and linters

* WIP

* wip

* fix transactions

* fix transaction tracing; add tracing by default

* rename package

* move WithTx to simplify logic of DB implementations

* fix potential issue with context deadline

* add db instrumentation to dbutil

* add otel tests

* improve naming

* minor fix in semantics and add comprehensive OTel testing

* fix naming

* instrument resourceVersionAtomicInc

* provide a default testing tracer

* fix docs

* fix typo in docs

* add semconv for k8s
2024-10-18 00:32:08 -03:00
Santiago
4c15266a77
Alerting: Add X-Remote-Alertmanager header to the remote AM client (#94913) 2024-10-17 22:38:13 +02:00
Josh Hunt
8f7352e862
CI: Additional changes for +security versions (#94854)
* Build: Fix docker manifest create not using correct IMAGE_TAG

* Support publishing security versions of NPM packages

---------

Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
Co-authored-by: Kevin Minehart <kmineh0151@gmail.com>
Co-authored-by: Diego Augusto Molina <diegoaugustomolina@gmail.com>
2024-10-17 22:13:42 +03:00
Charandas
2fd4fe40f0
K8s: for tests to use kubectl access, port-forwarding requires 0.0.0.0 (#94836) 2024-10-17 11:15:57 -07:00
Matheus Macabu
8673c757a5
CloudMigrations: only append notification policy if feature flag is on and it exists (#94896) 2024-10-17 17:15:30 +02:00
Esteban Beltran
f248a55576
Frontend Sandbox: Create a plugin sandbox enable registry. Use enable list instead of disable list (#94809)
* Use a enable configuration to enable frontend sandbox

* Modify settings to load enableFrontendSandbox

* Check for signature type

* Update commment

* Fix e2e tests for the frontend sandbox

* Modify logic so a custom check function is used instead of a list of checks

* Fixes flaky test

* fix comment

* Update comment

* Empty commit

* Empty commit
2024-10-17 16:56:50 +02:00
Karl Persson
4083b2208e
Zanzana: periodic sync of team members (#94752)
* Rewrite zanzana collector to fetch all available pages

* Register access control as a background service

* If zanzana is enabled we run Syncs and start Reconciliation job

* Update pkg/services/authz/zanzana/client/client.go

Co-authored-by: Alexander Zobnin <alexanderzobnin@gmail.com>

* Use server lock when doing performing reconciliation
2024-10-17 15:28:33 +02:00
Dana Axinte
a50507e645
CloudMigration: Interpret error code from migration resource item (#94407)
* start on loading the error code

* error code to message mapping

* use resource code type

* use defined error code

* partial updates from comments

* i18nKey gen

* fixed t

* fixed translations

* typing
2024-10-17 14:09:09 +01:00