grafana/pkg/infra
Kristin Laemmert 50244ed4a1
Experimental Feature Toggle: databaseReadReplica (#89232)
This adds a version of the SQLStore that includes a ReadReplica. The primary DB can be accessed directly - from the caller's standpoint, there is no difference between the SQLStore and ReplStore unless they wish to explicitly call the ReadReplica() and use that for the DB sessions.

Currently only the stats service GetSystemStats and GetAdminStats are using the ReadReplica(); if it's misconfigured or if the databaseReadReplica feature flag is not turned on, it will fall back to the usual (SQLStore) behavior.

Testing requires a database and read replica - the replication should already be configured. I have been testing this locally with a docker mysql setup (https://medium.com/@vbabak/docker-mysql-master-slave-replication-setup-2ff553fceef2) and the following config:

[feature_toggles]
databaseReadReplica = true

[database]
type = mysql
name = grafana
user = grafana
password = password
host = 127.0.0.1:3306

[database_replica]
type = mysql
name = grafana
user = grafana
password = password
host = 127.0.0.1:3307
2024-06-18 11:07:15 -04:00
..
appcontext Chore: Move identity and errutil to apimachinery module (#89116) 2024-06-13 07:11:35 +03:00
db Experimental Feature Toggle: databaseReadReplica (#89232) 2024-06-18 11:07:15 -04:00
filestorage chore: Updating linter, fixing some new warnings (#88863) 2024-06-06 13:01:27 -04:00
fs Chore: Upgrade Go to 1.19.1 (#54902) 2022-09-12 12:03:49 +02:00
httpclient Datasources: Enable native histograms for datasource response size metric (#87962) 2024-05-16 13:48:51 +02:00
kvstore Chore: Update test database initialization (#81673) 2024-02-09 09:35:39 -05:00
localcache Migrate to Wire for dependency injection (#32289) 2021-08-25 15:11:22 +02:00
log chore(perf): Pre-allocate where possible (enable prealloc linter) (#88952) 2024-06-14 14:16:36 -04:00
metrics Metrics: Prevent duplicates in MultiRegistry (#85880) 2024-04-10 10:55:24 -04:00
network Backend: fix IPv6 address parsing erroneous (#28585) 2020-11-25 07:55:22 +01:00
process PluginsCatalog: adding error information about disabled plugins. (#39171) 2021-09-20 09:08:00 +02:00
remotecache Chore: Make Cfg field private in SQLStore (#85593) 2024-04-24 10:38:40 +02:00
serverlock Better tracing during extSvcAcc registration (#84719) 2024-03-21 16:41:10 +01:00
slugify Slug: Combine various slugify fixes for special character handling (#73164) 2023-08-10 16:12:50 -04:00
tracing Chore: Move identity and errutil to apimachinery module (#89116) 2024-06-13 07:11:35 +03:00
usagestats Experimental Feature Toggle: databaseReadReplica (#89232) 2024-06-18 11:07:15 -04:00