Commit Graph

72 Commits

Author SHA1 Message Date
Leonor Oliveira
fd44f2ee4f
Init dualwriter metrics (#89003)
* 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
2024-06-14 11:01:49 +02:00
Will Browne
74230937f4
Plugins: Update plugin SDK Go to 0.235.0 (#89153)
update plugin SDK go to 0.235.0
2024-06-13 15:14:39 +02:00
Gabriel MABILLE
afcb5a855c
AuthZ: embed an authorization server (#89018)
* AuthZ: embed an authorization server

* CODEOWNERS

* Remove swagger

* WIP

* Flatten structure and inject wireset

* sync mod files

* Rename authorization package

* Fix swagger gen

* CODEOWNERS

* Use itf instead of impl

---------

Co-authored-by: Karl Persson <kalle.persson@grafana.com>
2024-06-13 11:41:35 +02:00
Ryan McKinley
3ae95a6eb1
K8s: Update grafana resource metadata accessor (#89074) 2024-06-12 14:39:37 +03:00
Leonor Oliveira
b30c81b1ad
Add and fix tests for playlists in mode1 (#88543)
* 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
2024-06-10 16:11:01 +02:00
Todd Treece
22989acf95
K8s: Improve response writer error handling (#88926)
---------

Co-authored-by: Diego Augusto Molina <diegoaugustomolina@gmail.com>
2024-06-07 16:10:02 -04:00
Isabella Siu
cd15e9732d
Cloudwatch: Use the metric map from grafana-aws-sdk (#88733) 2024-06-06 21:25:54 +03:00
Dave Henderson
ca1379bad3
chore: A few updates for the pkg/build/wire fork (#88813)
* 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>
2024-06-06 16:09:27 +03:00
Marcus Efraimsson
2403665998
Chore: Remove legacydata package (#88790)
* Chore: Remove legacydata package

* remove unused dependency

* sdk v0.234.0
2024-06-05 22:31:06 +02:00
Carl Bergquist
16cc75b02c
Scopes: Add Handler for returning dashboards related to a list of scopes. (#87758)
- 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>
2024-06-05 11:47:36 -04:00
Arati R
36f42853dd
Storage: Read desired mode from config instead of feature flags (#88353)
* Read desired mode from config
* Update playlist integration tests
* Add mode 1 playlist integration tests
* Add mode 0 dual writing to playlist integration tests
* Add documentation for the different dual writing modes
2024-05-31 19:29:59 +02:00
Leonor Oliveira
ade96dbdbd
Introduce Comparator interface (#88016)
* Introduce Comparator interface

* Add compare implementation everywhere

* Add comment explaining what Compare should do

* Lint
2024-05-29 09:42:24 +02:00
Leonor Oliveira
ef07dfa3bb
Add latency metrics to mode2 (#88011)
* 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
2024-05-28 16:15:53 +02:00
Kyle Brandt
a738cb42d8
Prometheus: Update dependency to v0.52.0 (#87809)
* 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>
2024-05-28 15:22:20 +02:00
Leonor Oliveira
502bd5612e
Storage: Extract returned object hydration into function (#88012)
* 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>
2024-05-28 15:14:27 +02:00
Giuseppe Guerra
2b54ce6c51
Chore: Bump google.golang.org/grpc to 1.64.0 (#88219)
* Bump google.golang.org/grpc to 1.64.0

* Address grpc.Dial deprecation notices

* go mod tidy

* Update go.work.sum

* go work sync
2024-05-27 12:44:39 +02:00
Ryan McKinley
ffc2702552
Plugins: Support Admission validation hooks (#87718) 2024-05-24 18:45:16 +03:00
Arati R
0ffc4c441b
Storage: Add mode reconciliation for modes 1 and 2 (#87919)
* 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>
2024-05-23 00:12:46 +02:00
Scott Lepper
cac40795a5
sql expressions - logging (#88193)
* sql expressions - logging
2024-05-22 17:18:46 -04:00
Marcus Efraimsson
8ea0b336d5
API Server: Include traceID in HTTP request logs (#88179) 2024-05-22 17:56:34 +02:00
Leonor Oliveira
dd771e818e
Also call storage on mode1. Measure latency (#87739)
* 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
2024-05-22 10:23:29 +02:00
Arati R
6836bfe1ea
Storage: Customise setting dual writing modes (#87668)
* 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
2024-05-14 14:11:56 +02:00
Andres Martinez Gotor
ae152af119
Upgrade grafana-plugin-sdk-go to v0.230.0 (#87706) 2024-05-13 13:23:30 +02:00
Leonor Oliveira
b214f9cc3a
Add metrics utils to the dualwriter (#87693)
* Add metrics utils

* Ignore lint temporarily

* Lint
2024-05-13 11:36:24 +02: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
Stephanie Hingtgen
1bc6738d92
Chore: Upgrade go from 1.21.0 to 1.21.10 (#87479) 2024-05-09 15:57:08 +03: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
f342217158
K8s: Add path rewriter filter (#87456) 2024-05-08 18:08:43 +03: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
Karl Persson
2d8570e85e
IDToken: Reuse claims from authlib (#87437)
* bump authlib version

* Reuse claims from authlib
2024-05-07 16:46:43 +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
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
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
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
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
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
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
George Robinson
c049e5bbfc
Alerting: Update grafana/alerting to bb4f4f4 (#86827) 2024-04-25 10:47:01 +01: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
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
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
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
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
Arati R
aba15646b6
Storage: Add DualWriter improvements (#85968)
* Add Create tests
* Adjust mode 2 and mode 3 Get behavior

---------

Co-authored-by: Dan Cech <dcech@grafana.com>
2024-04-12 14:21:10 +02:00
Gábor Farkas
050105e70a
plugins: update to latest go plugin sdk version (v0.222.0) (#85943)
plugins: update to latest go plugink sdk (v0.222.0)
2024-04-11 14:41:37 +02:00
Arati R
4e532b00e1
Storage: Add mode-specific List implementations (#85814)
* Add List methods to mode 1 and 4
* Refactor errors
2024-04-11 13:41:05 +02:00
Marcus Efraimsson
3e385763c5
Tracing: Improve HTTP request/middleware spans and standalone apiserver (#85715)
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)
2024-04-11 13:28:23 +02:00
Todd Treece
72472e5eb7
K8s: Add slog wrapper (#84680) 2024-04-09 18:39:25 +03:00