mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Unified Storage Search: Add sprinkles (#97820)
* Wire up sprinkles to oss and enterprise. Fetching sprinkles not implemented yet. * Adds wireset for initializing document builders. Had to init it when creating the service to avoid cyclical imports. * updates to int64 for stats * adds config for sprinklesApiServer and gets sprinkles from there when its present * add comment for later * adds feature toggle for sprinkles. returns empty results when flag not enabled. * adds unified storage config setting for sprinkles apiserver page limit * fixes bug where dashboard uid was not getting set * when creating dashboard summary, use metadata.name as the dashboard uid * cleans up wire. use existing oss and enterprise sets to generate doc builders * remove old wireset * fix linter - adds missing arg for doc builders * update dashboard stats in tests * updates test-data dashboards * log a warning instead of returning an error if we can't get sprinkles for a namespace * dont read uid from dashboard json
This commit is contained in:
parent
54e603e552
commit
4837585cab
@ -220,6 +220,7 @@ export interface FeatureToggles {
|
|||||||
useSessionStorageForRedirection?: boolean;
|
useSessionStorageForRedirection?: boolean;
|
||||||
rolePickerDrawer?: boolean;
|
rolePickerDrawer?: boolean;
|
||||||
unifiedStorageSearch?: boolean;
|
unifiedStorageSearch?: boolean;
|
||||||
|
unifiedStorageSearchSprinkles?: boolean;
|
||||||
pluginsSriChecks?: boolean;
|
pluginsSriChecks?: boolean;
|
||||||
unifiedStorageBigObjectsSupport?: boolean;
|
unifiedStorageBigObjectsSupport?: boolean;
|
||||||
timeRangeProvider?: boolean;
|
timeRangeProvider?: boolean;
|
||||||
|
@ -131,7 +131,11 @@ func (s *ModuleServer) Run() error {
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
m.RegisterModule(modules.StorageServer, func() (services.Service, error) {
|
m.RegisterModule(modules.StorageServer, func() (services.Service, error) {
|
||||||
return sql.ProvideUnifiedStorageGrpcService(s.cfg, s.features, nil, s.log, nil)
|
docBuilders, err := InitializeDocumentBuilders(s.cfg)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return sql.ProvideUnifiedStorageGrpcService(s.cfg, s.features, nil, s.log, nil, docBuilders)
|
||||||
})
|
})
|
||||||
|
|
||||||
m.RegisterModule(modules.ZanzanaServer, func() (services.Service, error) {
|
m.RegisterModule(modules.ZanzanaServer, func() (services.Service, error) {
|
||||||
|
@ -8,6 +8,7 @@ package server
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/google/wire"
|
"github.com/google/wire"
|
||||||
|
"github.com/grafana/grafana/pkg/storage/unified/resource"
|
||||||
|
|
||||||
sdkhttpclient "github.com/grafana/grafana-plugin-sdk-go/backend/httpclient"
|
sdkhttpclient "github.com/grafana/grafana-plugin-sdk-go/backend/httpclient"
|
||||||
|
|
||||||
@ -229,7 +230,6 @@ var wireBasicSet = wire.NewSet(
|
|||||||
wire.Bind(new(login.AuthInfoService), new(*authinfoimpl.Service)),
|
wire.Bind(new(login.AuthInfoService), new(*authinfoimpl.Service)),
|
||||||
authinfoimpl.ProvideStore,
|
authinfoimpl.ProvideStore,
|
||||||
datasourceproxy.ProvideService,
|
datasourceproxy.ProvideService,
|
||||||
unifiedsearch.ProvideDocumentBuilders,
|
|
||||||
search.ProvideService,
|
search.ProvideService,
|
||||||
searchV2.ProvideService,
|
searchV2.ProvideService,
|
||||||
searchV2.ProvideSearchHTTPService,
|
searchV2.ProvideSearchHTTPService,
|
||||||
@ -475,3 +475,8 @@ func InitializeAPIServerFactory() (standalone.APIServerFactory, error) {
|
|||||||
wire.Build(wireExtsStandaloneAPIServerSet)
|
wire.Build(wireExtsStandaloneAPIServerSet)
|
||||||
return &standalone.NoOpAPIServerFactory{}, nil // Wire will replace this with a real interface
|
return &standalone.NoOpAPIServerFactory{}, nil // Wire will replace this with a real interface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func InitializeDocumentBuilders(cfg *setting.Cfg) (resource.DocumentBuilderSupplier, error) {
|
||||||
|
wire.Build(wireExtsSet)
|
||||||
|
return &unifiedsearch.StandardDocumentBuilders{}, nil
|
||||||
|
}
|
||||||
|
@ -6,6 +6,7 @@ package server
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/google/wire"
|
"github.com/google/wire"
|
||||||
|
search2 "github.com/grafana/grafana/pkg/storage/unified/search"
|
||||||
|
|
||||||
"github.com/grafana/grafana/pkg/infra/metrics"
|
"github.com/grafana/grafana/pkg/infra/metrics"
|
||||||
"github.com/grafana/grafana/pkg/plugins"
|
"github.com/grafana/grafana/pkg/plugins"
|
||||||
@ -106,6 +107,9 @@ var wireExtsBasicSet = wire.NewSet(
|
|||||||
wire.Bind(new(auth.IDSigner), new(*idimpl.LocalSigner)),
|
wire.Bind(new(auth.IDSigner), new(*idimpl.LocalSigner)),
|
||||||
manager.ProvideInstaller,
|
manager.ProvideInstaller,
|
||||||
wire.Bind(new(plugins.Installer), new(*manager.PluginInstaller)),
|
wire.Bind(new(plugins.Installer), new(*manager.PluginInstaller)),
|
||||||
|
search2.ProvideDashboardStats,
|
||||||
|
wire.Bind(new(search2.DashboardStats), new(*search2.OssDashboardStats)),
|
||||||
|
search2.ProvideDocumentBuilders,
|
||||||
)
|
)
|
||||||
|
|
||||||
var wireExtsSet = wire.NewSet(
|
var wireExtsSet = wire.NewSet(
|
||||||
|
@ -1525,6 +1525,14 @@ var (
|
|||||||
HideFromDocs: true,
|
HideFromDocs: true,
|
||||||
HideFromAdminPage: true,
|
HideFromAdminPage: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "unifiedStorageSearchSprinkles",
|
||||||
|
Description: "Enable sprinkles on unified storage search",
|
||||||
|
Stage: FeatureStageExperimental,
|
||||||
|
Owner: grafanaSearchAndStorageSquad,
|
||||||
|
HideFromDocs: true,
|
||||||
|
HideFromAdminPage: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Name: "pluginsSriChecks",
|
Name: "pluginsSriChecks",
|
||||||
Description: "Enables SRI checks for plugin assets",
|
Description: "Enables SRI checks for plugin assets",
|
||||||
|
@ -201,6 +201,7 @@ improvedExternalSessionHandling,experimental,@grafana/identity-access-team,false
|
|||||||
useSessionStorageForRedirection,GA,@grafana/identity-access-team,false,false,false
|
useSessionStorageForRedirection,GA,@grafana/identity-access-team,false,false,false
|
||||||
rolePickerDrawer,experimental,@grafana/identity-access-team,false,false,false
|
rolePickerDrawer,experimental,@grafana/identity-access-team,false,false,false
|
||||||
unifiedStorageSearch,experimental,@grafana/search-and-storage,false,false,false
|
unifiedStorageSearch,experimental,@grafana/search-and-storage,false,false,false
|
||||||
|
unifiedStorageSearchSprinkles,experimental,@grafana/search-and-storage,false,false,false
|
||||||
pluginsSriChecks,experimental,@grafana/plugins-platform-backend,false,false,false
|
pluginsSriChecks,experimental,@grafana/plugins-platform-backend,false,false,false
|
||||||
unifiedStorageBigObjectsSupport,experimental,@grafana/search-and-storage,false,false,false
|
unifiedStorageBigObjectsSupport,experimental,@grafana/search-and-storage,false,false,false
|
||||||
timeRangeProvider,experimental,@grafana/grafana-frontend-platform,false,false,false
|
timeRangeProvider,experimental,@grafana/grafana-frontend-platform,false,false,false
|
||||||
|
|
@ -815,6 +815,10 @@ const (
|
|||||||
// Enable unified storage search
|
// Enable unified storage search
|
||||||
FlagUnifiedStorageSearch = "unifiedStorageSearch"
|
FlagUnifiedStorageSearch = "unifiedStorageSearch"
|
||||||
|
|
||||||
|
// FlagUnifiedStorageSearchSprinkles
|
||||||
|
// Enable sprinkles on unified storage search
|
||||||
|
FlagUnifiedStorageSearchSprinkles = "unifiedStorageSearchSprinkles"
|
||||||
|
|
||||||
// FlagPluginsSriChecks
|
// FlagPluginsSriChecks
|
||||||
// Enables SRI checks for plugin assets
|
// Enables SRI checks for plugin assets
|
||||||
FlagPluginsSriChecks = "pluginsSriChecks"
|
FlagPluginsSriChecks = "pluginsSriChecks"
|
||||||
|
@ -3618,6 +3618,20 @@
|
|||||||
"hideFromDocs": true
|
"hideFromDocs": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"metadata": {
|
||||||
|
"name": "unifiedStorageSearchSprinkles",
|
||||||
|
"resourceVersion": "1734123247356",
|
||||||
|
"creationTimestamp": "2024-12-13T20:54:07Z"
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"description": "Enable sprinkles on unified storage search",
|
||||||
|
"stage": "experimental",
|
||||||
|
"codeowner": "@grafana/search-and-storage",
|
||||||
|
"hideFromAdminPage": true,
|
||||||
|
"hideFromDocs": true
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"name": "useSeessionStorageForRedirection",
|
"name": "useSeessionStorageForRedirection",
|
||||||
|
@ -523,12 +523,14 @@ type Cfg struct {
|
|||||||
ShortLinkExpiration int
|
ShortLinkExpiration int
|
||||||
|
|
||||||
// Unified Storage
|
// Unified Storage
|
||||||
UnifiedStorage map[string]UnifiedStorageConfig
|
UnifiedStorage map[string]UnifiedStorageConfig
|
||||||
IndexPath string
|
IndexPath string
|
||||||
IndexWorkers int
|
IndexWorkers int
|
||||||
IndexMaxBatchSize int
|
IndexMaxBatchSize int
|
||||||
IndexFileThreshold int
|
IndexFileThreshold int
|
||||||
IndexMinCount int
|
IndexMinCount int
|
||||||
|
SprinklesApiServer string
|
||||||
|
SprinklesApiServerPageLimit int
|
||||||
}
|
}
|
||||||
|
|
||||||
type UnifiedStorageConfig struct {
|
type UnifiedStorageConfig struct {
|
||||||
|
@ -52,4 +52,6 @@ func (cfg *Cfg) setUnifiedStorageConfig() {
|
|||||||
cfg.IndexMaxBatchSize = section.Key("index_max_batch_size").MustInt(100)
|
cfg.IndexMaxBatchSize = section.Key("index_max_batch_size").MustInt(100)
|
||||||
cfg.IndexFileThreshold = section.Key("index_file_threshold").MustInt(10)
|
cfg.IndexFileThreshold = section.Key("index_file_threshold").MustInt(10)
|
||||||
cfg.IndexMinCount = section.Key("index_min_count").MustInt(1)
|
cfg.IndexMinCount = section.Key("index_min_count").MustInt(1)
|
||||||
|
cfg.SprinklesApiServer = section.Key("sprinkles_api_server").String()
|
||||||
|
cfg.SprinklesApiServerPageLimit = section.Key("sprinkles_api_server_page_limit").MustInt(100)
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ func TestBleveBackend(t *testing.T) {
|
|||||||
return &DashboardDocumentBuilder{
|
return &DashboardDocumentBuilder{
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
Blob: blob,
|
Blob: blob,
|
||||||
Stats: NewDashboardStatsLookup(nil), // empty stats
|
Stats: make(map[string]map[string]int64), // empty stats
|
||||||
DatasourceLookup: dashboard.CreateDatasourceLookup([]*dashboard.DatasourceQueryResult{{}}),
|
DatasourceLookup: dashboard.CreateDatasourceLookup([]*dashboard.DatasourceQueryResult{{}}),
|
||||||
}, nil
|
}, nil
|
||||||
})
|
})
|
||||||
|
@ -75,7 +75,7 @@ func DashboardBuilder(namespaced resource.NamespacedDocumentSupplier) (resource.
|
|||||||
return &DashboardDocumentBuilder{
|
return &DashboardDocumentBuilder{
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
Blob: blob,
|
Blob: blob,
|
||||||
Stats: NewDashboardStatsLookup(nil),
|
Stats: nil,
|
||||||
DatasourceLookup: dashboard.CreateDatasourceLookup([]*dashboard.DatasourceQueryResult{
|
DatasourceLookup: dashboard.CreateDatasourceLookup([]*dashboard.DatasourceQueryResult{
|
||||||
// empty values (does not resolve anything)
|
// empty values (does not resolve anything)
|
||||||
}),
|
}),
|
||||||
@ -94,8 +94,8 @@ type DashboardDocumentBuilder struct {
|
|||||||
Namespace string
|
Namespace string
|
||||||
|
|
||||||
// Cached stats for this namespace
|
// Cached stats for this namespace
|
||||||
// TODO, load this from apiserver request
|
// maps dashboard UID to stats
|
||||||
Stats DashboardStatsLookup
|
Stats map[string]map[string]int64
|
||||||
|
|
||||||
// data source lookup
|
// data source lookup
|
||||||
DatasourceLookup dashboard.DatasourceLookup
|
DatasourceLookup dashboard.DatasourceLookup
|
||||||
@ -104,17 +104,12 @@ type DashboardDocumentBuilder struct {
|
|||||||
Blob resource.BlobSupport
|
Blob resource.BlobSupport
|
||||||
}
|
}
|
||||||
|
|
||||||
type DashboardStatsLookup = func(ctx context.Context, uid string) map[string]int64
|
type DashboardStats interface {
|
||||||
|
GetStats(ctx context.Context, namespace string) (map[string]map[string]int64, error)
|
||||||
func NewDashboardStatsLookup(stats map[string]map[string]int64) DashboardStatsLookup {
|
|
||||||
return func(ctx context.Context, uid string) map[string]int64 {
|
|
||||||
if stats == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return stats[uid]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type DashboardStatsLookup = func(ctx context.Context, uid string) map[string]int64
|
||||||
|
|
||||||
var _ resource.DocumentBuilder = &DashboardDocumentBuilder{}
|
var _ resource.DocumentBuilder = &DashboardDocumentBuilder{}
|
||||||
|
|
||||||
func (s *DashboardDocumentBuilder) BuildDocument(ctx context.Context, key *resource.ResourceKey, rv int64, value []byte) (*resource.IndexableDocument, error) {
|
func (s *DashboardDocumentBuilder) BuildDocument(ctx context.Context, key *resource.ResourceKey, rv int64, value []byte) (*resource.IndexableDocument, error) {
|
||||||
@ -150,6 +145,9 @@ func (s *DashboardDocumentBuilder) BuildDocument(ctx context.Context, key *resou
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// metadata name is the dashboard uid
|
||||||
|
summary.UID = obj.GetName()
|
||||||
|
|
||||||
doc := resource.NewIndexableDocument(key, rv, obj)
|
doc := resource.NewIndexableDocument(key, rv, obj)
|
||||||
doc.Title = summary.Title
|
doc.Title = summary.Title
|
||||||
doc.Description = summary.Description
|
doc.Description = summary.Description
|
||||||
@ -211,8 +209,7 @@ func (s *DashboardDocumentBuilder) BuildDocument(ctx context.Context, key *resou
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add the stats fields
|
// Add the stats fields
|
||||||
stats := s.Stats(ctx, key.Name) // summary.UID
|
for k, v := range s.Stats[summary.UID] {
|
||||||
for k, v := range stats {
|
|
||||||
doc.Fields[k] = v
|
doc.Fields[k] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
15
pkg/storage/unified/search/dashboard_stats.go
Normal file
15
pkg/storage/unified/search/dashboard_stats.go
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package search
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
)
|
||||||
|
|
||||||
|
type OssDashboardStats struct{}
|
||||||
|
|
||||||
|
func ProvideDashboardStats() *OssDashboardStats {
|
||||||
|
return &OssDashboardStats{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *OssDashboardStats) GetStats(ctx context.Context, namespace string) (map[string]map[string]int64, error) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
@ -5,23 +5,25 @@ import (
|
|||||||
|
|
||||||
"github.com/grafana/authlib/claims"
|
"github.com/grafana/authlib/claims"
|
||||||
"github.com/grafana/grafana/pkg/infra/db"
|
"github.com/grafana/grafana/pkg/infra/db"
|
||||||
|
"github.com/grafana/grafana/pkg/infra/log"
|
||||||
"github.com/grafana/grafana/pkg/services/store/kind/dashboard"
|
"github.com/grafana/grafana/pkg/services/store/kind/dashboard"
|
||||||
"github.com/grafana/grafana/pkg/storage/unified/resource"
|
"github.com/grafana/grafana/pkg/storage/unified/resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
// The default list of open source document builders
|
// The default list of open source document builders
|
||||||
type StandardDocumentBuilders struct {
|
type StandardDocumentBuilders struct {
|
||||||
sql db.DB
|
sql db.DB
|
||||||
|
sprinkles DashboardStats
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hooked up so wire can fill in different sprinkles
|
// Hooked up so wire can fill in different sprinkles
|
||||||
func ProvideDocumentBuilders(sql db.DB) resource.DocumentBuilderSupplier {
|
func ProvideDocumentBuilders(sql db.DB, sprinkles DashboardStats) resource.DocumentBuilderSupplier {
|
||||||
return &StandardDocumentBuilders{sql}
|
return &StandardDocumentBuilders{sql, sprinkles}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StandardDocumentBuilders) GetDocumentBuilders() ([]resource.DocumentBuilderInfo, error) {
|
func (s *StandardDocumentBuilders) GetDocumentBuilders() ([]resource.DocumentBuilderInfo, error) {
|
||||||
dashboards, err := DashboardBuilder(func(ctx context.Context, namespace string, blob resource.BlobSupport) (resource.DocumentBuilder, error) {
|
dashboards, err := DashboardBuilder(func(ctx context.Context, namespace string, blob resource.BlobSupport) (resource.DocumentBuilder, error) {
|
||||||
stats := NewDashboardStatsLookup(nil) // empty stats
|
logger := log.New("dashboard_builder", "namespace", namespace)
|
||||||
dsinfo := []*dashboard.DatasourceQueryResult{{}}
|
dsinfo := []*dashboard.DatasourceQueryResult{{}}
|
||||||
ns, err := claims.ParseNamespace(namespace)
|
ns, err := claims.ParseNamespace(namespace)
|
||||||
if err != nil && s.sql != nil {
|
if err != nil && s.sql != nil {
|
||||||
@ -43,6 +45,18 @@ func (s *StandardDocumentBuilders) GetDocumentBuilders() ([]resource.DocumentBui
|
|||||||
dsinfo = append(dsinfo, info)
|
dsinfo = append(dsinfo, info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fetch dashboard sprinkles for the namespace
|
||||||
|
// This could take a while if namespace has a lot of dashboards
|
||||||
|
var stats map[string]map[string]int64
|
||||||
|
if s.sprinkles != nil {
|
||||||
|
stats, err = s.sprinkles.GetStats(ctx, namespace)
|
||||||
|
if err != nil {
|
||||||
|
// only log a warning. Don't need to fail the indexer if we can't get sprinkles
|
||||||
|
logger.Warn("Failed to get sprinkles", "error", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return &DashboardDocumentBuilder{
|
return &DashboardDocumentBuilder{
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
Blob: blob,
|
Blob: blob,
|
||||||
|
@ -56,12 +56,12 @@ func TestDashboardDocumentBuilder(t *testing.T) {
|
|||||||
return &DashboardDocumentBuilder{
|
return &DashboardDocumentBuilder{
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
Blob: blob,
|
Blob: blob,
|
||||||
Stats: NewDashboardStatsLookup(map[string]map[string]int64{
|
Stats: map[string]map[string]int64{
|
||||||
"aaa": {
|
"aaa": {
|
||||||
DASHBOARD_ERRORS_LAST_1_DAYS: 1,
|
DASHBOARD_ERRORS_LAST_1_DAYS: 1,
|
||||||
DASHBOARD_ERRORS_LAST_7_DAYS: 1,
|
DASHBOARD_ERRORS_LAST_7_DAYS: 1,
|
||||||
},
|
},
|
||||||
}),
|
},
|
||||||
DatasourceLookup: dashboard.CreateDatasourceLookup([]*dashboard.DatasourceQueryResult{{
|
DatasourceLookup: dashboard.CreateDatasourceLookup([]*dashboard.DatasourceQueryResult{{
|
||||||
Name: "TheDisplayName", // used to be the unique ID!
|
Name: "TheDisplayName", // used to be the unique ID!
|
||||||
Type: "my-custom-plugin",
|
Type: "my-custom-plugin",
|
||||||
|
@ -20,7 +20,6 @@ import (
|
|||||||
"github.com/grafana/grafana/pkg/setting"
|
"github.com/grafana/grafana/pkg/setting"
|
||||||
"github.com/grafana/grafana/pkg/storage/unified/resource"
|
"github.com/grafana/grafana/pkg/storage/unified/resource"
|
||||||
"github.com/grafana/grafana/pkg/storage/unified/resource/grpc"
|
"github.com/grafana/grafana/pkg/storage/unified/resource/grpc"
|
||||||
"github.com/grafana/grafana/pkg/storage/unified/search"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -51,6 +50,8 @@ type service struct {
|
|||||||
|
|
||||||
log log.Logger
|
log log.Logger
|
||||||
reg prometheus.Registerer
|
reg prometheus.Registerer
|
||||||
|
|
||||||
|
docBuilders resource.DocumentBuilderSupplier
|
||||||
}
|
}
|
||||||
|
|
||||||
func ProvideUnifiedStorageGrpcService(
|
func ProvideUnifiedStorageGrpcService(
|
||||||
@ -59,6 +60,7 @@ func ProvideUnifiedStorageGrpcService(
|
|||||||
db infraDB.DB,
|
db infraDB.DB,
|
||||||
log log.Logger,
|
log log.Logger,
|
||||||
reg prometheus.Registerer,
|
reg prometheus.Registerer,
|
||||||
|
docBuilders resource.DocumentBuilderSupplier,
|
||||||
) (UnifiedStorageGrpcService, error) {
|
) (UnifiedStorageGrpcService, error) {
|
||||||
tracingCfg, err := tracing.ProvideTracingConfig(cfg)
|
tracingCfg, err := tracing.ProvideTracingConfig(cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -78,7 +80,7 @@ func ProvideUnifiedStorageGrpcService(
|
|||||||
|
|
||||||
// FIXME: This is a temporary solution while we are migrating to the new authn interceptor
|
// FIXME: This is a temporary solution while we are migrating to the new authn interceptor
|
||||||
// grpcutils.NewGrpcAuthenticator should be used instead.
|
// grpcutils.NewGrpcAuthenticator should be used instead.
|
||||||
authn, err := grpcutils.NewGrpcAuthenticatorWithFallback(cfg, prometheus.DefaultRegisterer, tracing, &grpc.Authenticator{})
|
authn, err := grpcutils.NewGrpcAuthenticatorWithFallback(cfg, reg, tracing, &grpc.Authenticator{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -92,6 +94,7 @@ func ProvideUnifiedStorageGrpcService(
|
|||||||
db: db,
|
db: db,
|
||||||
log: log,
|
log: log,
|
||||||
reg: reg,
|
reg: reg,
|
||||||
|
docBuilders: docBuilders,
|
||||||
}
|
}
|
||||||
|
|
||||||
// This will be used when running as a dskit service
|
// This will be used when running as a dskit service
|
||||||
@ -106,11 +109,7 @@ func (s *service) start(ctx context.Context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO, for standalone this will need to be started from enterprise
|
server, err := NewResourceServer(ctx, s.db, s.cfg, s.features, s.docBuilders, s.tracing, s.reg, authzClient)
|
||||||
// Connecting to the correct remote services (cloudconfig for DS info and usage stats)
|
|
||||||
docs := search.ProvideDocumentBuilders(nil)
|
|
||||||
|
|
||||||
server, err := NewResourceServer(ctx, s.db, s.cfg, s.features, docs, s.tracing, s.reg, authzClient)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -366,7 +366,7 @@ func TestClientServer(t *testing.T) {
|
|||||||
|
|
||||||
features := featuremgmt.WithFeatures()
|
features := featuremgmt.WithFeatures()
|
||||||
|
|
||||||
svc, err := sql.ProvideUnifiedStorageGrpcService(cfg, features, dbstore, nil, prometheus.NewPedanticRegistry())
|
svc, err := sql.ProvideUnifiedStorageGrpcService(cfg, features, dbstore, nil, prometheus.NewPedanticRegistry(), nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
var client resource.ResourceStoreClient
|
var client resource.ResourceStoreClient
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ func StartGrafanaEnv(t *testing.T, grafDir, cfgPath string) (string, *server.Tes
|
|||||||
var storage sql.UnifiedStorageGrpcService
|
var storage sql.UnifiedStorageGrpcService
|
||||||
if runstore {
|
if runstore {
|
||||||
storage, err = sql.ProvideUnifiedStorageGrpcService(env.Cfg, env.FeatureToggles, env.SQLStore,
|
storage, err = sql.ProvideUnifiedStorageGrpcService(env.Cfg, env.FeatureToggles, env.SQLStore,
|
||||||
env.Cfg.Logger, prometheus.NewPedanticRegistry())
|
env.Cfg.Logger, prometheus.NewPedanticRegistry(), nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
err = storage.StartAsync(ctx)
|
err = storage.StartAsync(ctx)
|
||||||
|
Loading…
Reference in New Issue
Block a user