Skip to content

Commit

Permalink
[storage] Remove usages of GetStorageFactory
Browse files Browse the repository at this point in the history
Signed-off-by: Aryan Goyal <[email protected]>
  • Loading branch information
ary82 committed Jan 27, 2025
1 parent 852d9b6 commit 1d43f01
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/jaeger/internal/extension/remotesampling/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func (ext *rsExtension) startFileBasedStrategyProvider(_ context.Context) error

func (ext *rsExtension) startAdaptiveStrategyProvider(host component.Host) error {
storageName := ext.cfg.Adaptive.SamplingStore
f, err := jaegerstorage.GetStorageFactory(storageName, host)
f, err := jaegerstorage.GetTraceStoreFactory(storageName, host)
if err != nil {
return fmt.Errorf("cannot find storage factory: %w", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func newStorageCleaner(config *Config, telset component.TelemetrySettings) *stor
}

func (c *storageCleaner) Start(_ context.Context, host component.Host) error {
storageFactory, err := jaegerstorage.GetStorageFactory(c.config.TraceStorage, host)
storageFactory, err := jaegerstorage.GetTraceStoreFactory(c.config.TraceStorage, host)
if err != nil {
return fmt.Errorf("cannot find storage factory '%s': %w", c.config.TraceStorage, err)
}
Expand Down
33 changes: 33 additions & 0 deletions storage_v2/v1adapter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ package v1adapter

import (
"context"
"errors"
"io"

"github.com/jaegertracing/jaeger/pkg/distributedlock"
storage_v1 "github.com/jaegertracing/jaeger/storage"
"github.com/jaegertracing/jaeger/storage/samplingstore"
"github.com/jaegertracing/jaeger/storage_v2/depstore"
"github.com/jaegertracing/jaeger/storage_v2/tracestore"
)
Expand Down Expand Up @@ -61,3 +64,33 @@ func (f *Factory) CreateDependencyReader() (depstore.Reader, error) {
}
return NewDependencyReader(dr), nil
}

// CreateLock implements storage_v1.SamplingStoreFactory
func (f *Factory) CreateLock() (distributedlock.Lock, error) {
ss, ok := f.ss.(storage_v1.SamplingStoreFactory)
if !ok {
return nil, errors.New("storage backend does not support sampling store")
}
lock, err := ss.CreateLock()
return lock, err
}

// CreateSamplingStore implements storage_v1.SamplingStoreFactory
func (f *Factory) CreateSamplingStore(maxBuckets int) (samplingstore.Store, error) {
ss, ok := f.ss.(storage_v1.SamplingStoreFactory)
if !ok {
return nil, errors.New("storage backend does not support sampling store")
}
store, err := ss.CreateSamplingStore(maxBuckets)
return store, err
}

// Purge implements storage_v1.Purger
func (f *Factory) Purge(ctx context.Context) error {
p, ok := f.ss.(storage_v1.Purger)
if !ok {
return errors.New("storage backend does not support Purger")
}
err := p.Purge(ctx)
return err
}

0 comments on commit 1d43f01

Please sign in to comment.