unified-storage: setup ring to shard requests (#103783)
* Updates the instrumentation_server service to use mux instead of the builtin router, and have it store the router in the module server: this is so we can register the /ring endpoint to check the status of the ring * Create a new Ring service that depends on the instrumentation server and declares it as a dependency for the storage server * Create standalone MemberlistKV service for Ring service to use * Update the storage server Search and GetStats handler to distribute requests if applicable
This commit is contained in:
@@ -21,7 +21,7 @@ import (
|
||||
func NewResourceServer(db infraDB.DB, cfg *setting.Cfg,
|
||||
tracer trace.Tracer, reg prometheus.Registerer, ac types.AccessClient,
|
||||
searchOptions resource.SearchOptions, storageMetrics *resource.StorageMetrics,
|
||||
indexMetrics *resource.BleveIndexMetrics, features featuremgmt.FeatureToggles) (resource.ResourceServer, error) {
|
||||
indexMetrics *resource.BleveIndexMetrics, features featuremgmt.FeatureToggles, distributor *resource.Distributor) (resource.ResourceServer, error) {
|
||||
apiserverCfg := cfg.SectionWithEnvOverrides("grafana-apiserver")
|
||||
opts := resource.ResourceServerOptions{
|
||||
Tracer: tracer,
|
||||
@@ -68,6 +68,7 @@ func NewResourceServer(db infraDB.DB, cfg *setting.Cfg,
|
||||
opts.Lifecycle = store
|
||||
opts.Search = searchOptions
|
||||
opts.IndexMetrics = indexMetrics
|
||||
opts.Distributor = distributor
|
||||
|
||||
rs, err := resource.NewResourceServer(opts)
|
||||
if err != nil {
|
||||
|
||||
@@ -60,6 +60,8 @@ type service struct {
|
||||
indexMetrics *resource.BleveIndexMetrics
|
||||
|
||||
docBuilders resource.DocumentBuilderSupplier
|
||||
|
||||
distributor *resource.Distributor
|
||||
}
|
||||
|
||||
func ProvideUnifiedStorageGrpcService(
|
||||
@@ -71,6 +73,7 @@ func ProvideUnifiedStorageGrpcService(
|
||||
docBuilders resource.DocumentBuilderSupplier,
|
||||
storageMetrics *resource.StorageMetrics,
|
||||
indexMetrics *resource.BleveIndexMetrics,
|
||||
distributor *resource.Distributor,
|
||||
) (UnifiedStorageGrpcService, error) {
|
||||
tracer := otel.Tracer("unified-storage")
|
||||
|
||||
@@ -98,6 +101,7 @@ func ProvideUnifiedStorageGrpcService(
|
||||
docBuilders: docBuilders,
|
||||
storageMetrics: storageMetrics,
|
||||
indexMetrics: indexMetrics,
|
||||
distributor: distributor,
|
||||
}
|
||||
|
||||
// This will be used when running as a dskit service
|
||||
@@ -117,7 +121,7 @@ func (s *service) start(ctx context.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
server, err := NewResourceServer(s.db, s.cfg, s.tracing, s.reg, authzClient, searchOptions, s.storageMetrics, s.indexMetrics, s.features)
|
||||
server, err := NewResourceServer(s.db, s.cfg, s.tracing, s.reg, authzClient, searchOptions, s.storageMetrics, s.indexMetrics, s.features, s.distributor)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ func TestClientServer(t *testing.T) {
|
||||
|
||||
features := featuremgmt.WithFeatures()
|
||||
|
||||
svc, err := sql.ProvideUnifiedStorageGrpcService(cfg, features, dbstore, nil, prometheus.NewPedanticRegistry(), nil, nil, nil)
|
||||
svc, err := sql.ProvideUnifiedStorageGrpcService(cfg, features, dbstore, nil, prometheus.NewPedanticRegistry(), nil, nil, nil, nil)
|
||||
require.NoError(t, err)
|
||||
var client resource.ResourceStoreClient
|
||||
|
||||
|
||||
Reference in New Issue
Block a user