Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[storage] Remove distinction between primary and archive storage interfaces #6567

Merged
merged 82 commits into from
Jan 25, 2025
Merged
Show file tree
Hide file tree
Changes from 79 commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
befc6bd
Change ES Options To Only Hold One Namespace
mahadzaryab1 Jan 17, 2025
ab1180b
Add Configuration Fields For Suffixes
mahadzaryab1 Jan 17, 2025
e1d6f7d
Adjust ES Factory To Hold One Config
mahadzaryab1 Jan 17, 2025
5172646
Change Meta Factory To Initialize Archive Separately
mahadzaryab1 Jan 18, 2025
820b360
Phase Out Distinction In Cassandra Factory
mahadzaryab1 Jan 18, 2025
6dcd077
Remove Comment
mahadzaryab1 Jan 18, 2025
2dc7d19
Remove Archive Factory From Blackhole
mahadzaryab1 Jan 18, 2025
00c105c
Remove Archive Factory From Memory
mahadzaryab1 Jan 18, 2025
b57e488
Remove Archive Helper From Adapter
mahadzaryab1 Jan 18, 2025
e90efe7
Remove Concept of Archive From GRPC Storage
mahadzaryab1 Jan 18, 2025
1780ea5
Remove Usages of InitArchiveStorage
mahadzaryab1 Jan 18, 2025
1468260
Remove Archive Factory
mahadzaryab1 Jan 18, 2025
43b7604
Fix Cassandra Integration Test
mahadzaryab1 Jan 18, 2025
7c4c43e
Fix ES Integration Test
mahadzaryab1 Jan 18, 2025
0b2280a
Fix GRPC Integration Tests
mahadzaryab1 Jan 18, 2025
5a06df6
Fix Typo
mahadzaryab1 Jan 18, 2025
6936344
Fix Integration Test Cleanup
mahadzaryab1 Jan 18, 2025
9b8571d
Move Init Function To Factory Struct
mahadzaryab1 Jan 18, 2025
8fc4680
Refactor Cassandra Configuration
mahadzaryab1 Jan 18, 2025
71273b5
Refactor ES Configuration
mahadzaryab1 Jan 18, 2025
03a0768
Simplify Construction of Factory
mahadzaryab1 Jan 18, 2025
2195e1d
Remove Unused Archive Fields
mahadzaryab1 Jan 18, 2025
42c5751
Fix GRPC Handler And Client Tests
mahadzaryab1 Jan 19, 2025
0e4f7f7
Fix ES Unit Tests
mahadzaryab1 Jan 19, 2025
a14a649
Fix Cassandra Tests
mahadzaryab1 Jan 19, 2025
bac94c8
Fix Blackhole Test
mahadzaryab1 Jan 19, 2025
f049b5a
Fix Meta Factory Tests
mahadzaryab1 Jan 19, 2025
efb4353
Fix GRPC Factory Tests
mahadzaryab1 Jan 19, 2025
3a271cb
Remove Archive Mocks
mahadzaryab1 Jan 19, 2025
2120635
Run Formatter
mahadzaryab1 Jan 19, 2025
9336407
Merge branch 'main' into v1-es-archive
mahadzaryab1 Jan 19, 2025
23cca33
Add Unit Test For InitArchiveStorage
mahadzaryab1 Jan 19, 2025
82e568c
Fix Query App Flags Test
mahadzaryab1 Jan 19, 2025
382b3af
Fix Server Tests With Some Commented Out
mahadzaryab1 Jan 19, 2025
677405d
Fix ES Unit Tests
mahadzaryab1 Jan 19, 2025
ae8d2fd
Fix GRPC Handler Tests
mahadzaryab1 Jan 19, 2025
ac4ceab
Fix Cassandra Tests
mahadzaryab1 Jan 19, 2025
7654aa7
Change Default to blackhole
mahadzaryab1 Jan 19, 2025
5f52410
Fix Test
mahadzaryab1 Jan 19, 2025
e8f61f9
Fix Remote Storage App Tests By Introducing Interface
mahadzaryab1 Jan 19, 2025
2fe8982
Use FakeFactory For Storage Errors Test
mahadzaryab1 Jan 20, 2025
c75bcaf
Add Tests For Missing Code Paths
mahadzaryab1 Jan 20, 2025
9656083
Move Logic To Initialization
mahadzaryab1 Jan 20, 2025
f4afdf1
Add Unit Test For Archive Factory
mahadzaryab1 Jan 20, 2025
1ae9be2
Add Test For Cassandra Factory
mahadzaryab1 Jan 20, 2025
11ec9fe
Allow Inheriting of Default Settings
mahadzaryab1 Jan 20, 2025
782e3ea
Add Unit Test To Cassandra Factory
mahadzaryab1 Jan 20, 2025
263315b
Add Unit Test To ES Factory
mahadzaryab1 Jan 20, 2025
3045049
Change Input To Be Func Type
mahadzaryab1 Jan 21, 2025
944d425
Add Documentation For New Configuration Fields
mahadzaryab1 Jan 21, 2025
a3440be
Change Name of Interface
mahadzaryab1 Jan 21, 2025
d1674a4
Fix Unit Tests
mahadzaryab1 Jan 21, 2025
8b90aeb
Remove Unused Types
mahadzaryab1 Jan 21, 2025
510fc66
Fix nit in Test
mahadzaryab1 Jan 21, 2025
6761944
Move Inheritance To InitFromViper
mahadzaryab1 Jan 21, 2025
b7698b8
Change File Watcher To Be Singular
mahadzaryab1 Jan 21, 2025
5634ef6
Merge branch 'main' into v1-es-archive
mahadzaryab1 Jan 21, 2025
47ff4c1
Merge branch 'main' into v1-es-archive
mahadzaryab1 Jan 22, 2025
66436be
Fix Test
mahadzaryab1 Jan 22, 2025
a278cad
Remove Redundant Check
mahadzaryab1 Jan 22, 2025
2ec0c9a
Fix Flaky Unit Test
mahadzaryab1 Jan 22, 2025
0675e7a
Add Test For Inheritable
mahadzaryab1 Jan 22, 2025
be2f3f9
Merge branch 'main' into v1-es-archive
mahadzaryab1 Jan 22, 2025
06468cc
Merge branch 'main' into v1-es-archive
mahadzaryab1 Jan 22, 2025
c4a67a0
Separate Primary And Archive For GRPC Remote Storage
mahadzaryab1 Jan 23, 2025
3afcdb5
Fix Typo
mahadzaryab1 Jan 23, 2025
9c4c573
Add Missing Cleanup Call
mahadzaryab1 Jan 23, 2025
1f809e9
Merge branch 'main' into v1-es-archive
mahadzaryab1 Jan 23, 2025
89ba32d
Add ArchiveCapable Interface To Initialize Correctly
mahadzaryab1 Jan 23, 2025
ba068b1
Add Enabled Flag For GRPC Archive
mahadzaryab1 Jan 24, 2025
aea0e8b
Fix Logic
mahadzaryab1 Jan 24, 2025
e73ec5c
Remove Print
mahadzaryab1 Jan 24, 2025
44d8b78
Add Test For Archive Configurable
mahadzaryab1 Jan 24, 2025
3d0f3d3
Add Unit Tests For IsArchiveCapable Function
mahadzaryab1 Jan 24, 2025
558b1fc
Merge branch 'main' into v1-es-archive
mahadzaryab1 Jan 24, 2025
48ff461
Restore For Merge Conflicts
mahadzaryab1 Jan 25, 2025
2f32ec7
Merge branch 'main' into v1-es-archive
mahadzaryab1 Jan 25, 2025
21ecf5b
Restore Back
mahadzaryab1 Jan 25, 2025
9a42d6b
Move to idl
mahadzaryab1 Jan 25, 2025
d2ef5b3
Address Feedback
mahadzaryab1 Jan 25, 2025
859e4ce
Move Interfaces To Other Package
mahadzaryab1 Jan 25, 2025
ba5fdd4
Add Mocks
mahadzaryab1 Jan 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/all-in-one/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ by default uses only in-memory database.`,
queryTelset := baseTelset // copy
queryTelset.Metrics = queryMetricsFactory
querySrv := startQuery(
svc, qOpts, qOpts.BuildQueryServiceOptions(storageFactory, logger),
qOpts.BuildQueryServiceOptionsV2(storageFactory, logger),
svc, qOpts, qOpts.BuildQueryServiceOptions(storageFactory.InitArchiveStorage, logger),
qOpts.BuildQueryServiceOptionsV2(storageFactory.InitArchiveStorage, logger),
traceReader, dependencyReader, metricsQueryService,
tm, queryTelset,
)
Expand Down
6 changes: 6 additions & 0 deletions cmd/jaeger/config-remote-storage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ extensions:
jaeger_query:
storage:
traces: some-storage
traces_archive: another-storage
ui:
config_file: ./cmd/jaeger/config-ui.json

Expand All @@ -34,6 +35,11 @@ extensions:
endpoint: localhost:17271
tls:
insecure: true
another-storage:
grpc:
endpoint: localhost:17272
tls:
insecure: true

receivers:
otlp:
Expand Down
2 changes: 1 addition & 1 deletion cmd/jaeger/internal/extension/jaegerstorage/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (cfg *TraceBackend) Unmarshal(conf *confmap.Conf) error {
}
if conf.IsSet("cassandra") {
cfg.Cassandra = &cassandra.Options{
Primary: cassandra.NamespaceConfig{
NamespaceConfig: cassandra.NamespaceConfig{
Configuration: casCfg.DefaultConfiguration(),
Enabled: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ backends:
`)
cfg := createDefaultConfig().(*Config)
require.NoError(t, conf.Unmarshal(cfg))
assert.NotEmpty(t, cfg.TraceBackends["some_storage"].Cassandra.Primary.Connection.Servers)
assert.NotEmpty(t, cfg.TraceBackends["some_storage"].Cassandra.Configuration.Connection.Servers)
}

