* Pass prometheus registerer to the dual writer
* Fix tests
* Remove unused var
* Fix tests
* Uncomment test
* Remove leading line
* Fix tests. Reuse registerer if there's already one
* Lint
* Improve double registering logic
* Rebase main
* Add and fix tests for playlists in mode1
* Make etcd tests pass mode1 for now
* Fix mode1 and add more tests for playlists in mode 1
* Remove repeated test
* Fix test setup
* chore: A few updates for the pkg/build/wire fork
Signed-off-by: Dave Henderson <dave.henderson@grafana.com>
* chore: run go work sync
Signed-off-by: Dave Henderson <dave.henderson@grafana.com>
---------
Signed-off-by: Dave Henderson <dave.henderson@grafana.com>
- Adds a find endpoint to return dashboard bindings that match any of the scopes. For example /apis/scope.grafana.app/v0alpha1/namespaces/default/find/scope_dashboard_bindings?scope=s1&scope=s2
- Updates the ScopeNode find endpoint to a new path, /find/scope_node_children , makes the key "items" for all find endpoints (instead of mix of "found" and "items"), and makes the list item type a ScopeNode instead of its own type.
- Updates kubectl get commands to return more information about scopes, scopenodes, and scopedashboard bindings to display more fields in table output
---------
Signed-off-by: bergquist <carl.bergquist@gmail.com>
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
Co-authored-by: Kyle Brandt <kyle@grafana.com>
Co-authored-by: Todd Treece <todd.treece@grafana.com>
* Also call storage on mode1. Add metrics
* Update comment
* Don't use compare function for now
* Remove very important space
* Improve code readability on modes 1 and 2
* Fix tests
* Return error from legacy write
* Renume useless defer
* Start adding logging for mode2
* Retrurn errors is storage read fails
* Finish adding latency metrics to mode2
* Emit kind to metrics instead
* Fix var name
* Return if legacy delete list fails
* Unify latency calls
* Fix get function
* Prometheus: Update dependency to v0.52.0
* go work sync
* fix panics in tests
* go work sync
* prometheus v0.52.0
* handle errors
* Update pkg/services/ngalert/sender/sender_test.go
Co-authored-by: Santiago <santiagohernandez.1997@gmail.com>
* Update pkg/services/ngalert/sender/sender_test.go
Co-authored-by: Santiago <santiagohernandez.1997@gmail.com>
---------
Co-authored-by: Santiago <santiagohernandez.1997@gmail.com>
Co-authored-by: ismail simsek <ismailsimsek09@gmail.com>
* Extract returned object hydration into function
* Finish writing tests for utils func
* Lint
* Update pkg/apiserver/rest/dualwriter_mode2.go
Co-authored-by: Arati R. <33031346+suntala@users.noreply.github.com>
* Better var naming
* Remove duplicated logic
* Lint
* Fix test
* Lint
* Make type private
* Fix one more test
* Fix test
---------
Co-authored-by: Arati R. <33031346+suntala@users.noreply.github.com>
* Add skeleton implementation for mode reconciliation between 1 and 2
* Track mode for each dual writer
* Add test for setting dual writer
* Include context when setting dual writing mode
---------
Co-authored-by: Dan Cech <dcech@grafana.com>
* Also call storage on mode1. Add metrics
* Update comment
* Don't use compare function for now
* Remove very important space
* Finish add logging in mode2.
Also call US in mode1 in a non blocking way
* Improve code readability on modes 1 and 2
* Fix tests
* Rename vars
* Lint
* Return error from legacy write
* Renume useless defer
* [REVIEW] improvements
* Pass kind instead of name
* Use kind instead of name in metrics
* Only call latency metrics once
* Return error on writes to legacystore in mode1
* Move accesssor logic into the goroutine as well
* Add feature toggles for mode 2 and 3 playlist dual writing
* Make current mode customised based on kind
* Check feature flags when initialising dual writer
* Fix linting
* Refactor NewDualWriter
* 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>
* 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>
* 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
* 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>
* 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
* 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>
* 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>
Fixes so that auth middleware trace/span doesn't wrap the next handlers.
Allow tracing service name to be overridden in standalone apiserver.
Change k8s api tracing operation name to KubernetesAPI from
grafana-apiserver (which is the service name)