Commit Graph

53 Commits

Author SHA1 Message Date
Georges Chaudy 53e91fd5e8
unistore: close event stream on context cancelation (#101293)
* add tests for broacaster

* fix sql notifier not closing the stream

* fix sql notifier not closing the stream

* close sub

* fix broadcaster test

* fix broadcaster test

* suggestion
2025-02-25 08:28:31 -08:00
Georges Chaudy e13bd52da6
unistore: move continue to the resource package (#101206)
* minor improvements to tests

* move continue token

* update sql backend
2025-02-24 18:02:30 +02:00
Georges Chaudy b850c9fa68
unistore: Add missing verb to compile (#100972)
Add missing verb to compile
2025-02-19 17:06:26 +02:00
Ryan McKinley a5355fd66c
Storage: Add command line tool to migrate legacy dashboards (and folders) to unified storage (#99199) 2025-02-11 19:57:46 +02:00
Stephanie Hingtgen 0cef2b9ae7
Dashboard Versions: Make compatible with app platform (#99327) 2025-01-28 08:17:52 -06:00
Misi 437b7a565d
Auth: Add access token to in-proc communication and ServiceIdentity (#98926)
Use fake access token for in-proc grpc and add ServiceIdentity 
---------

Co-authored-by: gamab <gabriel.mabille@grafana.com>
Co-authored-by: Karl Persson <23356117+kalleep@users.noreply.github.com>
2025-01-24 14:03:23 +01:00
Ryan McKinley 680e6bc1f8
Authlib: Use types package rather than claims (#99243) 2025-01-21 12:06:55 +03:00
Ryan McKinley 356b32008b
Storage: Show history+trash using the list command (#99009)
Co-authored-by: Stephanie Hingtgen <stephanie.hingtgen@grafana.com>
2025-01-17 15:54:25 +03:00
Georges Chaudy 98e9f3a534
[unistore] wire authlib compile (#99027)
* Wire authz client compile method

* add verb to metric

* remove tipo
2025-01-16 14:11:55 +01:00
Ryan McKinley cd46f1ddb9
Search: Remove history query (#99026) 2025-01-15 12:49:47 -06:00
Karl Persson 3f71a72c1a
Authz: Remove "wrapper" interface and only check feature toggle for grpc mode (#98933)
* Remove "wrapper" interface and only check feature toggle for grpc and cloud mode

* Only set name for update checks

* Set dashboard permissions for admin user
2025-01-15 09:23:56 +01:00
Ryan McKinley ed39259461
Search: Replace Origin calls with Repository (#98754) 2025-01-10 20:27:10 +02:00
Ryan McKinley 429da7fd68
SQL/Blob: Add support for blob storage to SQL backend (#98192) 2025-01-08 22:08:10 +02:00
Stephanie Hingtgen 8f6e9f8ed0
Restores in app platform (#97582) 2024-12-13 16:55:43 -06:00
Ryan McKinley ea17b79c09
Search: Return counts for values within an folder/repository (#97534) 2024-12-10 20:37:37 +02:00
owensmallwood d762a96436
Unified Storage: Init at startup, fix traces, and speed up indexing (#97529)
* dont lazy init unified storage

* Inits index when creating new resource server. Fixes trace propagation by passing span ctx. Update some logging.

* Use finer grained cache locking when building indexes to speed things up. Locking the whole function was slowing things down.

* formatting

* linter fix

* go mod

* make update-workspace

* fix workspaces check error

* update dependency owner in mod file

* wait 1 second before querying metrics

* try with big timeout, see if fixes CI. Wont fail locally.

* skips postgres integration test. Only fails in drone. Will fix later.

* put delay back to 500 ms
2024-12-09 22:32:19 -06:00
Ryan McKinley 8165258a2d
Storage: Query stats within a namespace (#97403) 2024-12-05 13:58:13 +03:00
Ryan McKinley 9d89d8757f
Search: Build index from resource stats (#97320) 2024-12-03 20:20:27 +03:00
Ryan McKinley f6ccf976e5
UnifiedSearch: Use ResourceIndex from dashboards apiserver (v0alpha1 only) (#96939) 2024-11-27 07:57:53 +02:00
Ryan McKinley 94262fd095
Search: expose search on dashboard apiserver (v0alpha1) (#96907) 2024-11-22 22:26:56 +02:00
Ryan McKinley 0cb6c3d7bf
UnifiedSearch: Introduce a DocumentBuilder interface (#96738) 2024-11-21 07:53:25 +02:00
Ryan McKinley cc6d057a18
Provisioning: Rename k8s origin metadata to repo (#96524) 2024-11-15 17:26:14 +03:00
Ryan McKinley d9b87ef987
Storage: Add authz access client stubs (#95548)
authz stubs

authz stubs

lint fix

Add folder

move check.Name on creat

fix watch
2024-11-13 13:17:15 +01:00
Ryan McKinley e9956f2345
Storage: Always set a UID in the apiserver (#96086) 2024-11-12 18:58:32 +02:00
Georges Chaudy c3571752b6
Unitstore: Fix the Folder migration (#96078)
* UniStore: Add folder to the SQL backend

This reverts commit aaa4f4a23e.

* fix folder migration
2024-11-12 12:52:04 +01:00
Ryan McKinley c0de407fee
K8s/Dashboards: Delegate large objects to blob store (#94943) 2024-11-09 08:09:46 +03:00
owensmallwood b6596db75e
Unified Storage Indexer: Build tenant indexes concurrently (#95795)
* WIP - build tenant indexes concurrently

* adds local dev seeders and readme for indexer

* update logging and adds locking in getShard()

* update logs

* Adds Namespaces func. Initializes index after ResourceServer is created.

* fixes Count() and updates test lint issues

* Initialize index separately. Don't do it when creating the resource server. Makes testing really awkward.

* fix lint error

* handles error when getting namespaces

* updates test and index helper funcs
2024-11-06 12:58:07 -06:00
Leonor Oliveira aaa4f4a23e
Revert "UniStore: Add folder to the SQL backend" (#95966)
Revert "UniStore: Add folder to the SQL backend (#95671)"

This reverts commit f075662696.
2024-11-06 17:04:57 +02:00
Georges Chaudy f075662696
UniStore: Add folder to the SQL backend (#95671)
* Add folder to the SQL backend

* remove unused key

* fix tests

* Return folders from watch
2024-11-05 10:37:23 +01:00
owensmallwood 5e3e7cca0e
Search PoC: Adds traces to indexer (#95372)
* adds traces to indexer

* fix linting errors
2024-10-25 00:05:33 +03: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
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
Ryan McKinley 3457f219be
Storage: Add blob storage interfaces (#90932)
Co-authored-by: Jean-Philippe Quémémer <jeanphilippe.quemener@grafana.com>
2024-10-17 12:18:29 +02:00
Scott Lepper 52b70ca976
Grafana indexing poc - load and watch index (#93843)
* list resources and load into index
* watch for changes and update index
2024-10-08 09:43:23 -04:00
Georges Chaudy 03f55e5288
Unistore : Ensure Watch works in HA mode (#94120)
* Revert "Revert "Unistore : Ensure Watch works in HA mode." (#94097)"

This reverts commit 7c3fc2f261.

* make previous_resource_version nullable

* handle nil case
2024-10-07 10:01:53 +02:00
Georges Chaudy 7c3fc2f261
Revert "Unistore : Ensure Watch works in HA mode." (#94097)
Revert "Unistore : Ensure Watch works in HA mode. (#93428)"

This reverts commit 0a26c9e9ae.
2024-10-01 18:45:47 +00:00
owensmallwood 6a3eb276ef
Grafana Indexing PoC: Adds feature flag and gRPC endpoint (#93356)
* adds Filter gRPC and make protobuf

* adds route for querying the filter gRPC

* wires up Filter gRPC call

* [WIP] index from start

* renames gRPC endpoint to "Search"

* adds /apis/search route into k8s routes. Hacky for now.

* updates readme - wrong casing

* adds feature toggle for unified storage search

* hides US search behind feature flag. Clean up print statements.

* removes indexer - will be added in another PR

* Search: Add API Builder

* adds required method

* implementing UpdateAPIGroupInfo (WIP)

* adds groupversion

* commenting out for now

* remove unneeded code from experimenting and update register.go to match interface required

* namespaces search route

---------

Co-authored-by: leonorfmartins <leonorfmartins@gmail.com>
Co-authored-by: Todd Treece <todd.treece@grafana.com>
2024-09-30 13:46:14 -06:00
Georges Chaudy 0a26c9e9ae
Unistore : Ensure Watch works in HA mode. (#93428)
* Replace Watch with WatchNext

* remove watchset

* fix previous page and closing the channel

* Remove the broadcaster cache to prevent dupplicated events

* add watch bookmark

* add watch bookmark

* cleanup comments

* disable the tests for bookmarks for now

* Ensure we send previosu events

* lint

* re-introduce the cache

* load from cache

* disabling legacy test

* disabling legacy test

* Update pkg/storage/unified/resource/server.go

Co-authored-by: Diego Augusto Molina <diegoaugustomolina@gmail.com>

* Could not read previous events

* add proper migration

* Add previous_resource_version to both history and resource

* First event should have an RV of 2 and not 1

* Test both storage backends

* fix the inital RV for the sql backend

* ensure graceful stop of the stream decoder

* gocyclo

---------

Co-authored-by: Diego Augusto Molina <diegoaugustomolina@gmail.com>
2024-09-30 13:14:07 +02:00
Ryan McKinley 5441e4c752
Storage: create a client with access to all interfaces, not just ResourceStore (#92967) 2024-09-05 12:52:30 +03:00
Ryan McKinley e106df6d0b
Auth: Update unified storage to depend on AuthInfo rather than Requester (#91783)
depend on authlib user info
2024-08-12 09:49:34 +03:00
Ryan McKinley 21d4a4f49e
Auth: use IdentityType from authlib (#91763) 2024-08-12 09:26:53 +03:00
Todd Treece 9a2c9647ee
Chore: Add storage submodule to lint & test config (#91529) 2024-08-05 17:30:14 +03:00
Ryan McKinley 391284bb33
Storage: Improve (some) error handling (#91373) 2024-08-02 10:27:10 +03:00
Ryan McKinley f804b0baa3
Storage: Return an iterator from backend List (#91185) 2024-07-31 12:05:59 +03:00
Ryan McKinley da65825c5f
Storage: Consolidate error handling (#91167) 2024-07-30 10:16:16 +00:00
Ryan McKinley 728150bdbd
Identity: extend k8s user.Info (#90937) 2024-07-30 08:27:23 +03:00
Ryan McKinley 9db3bc926e
Identity: Rename "namespace" to "type" in the requester interface (#90567) 2024-07-25 12:52:14 +03:00
Diego Augusto Molina 399d77a0fd
Resource server improvements and fixes (#90715)
* cleanup dependencies and improve list method
* Improve Resource Server API, remove unnecessary dependencies
* Reduce the API footprint of ResourceDBInterface and its implementation
* Improve LifecycleHooks to use context
* Improve testing
* reduce API size and improve code
* sqltemplate: add DialectForDriver func and improve naming
* improve lifecycle API
* many small fixes after adding more tests
2024-07-22 20:08:30 +03:00
Ryan McKinley f409f8c169
K8s/Dashboards: Implement dashboards as StorageBackend (#90295) 2024-07-17 10:49:23 -07:00
Ryan McKinley 07c2d886fa
Storage: prepare in resource bytes in storage.Interface, not the backend (#90513)
* prepare in k8s

* prepare in k8s

* prepare in k8s

* simplify event creation

* decode the inputs
2024-07-17 07:40:03 -07:00