func TestConfigDefaultElasticsearch(t *testing.T) {
Expand Down
9 changes: 7 additions & 2 deletions cmd/jaeger/internal/integration/grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,24 @@ import (
"testing"

"github.com/jaegertracing/jaeger/plugin/storage/integration"
"github.com/jaegertracing/jaeger/ports"
)

type GRPCStorageIntegration struct {
E2EStorageIntegration

remoteStorage *integration.RemoteMemoryStorage
remoteStorage *integration.RemoteMemoryStorage
archiveRemoteStorage *integration.RemoteMemoryStorage
}

func (s *GRPCStorageIntegration) initialize(t *testing.T) {
s.remoteStorage = integration.StartNewRemoteMemoryStorage(t)
s.remoteStorage = integration.StartNewRemoteMemoryStorage(t, ports.RemoteStorageGRPC)
s.archiveRemoteStorage = integration.StartNewRemoteMemoryStorage(t, ports.RemoteStorageGRPC+1)
}

func (s *GRPCStorageIntegration) cleanUp(t *testing.T) {
s.remoteStorage.Close(t)
s.archiveRemoteStorage.Close(t)
s.initialize(t)
}

Expand All @@ -37,6 +41,7 @@ func TestGRPCStorage(t *testing.T) {
s.e2eInitialize(t, "grpc")
t.Cleanup(func() {
s.remoteStorage.Close(t)
s.archiveRemoteStorage.Close(t)
})
s.RunSpanStoreTests(t)
}
23 changes: 16 additions & 7 deletions cmd/query/app/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
"github.com/jaegertracing/jaeger/pkg/config/tlscfg"
"github.com/jaegertracing/jaeger/pkg/tenancy"
"github.com/jaegertracing/jaeger/ports"
"github.com/jaegertracing/jaeger/storage"
"github.com/jaegertracing/jaeger/storage/spanstore"
"github.com/jaegertracing/jaeger/storage_v2/v1adapter"
)

