541 Commits

Author SHA1 Message Date
3f502f305d Chore: Update mocks with recent mockery (#107816) 2025-07-09 09:15:34 +02:00
66d9a33cc9 Datasources: Update grafana-aws-sdk for new sigv4 middleware and aws-sdk-go v1 removal (#107522)
Datasources: Update grafana-aws-sdk
2025-07-03 17:48:57 +02:00
f66a693438 Chore: Rename integration tests to follow the common convention (#105987)
* automatically rename integration tests to follow the common convention

* name tests differently

* alter column type to bigint

* update another column to bigint

* add another alter

* fix subquery for mysql
2025-06-29 16:56:24 +02:00
2afcb0e95b Data Sources: Fix namespace (#107124)
Fix namespace
2025-06-24 15:40:27 +01:00
f4e4ba6f19 Library elements: Remove ability to set as "library variable" (#106594) 2025-06-12 08:41:18 -05:00
b4cd51810b SecretsManager: Various utils for usage insights, outbox and secretkeeper (#106010)
* SecretsManager: utils for usage insights on ST mode

Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com>

* SecretsManager: add assert

Co-authored-by: PoorlyDefinedBehaviour <brunotj2015@hotmail.com>

* SecretsManager: Remove encryption scope option

Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com>

* SecretsManager: add fake keeper

Co-authored-by: Dana Axinte <53751979+dana-axinte@users.noreply.github.com>
Co-authored-by: PoorlyDefinedBehaviour <brunotj2015@hotmail.com>
Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com>

---------

Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com>
Co-authored-by: PoorlyDefinedBehaviour <brunotj2015@hotmail.com>
2025-05-28 12:46:54 +01:00
c4d3eb1cd0 Remove support for Google Spanner database. (#105846)
* Remove support for Google Spanner database.
2025-05-23 11:35:59 +02:00
8f79e4882f Replace usage of http.DefaultClient and http.DefaultTransport (#104135)
Remove usage of http.DefaultClient and http.DefaultTransport

Part of grafana/data-sources#484
2025-05-09 13:26:39 -04:00
694b9dfe50 Chore: Replace xorm.io/xorm imports (#104458)
* replace xorm.io/xorm imports

* replace xorm from other go.mod files

* clean up workspace

* nolint does not make sense anymore as it is not a module

* try if nolint directive helps

* use nolint:all for xorm

* add more nolints

* try to skip xorm in linter config

* exclude xorm differently

* retrigger ci
2025-05-02 17:13:01 +02:00
35145801a2 Data Sources: Add gauge for response size (#104394) 2025-04-24 13:26:28 +01:00
047f5edae9 Chore: Add xorm.io/core into xorm (#103700)
* add xorm.io/core into xorm

* update workspace

* format imports

* update workspace
2025-04-16 08:58:50 +02:00
fd6fd91115 Prometheus: Add support for cloud partners Prometheus data sources (#103482)
* wip

* Add prom flavor support for data source variables and export/import dashboards (#103321)

* add dashboard and data source var selection

* use match plugin id instead

* use updated matchpluginid

* formatting

* cleanup

* regex anchor

* update error msg

* Alerting: Clean up prometheus-flavored types and functions (#103703)

* clean up types and utility functions for dealing with
prometheus-flavored data sources

* Refactor alerting datasource types to use constants as source of truth

* Alerting: Clean up prometheus-flavored types and functions on the bac… (#103716)

Alerting: Clean up prometheus-flavored types and functions on the backend

* add matchPluginId tests

* Update matchPluginId func to bidirectional (#103746)

* update matchpluginid func to bidirectional

* lint

* formatting

* use actual isSupportedExternalRulesSourceType in test

* add tests in datasource_srv

* betterer

* remove type assertion

* remove unnecessary case

* use satisifies to not have to convert tuple to an array of string

* add prometheus_flavor test

---------

Co-authored-by: Andrew Hackmann <5140848+bossinc@users.noreply.github.com>
Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
Co-authored-by: Alexander Akhmetov <me@alx.cx>
2025-04-10 12:49:11 -07:00
757be6365a CI: Bump golangci-lint to 2.0.2 (#103572) 2025-04-10 14:42:23 +02:00
89c70fcdcf Chore: Advisor stats (#103711) 2025-04-10 10:51:00 +02:00
2d89b16d7e Tracing: Add Insecure to NewOTLPTracingConfig (#103174) 2025-04-01 17:34:42 +02:00
7aa71aa734 Tracing: chore make insecure option configurable (#99236)
* Tracing: chore: make insecure option configurable

In case of insecure set to false, default system cert pool will be used to create otlpgrpc client.

* test: add tracing/insecure config checks

This is to verify whether insecure configuration is properly parsed.

* chore: update configura Grafana docs with new setting

* chore: also update comment in the ini files

---------

Co-authored-by: Matheus Macabu <macabu.matheus@gmail.com>
2025-03-27 12:37:23 -04:00
5b5f433a26 spanner: Disable running alerting integration tests when using spanner. (#102730)
* Disable running alerting integration tests when using spanner.

* Disable tests for templategroup.
2025-03-26 10:57:55 +01:00
ebddc79780 Stats: Propagate context when listing sandbox plugins (#102207) 2025-03-19 15:29:30 +01:00
0bafd4e99d unistore: update spanner ddl to include unistore tables (#102198)
* provision unistore tables

* update the tests to use generated namespace

* update ddl

* update ddl

* clean streams

* missing space

* use engine.db.query
2025-03-18 14:37:11 +01:00
848d49e70f Chore: Add username option for redis remote cache (#101787)
* Chore: Add username option for redis remote cache

(cherry picked from commit 25e28dc85e646e8cb7ab9ab582de8fb247b58b07)

* Chore: Update docs and config with sample Redis conn with user+pass

---------

Co-authored-by: Thomas Fournier <tfournier@evolves.fr>
2025-03-12 08:26:41 +01:00
fa809ac417 Fix more LastInsertId calls (#101892)
* Fix more places where LastInsertId is used without proper directive for Spanner.

* Fix tests.
2025-03-11 09:03:03 +01:00
fd6a4908f1 Support Spanner's UNION syntax, which needs to be UNION DISTINCT or UNION ALL. (#101768)
* Support Spanner's UNION syntax, which needs to be UNION DISTINCT or UNION ALL.
2025-03-10 12:33:52 +01:00
9eaaf95701 Hackaton 12: Add some unit tests, take 1 (#101457)
* tsdb/graphite: add happy path test for QueryData

* infra/httpclient/httpclientprovider: add tests for RedirectLimitMiddleware
2025-02-28 16:11:11 +02:00
55aaf4aac0 Metrics: Add deny list in MultiRegistry (#101010) 2025-02-19 23:11:26 +02:00
5a74a1a0f6 Metrics: Use correct gatherer in graphite bridge (#100624) 2025-02-13 10:19:22 -05:00
a066659e11 Frontend Sandbox: Add to statscollector (#99735) 2025-01-30 16:17:36 +01:00
baaff6296f Logging: Use slog adapter for go-kit/log with App SDK logger (#99740)
* feat: use slog adapter for go-kit/log

The adapter library is Apache-2.0, which is compatible with AGPL-3.0 as a dependency.

The adapter library outputs a little more info than we'd like, but rather a couple fields too many than it outputting
ERROR logs as INFO.

* feat: update dependencies

* chore: attribute ownership of dependency

* refactor: move require

* chore: make update-workspace
2025-01-29 14:59:37 +01:00
d192a44469 Plugins: Modify interface for plugin validations to allow taking PDC into account (#96089)
* Request interceptor: Do not block PDC

* Apply change after feedback received

* Add test

* Check if secure socks proxy configured for the instance

* Apply suggestions from code review

* Add dedicated service for datasource request URL validation (#99179)

---------

Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
2025-01-24 17:01:46 +02:00
e019e34eb5 Stats: use dashboard stats rather than list (#99130) 2025-01-17 08:19:56 +03:00
36d6fad421 Feat: Setup the App SDK logging module (#98927)
* Feat: Setup the App SDK logging module

* Build: Depend on logging pkg and update App SDK

* Chore: Assign owner to logging module
2025-01-14 10:34:57 +01:00
cbb688e910 Zanzana: Remove usage from legacy access control (#98883)
* Zanzana: Remove usage from legacy access control

* remove unused

* remove zanzana client from services where it's not used

* remove unused metrics

* fix linter
2025-01-14 10:26:15 +01:00
ce512862f7 Stats: remove dependency on dashboards and folders (#98653) 2025-01-08 06:57:52 -06:00
Jo
40d3b02648 Auth: Separate anonymous settings to its own struct (#97791)
separate anonymous settings to its own struct
2024-12-13 10:46:27 +01:00
6c8c0ab350 Chore: Ignore duplicate process_* metrics in MultiRegistry (#97857) 2024-12-12 16:55:09 +02:00
d85353926d Metrics: Export multi registry (#97662)
* export multi registry

* fixup
2024-12-12 09:48:27 +00:00
ced7a84f8b chore(metrics): Add metrics & traces to DB migration (#97181)
Signed-off-by: Dave Henderson <dave.henderson@grafana.com>
2024-12-05 17:22:19 -05:00
89e7e25b60 Backend: Inject server-timing header to match initial loads with client-side telemetry (#94978)
feat: inject server-timing header to match initial loads with client-side telemetry

Faro Web SDK can read the server-timing info and
correlate the initial request with the client side telemetry gather from navigation timings.
2024-11-19 10:01:58 +02:00
b87c76ad21 Plugins: Add metric to track plugin backend target (#95976)
* add metric to track plugin backend target

* tidy

* fix test
2024-11-07 12:01:46 +00:00
ab974ddf14 ServerLock: Fix pg concurrency/locking issue (#95916)
Fix pg unique constraint validation in serverlock
2024-11-06 09:47:32 +01:00
Jo
ddf766567b RemoteCache: Refactor remote cache settings (#95672)
* refactor remote cache settings

* fix cache error getting treating as application error

* fix cache error getting treating as application error
2024-11-04 17:35:31 +01:00
fe74dfcb77 Logging: Add error logging to syslog (#95525) 2024-10-29 06:57:15 -05:00
b28085110d Plugins: Auto instrumentation improvements (#94193) 2024-10-15 14:02:34 +02:00
658c79e1d5 Chore: fix initialization data race in infra usagestats (#94070)
fix initialization data race in usagestats
2024-10-02 07:30:44 -03:00
a21a232a8e Revert read replica POC (#93551)
* Revert "chore: add replDB to team service (#91799)"

This reverts commit c6ae2d7999aa6fc797db39e9d66c6fea70278f83.

* Revert "experiment: use read replica for Get and Find Dashboards (#91706)"

This reverts commit 54177ca619dbb5ded2dcb158405802d8dbdbc982.

* Revert "QuotaService: refactor to use ReplDB for Get queries (#91333)"

This reverts commit 299c142f6a6e8c5673cfdea9f87b56ac304f9834.

* Revert "refactor replCfg to look more like plugins/plugin config (#91142)"

This reverts commit ac0b4bb34d495914cbe8daad85b7c75c31e8070d.

* Revert "chore (replstore): fix registration with multiple sql drivers, again (#90990)"

This reverts commit daedb358dded00d349d9fac6106aaaa6bf18322e.

* Revert "Chore (sqlstore): add validation and testing for repl config (#90683)"

This reverts commit af19f039b62d9945377292a8e679ee258fd56b3d.

* Revert "ReplStore: Add support for round robin load balancing between multiple read replicas (#90530)"

This reverts commit 27b52b1507f5218a7b38046b4d96bc004d949d46.

* Revert "DashboardStore: Use ReplDB and get dashboard quotas from the ReadReplica (#90235)"

This reverts commit 8a6107cd35f6444c0674ee4230d3d6bcfbbd4a58.

* Revert "accesscontrol service read replica (#89963)"

This reverts commit 77a4869fcadf13827d76d5767d4de74812d6dd6d.

* Revert "Fix: add mapping for the new mysqlRepl driver (#89551)"

This reverts commit ab5a079bcc5b0f0a6929f0a3742eb2859d4a3498.

* Revert "fix: sql instrumentation dual registration error (#89508)"

This reverts commit d988f5c3b064fade6e96511e0024190c22d48e50.

* Revert "Experimental Feature Toggle: databaseReadReplica (#89232)"

This reverts commit 50244ed4a1435cbf3e3c87d4af34fd7937f7c259.
2024-09-25 15:21:39 -08:00
aac66e9119 Slugs: use shorter slug fallback (#93081) 2024-09-10 09:04:23 +03:00
85759da360 Tracing: Add Start helper (#93052) 2024-09-06 13:02:17 -04:00
abca0380a8 use count_bytes_reader from plugin-sdk-go (#92553)
* use count_bytes_reader from plugin-sdk-go

* run `make update-workspace`

* update postgres tests

* update mysql tests

* time back to utc

* make update-workspace done

---------

Co-authored-by: Kyle Brandt <kyle@grafana.com>
2024-08-28 16:44:13 +02:00
df3d8915ba Chore: Bump Go to 1.23.0 (#92105)
* chore: Bump Go to 1.23.0

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>

* update swagger files

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>

* chore: update .bingo/README.md formatting to satisfy prettier

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>

* chore(lint): Fix new lint errors found by golangci-lint 1.60.1 and Go 1.23

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>

* keep golden file

* update openapi

* add name to expected output

* chore(lint): rearrange imports to a sensible order

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>

---------

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2024-08-21 11:40:42 -04:00
9020eb4b17 Auth: Update oauthtoken service to use remote cache and server lock (#90572)
* update oauthtoken service to use remote cache and server lock

* remove token cache

* retry is lock is held by an in-flight refresh

* refactor token renewal to avoid race condition

* re-add refresh token expiry cache, but in SyncOauthTokenHook

* Add delta to the cache ttl

* Fix merge

* Change lockTimeConfig

* Always set the token from within the server lock

* Improvements

* early return when user is not authed by OAuth or refresh is disabled

* Allow more time for token refresh, tracing

* Retry on Mysql Deadlock error 1213

* Update pkg/services/authn/authnimpl/sync/oauth_token_sync.go

Co-authored-by: Dan Cech <dcech@grafana.com>

* Update pkg/services/authn/authnimpl/sync/oauth_token_sync.go

Co-authored-by: Dan Cech <dcech@grafana.com>

* Add settings for configuring min wait time between retries

* Add docs for the new setting

* Clean up

* Update docs/sources/setup-grafana/configure-grafana/_index.md

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>

---------

Co-authored-by: Mihaly Gyongyosi <mgyongyosi@users.noreply.github.com>
Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
2024-08-19 18:57:37 +02:00
299c142f6a QuotaService: refactor to use ReplDB for Get queries (#91333)
* Feature (quota service): Use ReplDB for quota service Gets

This adds the replDB to the quota service, as well as some more test helper functions to simplify updating tests. My intent is that the helper functions can be removed when this is fully rolled out (or not) and we're consistently using the ReplDB interface (or not!)

* test updates
2024-08-08 13:41:33 -04:00