Remove feature toggles from bleve backend. (#110951)
* Remove feature toggles from search backend. * Remove extra import. * Remove unnecessary code.
This commit is contained in:
@@ -30,7 +30,6 @@ import (
|
||||
"k8s.io/apimachinery/pkg/selection"
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/dashboards/dashboardaccess"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
"github.com/grafana/grafana/pkg/storage/unified/resourcepb"
|
||||
|
||||
authlib "github.com/grafana/authlib/types"
|
||||
@@ -76,11 +75,10 @@ type bleveBackend struct {
|
||||
cacheMx sync.RWMutex
|
||||
cache map[resource.NamespacedResource]*bleveIndex
|
||||
|
||||
features featuremgmt.FeatureToggles
|
||||
indexMetrics *resource.BleveIndexMetrics
|
||||
}
|
||||
|
||||
func NewBleveBackend(opts BleveOptions, tracer trace.Tracer, features featuremgmt.FeatureToggles, indexMetrics *resource.BleveIndexMetrics) (*bleveBackend, error) {
|
||||
func NewBleveBackend(opts BleveOptions, tracer trace.Tracer, indexMetrics *resource.BleveIndexMetrics) (*bleveBackend, error) {
|
||||
if opts.Root == "" {
|
||||
return nil, fmt.Errorf("bleve backend missing root folder configuration")
|
||||
}
|
||||
@@ -108,7 +106,6 @@ func NewBleveBackend(opts BleveOptions, tracer trace.Tracer, features featuremgm
|
||||
tracer: tracer,
|
||||
cache: map[resource.NamespacedResource]*bleveIndex{},
|
||||
opts: opts,
|
||||
features: features,
|
||||
indexMetrics: indexMetrics,
|
||||
}
|
||||
|
||||
@@ -583,7 +580,6 @@ type bleveIndex struct {
|
||||
|
||||
// The values returned with all
|
||||
allFields []*resourcepb.ResourceTableColumnDefinition
|
||||
features featuremgmt.FeatureToggles
|
||||
tracing trace.Tracer
|
||||
logger *slog.Logger
|
||||
|
||||
@@ -617,7 +613,6 @@ func (b *bleveBackend) newBleveIndex(
|
||||
fields: fields,
|
||||
allFields: allFields,
|
||||
standard: standardSearchFields,
|
||||
features: b.features,
|
||||
tracing: b.tracer,
|
||||
logger: logger,
|
||||
updaterFn: updaterFn,
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/tracing"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
"github.com/grafana/grafana/pkg/storage/unified/resource"
|
||||
unitest "github.com/grafana/grafana/pkg/storage/unified/testing"
|
||||
)
|
||||
@@ -21,7 +20,7 @@ func TestBleveSearchBackend(t *testing.T) {
|
||||
backend, err := NewBleveBackend(BleveOptions{
|
||||
Root: tempDir,
|
||||
FileThreshold: 5,
|
||||
}, tracing.NewNoopTracerService(), featuremgmt.WithFeatures(), nil)
|
||||
}, tracing.NewNoopTracerService(), nil)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, backend)
|
||||
|
||||
@@ -46,7 +45,7 @@ func TestSearchBackendBenchmark(t *testing.T) {
|
||||
// Create a new bleve backend
|
||||
backend, err := NewBleveBackend(BleveOptions{
|
||||
Root: tempDir,
|
||||
}, tracing.NewNoopTracerService(), featuremgmt.WithFeatures(), nil)
|
||||
}, tracing.NewNoopTracerService(), nil)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, backend)
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ import (
|
||||
|
||||
"github.com/grafana/grafana/pkg/apimachinery/identity"
|
||||
"github.com/grafana/grafana/pkg/infra/tracing"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
"github.com/grafana/grafana/pkg/services/store/kind/dashboard"
|
||||
"github.com/grafana/grafana/pkg/services/user"
|
||||
"github.com/grafana/grafana/pkg/storage/unified/resource"
|
||||
@@ -232,7 +231,7 @@ func newTestDashboardsIndex(t testing.TB, threshold int64, size int64, batchSize
|
||||
Root: t.TempDir(),
|
||||
FileThreshold: threshold, // use in-memory for tests
|
||||
BatchSize: int(batchSize),
|
||||
}, tracing.NewNoopTracerService(), featuremgmt.WithFeatures(), nil)
|
||||
}, tracing.NewNoopTracerService(), nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
t.Cleanup(backend.CloseAllIndexes)
|
||||
|
||||
@@ -28,7 +28,6 @@ import (
|
||||
"github.com/grafana/grafana/pkg/infra/log/logtest"
|
||||
"github.com/grafana/grafana/pkg/infra/tracing"
|
||||
authzextv1 "github.com/grafana/grafana/pkg/services/authz/proto/v1"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
"github.com/grafana/grafana/pkg/services/store/kind/dashboard"
|
||||
"github.com/grafana/grafana/pkg/services/user"
|
||||
"github.com/grafana/grafana/pkg/storage/unified/resource"
|
||||
@@ -63,7 +62,7 @@ func TestBleveBackend(t *testing.T) {
|
||||
backend, err := NewBleveBackend(BleveOptions{
|
||||
Root: tmpdir,
|
||||
FileThreshold: 5, // with more than 5 items we create a file on disk
|
||||
}, tracing.NewNoopTracerService(), featuremgmt.WithFeatures(), nil)
|
||||
}, tracing.NewNoopTracerService(), nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
t.Cleanup(backend.CloseAllIndexes)
|
||||
@@ -769,7 +768,7 @@ func setupBleveBackend(t *testing.T, fileThreshold int, cacheTTL time.Duration,
|
||||
FileThreshold: int64(fileThreshold),
|
||||
IndexCacheTTL: cacheTTL,
|
||||
Logger: slog.New(logtest.NewNopHandler(t)),
|
||||
}, tracing.NewNoopTracerService(), featuremgmt.WithFeatures(), metrics)
|
||||
}, tracing.NewNoopTracerService(), metrics)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, backend)
|
||||
t.Cleanup(backend.CloseAllIndexes)
|
||||
|
||||
@@ -28,7 +28,7 @@ func NewSearchOptions(features featuremgmt.FeatureToggles, cfg *setting.Cfg, tra
|
||||
FileThreshold: int64(cfg.IndexFileThreshold), // fewer than X items will use a memory index
|
||||
BatchSize: cfg.IndexMaxBatchSize, // This is the batch size for how many objects to add to the index at once
|
||||
IndexCacheTTL: cfg.IndexCacheTTL, // How long to keep the index cache in memory
|
||||
}, tracer, features, indexMetrics)
|
||||
}, tracer, indexMetrics)
|
||||
|
||||
if err != nil {
|
||||
return resource.SearchOptions{}, err
|
||||
|
||||
@@ -111,7 +111,7 @@ func TestIntegrationSearchAndStorage(t *testing.T) {
|
||||
search, err := search.NewBleveBackend(search.BleveOptions{
|
||||
FileThreshold: 0,
|
||||
Root: tempDir,
|
||||
}, tracing.NewNoopTracerService(), featuremgmt.WithFeatures(), nil)
|
||||
}, tracing.NewNoopTracerService(), nil)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, search)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user