Expand Down Expand Up @@ -138,10 +138,19 @@ func (qOpts *QueryOptions) InitFromViper(v *viper.Viper, logger *zap.Logger) (*Q
return qOpts, nil
}

type InitArchiveStorageFn func(logger *zap.Logger) (spanstore.Reader, spanstore.Writer)

// BuildQueryServiceOptions creates a QueryServiceOptions struct with appropriate adjusters and archive config
func (qOpts *QueryOptions) BuildQueryServiceOptions(storageFactory storage.BaseFactory, logger *zap.Logger) *querysvc.QueryServiceOptions {
func (qOpts *QueryOptions) BuildQueryServiceOptions(
initArchiveStorageFn InitArchiveStorageFn,
logger *zap.Logger,
) *querysvc.QueryServiceOptions {
opts := &querysvc.QueryServiceOptions{}
if !opts.InitArchiveStorage(storageFactory, logger) {
ar, aw := initArchiveStorageFn(logger)
if ar != nil && aw != nil {
opts.ArchiveSpanReader = ar
opts.ArchiveSpanWriter = aw
} else {
logger.Info("Archive storage not initialized")
}

Expand All @@ -150,13 +159,13 @@ func (qOpts *QueryOptions) BuildQueryServiceOptions(storageFactory storage.BaseF
return opts
}

func (qOpts *QueryOptions) BuildQueryServiceOptionsV2(storageFactory storage.BaseFactory, logger *zap.Logger) *v2querysvc.QueryServiceOptions {
func (qOpts *QueryOptions) BuildQueryServiceOptionsV2(initArchiveStorageFn InitArchiveStorageFn, logger *zap.Logger) *v2querysvc.QueryServiceOptions {
opts := &v2querysvc.QueryServiceOptions{}

ar, aw := v1adapter.InitializeArchiveStorage(storageFactory, logger)
ar, aw := initArchiveStorageFn(logger)
if ar != nil && aw != nil {
opts.ArchiveTraceReader = ar
opts.ArchiveTraceWriter = aw
opts.ArchiveTraceReader = v1adapter.NewTraceReader(ar)
opts.ArchiveTraceWriter = v1adapter.NewTraceWriter(aw)
} else {
yurishkuro marked this conversation as resolved.
Show resolved Hide resolved
logger.Info("Archive storage not initialized")
}
Expand Down
61 changes: 26 additions & 35 deletions cmd/query/app/flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
"github.com/jaegertracing/jaeger/pkg/config"
"github.com/jaegertracing/jaeger/pkg/testutils"
"github.com/jaegertracing/jaeger/ports"
"github.com/jaegertracing/jaeger/storage/mocks"
spanstore_mocks "github.com/jaegertracing/jaeger/storage/spanstore/mocks"
"github.com/jaegertracing/jaeger/storage/spanstore"
spanstoremocks "github.com/jaegertracing/jaeger/storage/spanstore/mocks"
)

func TestQueryBuilderFlags(t *testing.T) {
Expand Down Expand Up @@ -86,60 +86,51 @@ func TestStringSliceAsHeader(t *testing.T) {
require.NoError(t, err)
}

func initializedFn(*zap.Logger) (spanstore.Reader, spanstore.Writer) {
return &spanstoremocks.Reader{}, &spanstoremocks.Writer{}
}

func uninitializedFn(*zap.Logger) (spanstore.Reader, spanstore.Writer) {
return nil, nil
}

func TestBuildQueryServiceOptions(t *testing.T) {
v, _ := config.Viperize(AddFlags)
qOpts, err := new(QueryOptions).InitFromViper(v, zap.NewNop())
require.NoError(t, err)
assert.NotNil(t, qOpts)

qSvcOpts := qOpts.BuildQueryServiceOptions(&mocks.Factory{}, zap.NewNop())
assert.NotNil(t, qSvcOpts)
assert.NotNil(t, qSvcOpts.Adjuster)
assert.Nil(t, qSvcOpts.ArchiveSpanReader)
assert.Nil(t, qSvcOpts.ArchiveSpanWriter)

comboFactory := struct {
*mocks.Factory
*mocks.ArchiveFactory
}{
&mocks.Factory{},
&mocks.ArchiveFactory{},
}

comboFactory.ArchiveFactory.On("CreateArchiveSpanReader").Return(&spanstore_mocks.Reader{}, nil)
comboFactory.ArchiveFactory.On("CreateArchiveSpanWriter").Return(&spanstore_mocks.Writer{}, nil)

qSvcOpts = qOpts.BuildQueryServiceOptions(comboFactory, zap.NewNop())
qSvcOpts := qOpts.BuildQueryServiceOptions(initializedFn, zap.NewNop())
assert.NotNil(t, qSvcOpts)
assert.NotNil(t, qSvcOpts.Adjuster)
assert.NotNil(t, qSvcOpts.ArchiveSpanReader)
assert.NotNil(t, qSvcOpts.ArchiveSpanWriter)
}

func TestBuildQueryServiceOptionsV2(t *testing.T) {
func TestBuildQueryServiceOptions_NoArchiveStorage(t *testing.T) {
v, _ := config.Viperize(AddFlags)
qOpts, err := new(QueryOptions).InitFromViper(v, zap.NewNop())
require.NoError(t, err)
assert.NotNil(t, qOpts)

qSvcOpts := qOpts.BuildQueryServiceOptionsV2(&mocks.Factory{}, zap.NewNop())
logger, logBuf := testutils.NewLogger()
qSvcOpts := qOpts.BuildQueryServiceOptions(uninitializedFn, logger)
assert.NotNil(t, qSvcOpts)
assert.NotNil(t, qSvcOpts.Adjuster)
assert.Nil(t, qSvcOpts.ArchiveTraceReader)
assert.Nil(t, qSvcOpts.ArchiveTraceWriter)
assert.Nil(t, qSvcOpts.ArchiveSpanReader)
assert.Nil(t, qSvcOpts.ArchiveSpanWriter)

comboFactory := struct {
*mocks.Factory
*mocks.ArchiveFactory
}{
&mocks.Factory{},
&mocks.ArchiveFactory{},
}
require.Contains(t, logBuf.String(), "Archive storage not initialized")
}

func TestBuildQueryServiceOptionsV2(t *testing.T) {
v, _ := config.Viperize(AddFlags)
qOpts, err := new(QueryOptions).InitFromViper(v, zap.NewNop())
require.NoError(t, err)
assert.NotNil(t, qOpts)

comboFactory.ArchiveFactory.On("CreateArchiveSpanReader").Return(&spanstore_mocks.Reader{}, nil)
comboFactory.ArchiveFactory.On("CreateArchiveSpanWriter").Return(&spanstore_mocks.Writer{}, nil)
qSvcOpts := qOpts.BuildQueryServiceOptionsV2(initializedFn, zap.NewNop())

qSvcOpts = qOpts.BuildQueryServiceOptionsV2(comboFactory, zap.NewNop())
assert.NotNil(t, qSvcOpts)
assert.NotNil(t, qSvcOpts.Adjuster)
assert.NotNil(t, qSvcOpts.ArchiveTraceReader)
Expand All @@ -153,7 +144,7 @@ func TestBuildQueryServiceOptionsV2_NoArchiveStorage(t *testing.T) {
assert.NotNil(t, qOpts)

logger, logBuf := testutils.NewLogger()
qSvcOpts := qOpts.BuildQueryServiceOptionsV2(&mocks.Factory{}, logger)
qSvcOpts := qOpts.BuildQueryServiceOptionsV2(uninitializedFn, logger)
assert.Nil(t, qSvcOpts.ArchiveTraceReader)
assert.Nil(t, qSvcOpts.ArchiveTraceWriter)

Expand Down
33 changes: 0 additions & 33 deletions cmd/query/app/querysvc/query_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ import (
"errors"
"time"

"go.uber.org/zap"

"github.com/jaegertracing/jaeger-idl/model/v1"
"github.com/jaegertracing/jaeger/model/adjuster"
"github.com/jaegertracing/jaeger/storage"
"github.com/jaegertracing/jaeger/storage/spanstore"
"github.com/jaegertracing/jaeger/storage_v2/depstore"
"github.com/jaegertracing/jaeger/storage_v2/tracestore"
Expand Down Expand Up @@ -164,36 +161,6 @@ func (qs QueryService) GetCapabilities() StorageCapabilities {
}
}

// InitArchiveStorage tries to initialize archive storage reader/writer if storage factory supports them.
func (opts *QueryServiceOptions) InitArchiveStorage(storageFactory storage.BaseFactory, logger *zap.Logger) bool {
archiveFactory, ok := storageFactory.(storage.ArchiveFactory)
if !ok {
logger.Info("Archive storage not supported by the factory")
return false
}
reader, err := archiveFactory.CreateArchiveSpanReader()
if errors.Is(err, storage.ErrArchiveStorageNotConfigured) || errors.Is(err, storage.ErrArchiveStorageNotSupported) {
logger.Info("Archive storage not created", zap.String("reason", err.Error()))
return false
}
if err != nil {
logger.Error("Cannot init archive storage reader", zap.Error(err))
return false
}
writer, err := archiveFactory.CreateArchiveSpanWriter()
if errors.Is(err, storage.ErrArchiveStorageNotConfigured) || errors.Is(err, storage.ErrArchiveStorageNotSupported) {
logger.Info("Archive storage not created", zap.String("reason", err.Error()))
return false
}
if err != nil {
logger.Error("Cannot init archive storage writer", zap.Error(err))
return false
}
opts.ArchiveSpanReader = reader
opts.ArchiveSpanWriter = writer
return true
}

// hasArchiveStorage returns true if archive storage reader/writer are initialized.
func (opts *QueryServiceOptions) hasArchiveStorage() bool {
return opts.ArchiveSpanReader != nil && opts.ArchiveSpanWriter != nil
Expand Down
52 changes: 1 addition & 51 deletions cmd/query/app/querysvc/query_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,64 +451,14 @@ func TestGetCapabilitiesWithSupportsArchive(t *testing.T) {

type fakeStorageFactory1 struct{}

type fakeStorageFactory2 struct {
fakeStorageFactory1
r spanstore.Reader
w spanstore.Writer
rErr error
wErr error
}

func (*fakeStorageFactory1) Initialize(metrics.Factory, *zap.Logger) error {
return nil
}
func (*fakeStorageFactory1) CreateSpanReader() (spanstore.Reader, error) { return nil, nil }
func (*fakeStorageFactory1) CreateSpanWriter() (spanstore.Writer, error) { return nil, nil }
func (*fakeStorageFactory1) CreateDependencyReader() (dependencystore.Reader, error) { return nil, nil }

func (f *fakeStorageFactory2) CreateArchiveSpanReader() (spanstore.Reader, error) { return f.r, f.rErr }
func (f *fakeStorageFactory2) CreateArchiveSpanWriter() (spanstore.Writer, error) { return f.w, f.wErr }

var (
_ storage.Factory = new(fakeStorageFactory1)
_ storage.ArchiveFactory = new(fakeStorageFactory2)
)

func TestInitArchiveStorageErrors(t *testing.T) {
opts := &QueryServiceOptions{}
logger := zap.NewNop()

assert.False(t, opts.InitArchiveStorage(new(fakeStorageFactory1), logger))
assert.False(t, opts.InitArchiveStorage(
&fakeStorageFactory2{rErr: storage.ErrArchiveStorageNotConfigured},
logger,
))
assert.False(t, opts.InitArchiveStorage(
&fakeStorageFactory2{rErr: errors.New("error")},
logger,
))
assert.False(t, opts.InitArchiveStorage(
&fakeStorageFactory2{wErr: storage.ErrArchiveStorageNotConfigured},
logger,
))
assert.False(t, opts.InitArchiveStorage(
&fakeStorageFactory2{wErr: errors.New("error")},
logger,
))
}

func TestInitArchiveStorage(t *testing.T) {
opts := &QueryServiceOptions{}
logger := zap.NewNop()
reader := &spanstoremocks.Reader{}
writer := &spanstoremocks.Writer{}
assert.True(t, opts.InitArchiveStorage(
&fakeStorageFactory2{r: reader, w: writer},
logger,
))
assert.Equal(t, reader, opts.ArchiveSpanReader)
assert.Equal(t, writer, opts.ArchiveSpanWriter)
}
var _ storage.Factory = new(fakeStorageFactory1)

func TestMain(m *testing.M) {
testutils.VerifyGoLeaks(m)
Expand Down
2 changes: 1 addition & 1 deletion cmd/query/app/token_propagation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func runQueryService(t *testing.T, esURL string) *Server {
}))
f.InitFromViper(v, flagsSvc.Logger)
// set AllowTokenFromContext manually because we don't register the respective CLI flag from query svc
f.Options.Primary.Authentication.BearerTokenAuthentication.AllowFromContext = true
f.Options.Config.Authentication.BearerTokenAuthentication.AllowFromContext = true
require.NoError(t, f.Initialize(telset.Metrics, telset.Logger))
defer f.Close()

Expand Down
10 changes: 8 additions & 2 deletions cmd/query/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,19 @@ func main() {
if err != nil {
logger.Fatal("Failed to create metrics query service", zap.Error(err))
}
queryServiceOptions := queryOpts.BuildQueryServiceOptions(storageFactory, logger)
queryServiceOptions := queryOpts.BuildQueryServiceOptions(
storageFactory.InitArchiveStorage,
logger,
)
queryService := querysvc.NewQueryService(
traceReader,
dependencyReader,
*queryServiceOptions)

queryServiceOptionsV2 := queryOpts.BuildQueryServiceOptionsV2(storageFactory, logger)
queryServiceOptionsV2 := queryOpts.BuildQueryServiceOptionsV2(
storageFactory.InitArchiveStorage,
logger,
)
queryServiceV2 := querysvcv2.NewQueryService(
traceReader,
dependencyReader,
Expand Down
Loading
Loading