Commit Graph

52 Commits

Author SHA1 Message Date
Jean-Philippe Quéméner cc8b40585b
feat(unified-storage): add traces for all the backend sub-paths (#102876) 2025-03-26 12:50:29 +01:00
Mustafa Sencer Özcan 65d474bfa4
chore(unified-storage): update default pruner history limit (#102799) 2025-03-25 17:00:12 +02:00
Marco de Abreu d3468105d7
Storage: Fix resource history sorting and pagination in Spanner backend (#102777)
* Align spanner ListHistory implementation with sql one

* Move migration logic

* Move migration code

---------

Co-authored-by: Marco de Abreu <18629099+marcoabreu@users.noreply.github.com>
2025-03-25 15:28:24 +01:00
owensmallwood 64e939fd5d
Unified Storage: Adds span and debug log for paginated List calls (#101912)
Adds span and debug log for paginated List calls
2025-03-21 14:20:27 -06:00
Marco de Abreu 6d570db312
Storage: Add ascending order support for NotOlderThan queries and introduce ResourceVersionMatch_Unset as default (#102505)
* Add support for ASC ordering and introduce ResourceVersionMatch_Unset as default
Add SortAscending to continue token and add integration test for pagination.

* Change protobuf order

* Make backwards compatible

* Update pkg/storage/unified/sql/backend.go

Co-authored-by: Jean-Philippe Quéméner <JohnnyQQQQ@users.noreply.github.com>

---------

Co-authored-by: Marco de Abreu <18629099+marcoabreu@users.noreply.github.com>
Co-authored-by: Jean-Philippe Quéméner <JohnnyQQQQ@users.noreply.github.com>
2025-03-21 18:35:32 +02:00
Stephanie Hingtgen c33a53a47a
K8s: Remove restore functionality; can be done with list (#102560) 2025-03-20 16:38:32 -05:00
Marco de Abreu ce350df79b
Storage: Add resource version matching in unified storage API (#102417)
Add NotOlderThan support to getHistory

Add support for Exact

Add tests

Refactor tests

Add error test

Co-authored-by: Marco de Abreu <18629099+marcoabreu@users.noreply.github.com>
2025-03-19 16:16:48 +01:00
Jean-Philippe Quéméner 3e3ab8e064
fix(unified-storage): reduce lock contention when pruning (#102425) 2025-03-19 12:15:04 +01:00
Jean-Philippe Quéméner 1700a8aa9f
feat(unified-storage): prune history table based on limits (#101970) 2025-03-17 11:36:38 +01:00
Georges Chaudy 3589baac68
Unistore: Batch write events (#101381)
* Batch write events

* Improve instrumentation

* Measure batch phases

* Detect lock contention

* remove the execBatch goroutine

* removing tracing prefix

* detect context cancel

* batch channel map
2025-03-13 10:24:12 +02:00
Will Assis f5e5824bab
fix (unified-storage): stop registering unified storage metrics in global state (#101322)
* move prometheus.register for unified storage metrics into metrics.go and do most of the plumbing to get it to work

* convert StorageApiMetrics to pointer and check for nil before using it

* rename type and variables to something more sensible

---------

Co-authored-by: Jean-Philippe Quéméner <jeanphilippe.quemener@grafana.com>
2025-02-28 07:39:39 -05:00
Ryan McKinley 806c043e45
UnifiedStorage: Rename Batch processing to Bulk (#101413) 2025-02-28 08:41:08 +03:00
Georges Chaudy 8c935c8f4a
[unistore] Add benchmark for write throughput (#101345)
* Add generic benchmark

* address comments
2025-02-26 17:17:35 +02: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
Jean-Philippe Quéméner 7be1fd953a
fix(unified-storage): enable in-process events for single-instance (#100807) 2025-02-21 12:25:35 +01:00
Peter Štibraný b4c4b9abbd
Remove embedded WriteEvent from WrittenEvent struct, to avoid having unnecessary fields. (#101081) 2025-02-20 17:34:25 +01:00
Georges Chaudy b1222be02e
unistore: add small buffer of watched events (#100431)
* change log level

* Add a small buffer when watching events
2025-02-14 12:18:59 +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
owensmallwood 3ba0d8d4b5
Unified Storage: Improve observability for indexing latency (#99700)
* adds extra debug logs and a new metric for poller query latency to help us better understand watch and index latency for write events

* adds trace span to the index for handling index write events
2025-01-28 12:30:20 -06:00
Stephanie Hingtgen 0cef2b9ae7
Dashboard Versions: Make compatible with app platform (#99327) 2025-01-28 08:17:52 -06:00
Ryan McKinley c4c934e0bd
SQL/Storage: Remove SkipDataMigration flag (#99404) 2025-01-23 12:34:48 +02:00
Ryan McKinley 9d30911107
SQL/Storage: Use xorm code migration for DeletionMarker (#99353) 2025-01-22 14:07:08 +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
Stephanie Hingtgen 8f6e9f8ed0
Restores in app platform (#97582) 2024-12-13 16:55:43 -06: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
Matheus Macabu f2b96593ea
SQL: close rows to release connection (#97147)
* SQL: close rows to release connection

* dont return err from rows.Close()
2024-11-28 14:28:55 +01: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
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 ecebaf1bdf
Unified Storage: Add traces to poller (#95369)
add traces to poller
2024-10-24 22:49:38 +03:00
Diego Augusto Molina 257aca5340
Unistore Chore: Fix span name (#94965)
fix span name
2024-10-24 12:12:20 -03: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
Diego Augusto Molina cf08f6762d
Unistore Chore: Add OTEL testing harness (#94835)
* add testing harness

* fix mockery and linters

* fix data race in tests

* fix data race in tests

* reduce cardinality of data
2024-10-17 08:41:06 -03:00
Georges Chaudy d999b415df
UniStore: Use epoch with microsecond resolution as RV (#92638)
* Use epoch with microsecond resolution as RV

* fix backend tests

* Add solution for when the clock goes back

* Add solution for when the clock goes back

* generate mocks

* go lint

* remove comment

* Use Greatest instead of max in msyql and postgres

* update tests

* Update pkg/storage/unified/sql/sqltemplate/dialect_sqlite.go

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

* cast to bigint

* add additional round trip

* increment the RV using 2 sql round trips instead of 3

* cleanup comments

* cast unix timestamp to integer

* fix postgres query

* remove old increment test data

* remove greatest

* cast unix_timestamp to signed

* Use statement_timestamp instead of clock_timestamp

---------

Co-authored-by: Diego Augusto Molina <diegoaugustomolina@gmail.com>
2024-10-11 12:11:33 +03:00
Diego Augusto Molina 4a800eda9f
Unistore Chore: add inocuous preparative changes for otel-based db observability (#94473)
add inocuous preparative changes for otel tracing
2024-10-09 20:32:09 +00: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
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
Georges Chaudy 216b63549d
unistore: fix watch events forever looping (#93517) 2024-09-20 15:51:09 +02:00
Diego Augusto Molina e788df921c
Storage: always use transactions and make them readonly when possible (#92110)
* always use transactions and make them readonly when possible

* fix linters

* fix reference
2024-08-20 09:29:06 -03:00
Ryan McKinley f432a1713b
SQLTemplate: Swap the IFace with the concrete struct (#92008) 2024-08-16 15:12:37 +03:00
Ryan McKinley d9cabe5e14
SQL: Add sql template test helper (#91953) 2024-08-16 14:36:56 +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
Georges Chaudy e4ed000d05
ResourceStore: Fix sql List (#91043)
* fix resource list

* ensure we get the resource version without FOR SHARE
2024-07-26 13:56:24 +02:00
Georges Chaudy 4baca6947d
ResourceServer: make the resource store the default unified storage backend (#90899)
* make the resource store the default unified storage backend

* add integration tests

* fix test non passing

* Update pkg/storage/unified/sql/test/integration_test.go

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>

* lint

* fix tests

* fix no rows

---------

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2024-07-25 18:17:39 +02: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