grafana/pkg/server
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
..
doc.go feat: add ability to launch targeted dskit modules in the grafana server CLI command (#74188) 2023-09-01 08:09:54 -04:00
instrumentation_service_test.go VSCode: Launch Grafana with Storage server (#88351) 2024-05-29 10:02:35 +02:00
instrumentation_service.go VSCode: Launch Grafana with Storage server (#88351) 2024-05-29 10:02:35 +02:00
module_runner.go feat: add ability to launch targeted dskit modules in the grafana server CLI command (#74188) 2023-09-01 08:09:54 -04:00
module_server_test.go VSCode: Launch Grafana with Storage server (#88351) 2024-05-29 10:02:35 +02:00
module_server.go Zanzana: Initial work to run openFGA as embedded or standalone service (#89211) 2024-06-18 10:04:18 +02:00
runner.go Chore: Unite wire graphs for cli and server (#61143) 2023-03-17 16:36:39 +01:00
server_test.go K8s: Refactor metrics to share k8s registry (#79106) 2023-12-06 16:34:23 -05:00
server.go K8s: Refactor metrics to share k8s registry (#79106) 2023-12-06 16:34:23 -05:00
service.go feat: add ability to launch targeted dskit modules in the grafana server CLI command (#74188) 2023-09-01 08:09:54 -04:00
test_env.go Experimental Feature Toggle: databaseReadReplica (#89232) 2024-06-18 11:07:15 -04:00
wire.go Experimental Feature Toggle: databaseReadReplica (#89232) 2024-06-18 11:07:15 -04:00
wireexts_oss.go K8s: Refactor standalone apiserver initialization (#81932) 2024-02-06 08:40:35 -08:00