From 3908c5a56d2f77353e1dc53732b70ce1b56819bc Mon Sep 17 00:00:00 2001 From: Ebenezer Date: Thu, 19 Dec 2024 14:02:09 +0100 Subject: [PATCH] Initialize StorageIntegration with v2 TraceReader for each storage backend Signed-off-by: Ebenezer Signed-off-by: Emmanuel Emonueje Ebenezer --- plugin/storage/integration/badgerstore_test.go | 6 ++++-- plugin/storage/integration/cassandra_test.go | 4 +++- plugin/storage/integration/elasticsearch_test.go | 4 +++- plugin/storage/integration/grpc_test.go | 4 +++- plugin/storage/integration/kafka_test.go | 4 +++- plugin/storage/integration/memstore_test.go | 4 +++- 6 files changed, 19 insertions(+), 7 deletions(-) diff --git a/plugin/storage/integration/badgerstore_test.go b/plugin/storage/integration/badgerstore_test.go index 6bec5b453656..29d68edd4cda 100644 --- a/plugin/storage/integration/badgerstore_test.go +++ b/plugin/storage/integration/badgerstore_test.go @@ -14,6 +14,7 @@ import ( "github.com/jaegertracing/jaeger/pkg/metrics" "github.com/jaegertracing/jaeger/pkg/testutils" "github.com/jaegertracing/jaeger/plugin/storage/badger" + "github.com/jaegertracing/jaeger/storage_v2/v1adapter" ) type BadgerIntegrationStorage struct { @@ -35,9 +36,10 @@ func (s *BadgerIntegrationStorage) initialize(t *testing.T) { s.SpanWriter, err = s.factory.CreateSpanWriter() require.NoError(t, err) - s.SpanReader, err = s.factory.CreateSpanReader() + spanReader, err := s.factory.CreateSpanReader() require.NoError(t, err) - + s.TraceReader = v1adapter.NewTraceReader(spanReader) + s.SamplingStore, err = s.factory.CreateSamplingStore(0) require.NoError(t, err) } diff --git a/plugin/storage/integration/cassandra_test.go b/plugin/storage/integration/cassandra_test.go index 41d67c94544e..559529498d96 100644 --- a/plugin/storage/integration/cassandra_test.go +++ b/plugin/storage/integration/cassandra_test.go @@ -19,6 +19,7 @@ import ( "github.com/jaegertracing/jaeger/pkg/testutils" "github.com/jaegertracing/jaeger/plugin/storage/cassandra" "github.com/jaegertracing/jaeger/storage/dependencystore" + "github.com/jaegertracing/jaeger/storage_v2/v1adapter" ) type CassandraStorageIntegration struct { @@ -74,8 +75,9 @@ func (s *CassandraStorageIntegration) initializeCassandra(t *testing.T) { var err error s.SpanWriter, err = f.CreateSpanWriter() require.NoError(t, err) - s.SpanReader, err = f.CreateSpanReader() + spanReader, err := f.CreateSpanReader() require.NoError(t, err) + s.TraceReader = v1adapter.NewTraceReader(spanReader) s.ArchiveSpanReader, err = f.CreateArchiveSpanReader() require.NoError(t, err) s.ArchiveSpanWriter, err = f.CreateArchiveSpanWriter() diff --git a/plugin/storage/integration/elasticsearch_test.go b/plugin/storage/integration/elasticsearch_test.go index cd5cfe474647..5bc8ea02b162 100644 --- a/plugin/storage/integration/elasticsearch_test.go +++ b/plugin/storage/integration/elasticsearch_test.go @@ -26,6 +26,7 @@ import ( "github.com/jaegertracing/jaeger/pkg/testutils" "github.com/jaegertracing/jaeger/plugin/storage/es" "github.com/jaegertracing/jaeger/storage/dependencystore" + "github.com/jaegertracing/jaeger/storage_v2/v1adapter" ) const ( @@ -134,8 +135,9 @@ func (s *ESStorageIntegration) initSpanstore(t *testing.T, allTagsAsFields bool) var err error s.SpanWriter, err = f.CreateSpanWriter() require.NoError(t, err) - s.SpanReader, err = f.CreateSpanReader() + spanReader, err := f.CreateSpanReader() require.NoError(t, err) + s.TraceReader = v1adapter.NewTraceReader(spanReader) s.ArchiveSpanReader, err = f.CreateArchiveSpanReader() require.NoError(t, err) s.ArchiveSpanWriter, err = f.CreateArchiveSpanWriter() diff --git a/plugin/storage/integration/grpc_test.go b/plugin/storage/integration/grpc_test.go index 8ca6df51ddbe..17e58887a1bb 100644 --- a/plugin/storage/integration/grpc_test.go +++ b/plugin/storage/integration/grpc_test.go @@ -15,6 +15,7 @@ import ( "github.com/jaegertracing/jaeger/pkg/metrics" "github.com/jaegertracing/jaeger/pkg/testutils" "github.com/jaegertracing/jaeger/plugin/storage/grpc" + "github.com/jaegertracing/jaeger/storage_v2/v1adapter" ) type GRPCStorageIntegrationTestSuite struct { @@ -38,8 +39,9 @@ func (s *GRPCStorageIntegrationTestSuite) initialize(t *testing.T) { s.SpanWriter, err = f.CreateSpanWriter() require.NoError(t, err) - s.SpanReader, err = f.CreateSpanReader() + spanReader, err := f.CreateSpanReader() require.NoError(t, err) + s.TraceReader = v1adapter.NewTraceReader(spanReader) s.ArchiveSpanReader, err = f.CreateArchiveSpanReader() require.NoError(t, err) s.ArchiveSpanWriter, err = f.CreateArchiveSpanWriter() diff --git a/plugin/storage/integration/kafka_test.go b/plugin/storage/integration/kafka_test.go index 24b2131993dc..2b42773ca4a8 100644 --- a/plugin/storage/integration/kafka_test.go +++ b/plugin/storage/integration/kafka_test.go @@ -25,6 +25,7 @@ import ( "github.com/jaegertracing/jaeger/plugin/storage/kafka" "github.com/jaegertracing/jaeger/plugin/storage/memory" "github.com/jaegertracing/jaeger/storage/spanstore" + "github.com/jaegertracing/jaeger/storage_v2/v1adapter" ) const defaultLocalKafkaBroker = "127.0.0.1:9092" @@ -91,7 +92,8 @@ func (s *KafkaIntegrationTestSuite) initialize(t *testing.T) { spanConsumer.Start() s.SpanWriter = spanWriter - s.SpanReader = &ingester{traceStore} + spanReader := &ingester{traceStore} + s.TraceReader = v1adapter.NewTraceReader(spanReader) s.CleanUp = func(_ *testing.T) {} s.SkipArchiveTest = true } diff --git a/plugin/storage/integration/memstore_test.go b/plugin/storage/integration/memstore_test.go index 35eaede75174..f910a2f6ed0f 100644 --- a/plugin/storage/integration/memstore_test.go +++ b/plugin/storage/integration/memstore_test.go @@ -11,6 +11,7 @@ import ( "github.com/jaegertracing/jaeger/pkg/testutils" "github.com/jaegertracing/jaeger/plugin/storage/memory" + "github.com/jaegertracing/jaeger/storage_v2/v1adapter" ) type MemStorageIntegrationTestSuite struct { @@ -24,7 +25,8 @@ func (s *MemStorageIntegrationTestSuite) initialize(_ *testing.T) { store := memory.NewStore() archiveStore := memory.NewStore() s.SamplingStore = memory.NewSamplingStore(2) - s.SpanReader = store + spanReader := store + s.TraceReader = v1adapter.NewTraceReader(spanReader) s.SpanWriter = store s.ArchiveSpanReader = archiveStore s.ArchiveSpanWriter = archiveStore