diff --git a/cmd/anonymizer/app/query/query_test.go b/cmd/anonymizer/app/query/query_test.go index 86b7fd55ed8..8d91ba5febd 100644 --- a/cmd/anonymizer/app/query/query_test.go +++ b/cmd/anonymizer/app/query/query_test.go @@ -21,6 +21,7 @@ import ( dependencyStoreMocks "github.com/jaegertracing/jaeger/storage/dependencystore/mocks" "github.com/jaegertracing/jaeger/storage/spanstore" spanstoremocks "github.com/jaegertracing/jaeger/storage/spanstore/mocks" + "github.com/jaegertracing/jaeger/storage_v2/factoryadapter" ) var ( @@ -55,11 +56,12 @@ type testServer struct { func newTestServer(t *testing.T) *testServer { spanReader := &spanstoremocks.Reader{} + traceReader := factoryadapter.NewTraceReader(spanReader) metricsReader, err := disabled.NewMetricsReader() require.NoError(t, err) q := querysvc.NewQueryService( - spanReader, + traceReader, &dependencyStoreMocks.Reader{}, querysvc.QueryServiceOptions{}, ) diff --git a/cmd/query/app/apiv3/grpc_handler_test.go b/cmd/query/app/apiv3/grpc_handler_test.go index bb3c08d9b59..36297505292 100644 --- a/cmd/query/app/apiv3/grpc_handler_test.go +++ b/cmd/query/app/apiv3/grpc_handler_test.go @@ -23,6 +23,7 @@ import ( dependencyStoreMocks "github.com/jaegertracing/jaeger/storage/dependencystore/mocks" "github.com/jaegertracing/jaeger/storage/spanstore" spanstoremocks "github.com/jaegertracing/jaeger/storage/spanstore/mocks" + "github.com/jaegertracing/jaeger/storage_v2/factoryadapter" ) var ( @@ -57,7 +58,7 @@ func newTestServerClient(t *testing.T) *testServerClient { } q := querysvc.NewQueryService( - tsc.reader, + factoryadapter.NewTraceReader(tsc.reader), &dependencyStoreMocks.Reader{}, querysvc.QueryServiceOptions{}, ) diff --git a/cmd/query/app/apiv3/http_gateway_test.go b/cmd/query/app/apiv3/http_gateway_test.go index 6feaba989c6..5f742a0522f 100644 --- a/cmd/query/app/apiv3/http_gateway_test.go +++ b/cmd/query/app/apiv3/http_gateway_test.go @@ -25,6 +25,7 @@ import ( dependencyStoreMocks "github.com/jaegertracing/jaeger/storage/dependencystore/mocks" "github.com/jaegertracing/jaeger/storage/spanstore" spanstoremocks "github.com/jaegertracing/jaeger/storage/spanstore/mocks" + "github.com/jaegertracing/jaeger/storage_v2/factoryadapter" ) func setupHTTPGatewayNoServer( @@ -35,7 +36,7 @@ func setupHTTPGatewayNoServer( reader: &spanstoremocks.Reader{}, } - q := querysvc.NewQueryService(gw.reader, + q := querysvc.NewQueryService(factoryadapter.NewTraceReader(gw.reader), &dependencyStoreMocks.Reader{}, querysvc.QueryServiceOptions{}, ) diff --git a/cmd/query/app/grpc_handler_test.go b/cmd/query/app/grpc_handler_test.go index 016ee19b77f..2e364d35562 100644 --- a/cmd/query/app/grpc_handler_test.go +++ b/cmd/query/app/grpc_handler_test.go @@ -33,6 +33,7 @@ import ( metricsmocks "github.com/jaegertracing/jaeger/storage/metricsstore/mocks" "github.com/jaegertracing/jaeger/storage/spanstore" spanstoremocks "github.com/jaegertracing/jaeger/storage/spanstore/mocks" + "github.com/jaegertracing/jaeger/storage_v2/factoryadapter" ) var ( @@ -901,7 +902,7 @@ func initializeTenantedTestServerGRPCWithOptions(t *testing.T, tm *tenancy.Manag require.NoError(t, err) q := querysvc.NewQueryService( - spanReader, + factoryadapter.NewTraceReader(spanReader), dependencyReader, querysvc.QueryServiceOptions{ ArchiveSpanReader: archiveSpanReader, @@ -1165,7 +1166,7 @@ func TestNewGRPCHandlerWithEmptyOptions(t *testing.T) { require.NoError(t, err) q := querysvc.NewQueryService( - &spanstoremocks.Reader{}, + factoryadapter.NewTraceReader(&spanstoremocks.Reader{}), &depsmocks.Reader{}, querysvc.QueryServiceOptions{}) diff --git a/cmd/query/app/http_handler_test.go b/cmd/query/app/http_handler_test.go index 5da9482af87..7bc8808c5c1 100644 --- a/cmd/query/app/http_handler_test.go +++ b/cmd/query/app/http_handler_test.go @@ -42,6 +42,7 @@ import ( metricsmocks "github.com/jaegertracing/jaeger/storage/metricsstore/mocks" "github.com/jaegertracing/jaeger/storage/spanstore" spanstoremocks "github.com/jaegertracing/jaeger/storage/spanstore/mocks" + "github.com/jaegertracing/jaeger/storage_v2/factoryadapter" ) const millisToNanosMultiplier = int64(time.Millisecond / time.Nanosecond) @@ -119,7 +120,8 @@ func initializeTestServerWithOptions( options = append(options, HandlerOptions.Logger(zaptest.NewLogger(t))) readStorage := &spanstoremocks.Reader{} dependencyStorage := &depsmocks.Reader{} - qs := querysvc.NewQueryService(readStorage, dependencyStorage, queryOptions) + traceReader := factoryadapter.NewTraceReader(readStorage) + qs := querysvc.NewQueryService(traceReader, dependencyStorage, queryOptions) r := NewRouter() apiHandler := NewAPIHandler(qs, options...) apiHandler.RegisterRoutes(r) @@ -198,8 +200,9 @@ func TestLogOnServerError(t *testing.T) { zapCore, logs := observer.New(zap.InfoLevel) logger := zap.New(zapCore) readStorage := &spanstoremocks.Reader{} + traceReader := factoryadapter.NewTraceReader(readStorage) dependencyStorage := &depsmocks.Reader{} - qs := querysvc.NewQueryService(readStorage, dependencyStorage, querysvc.QueryServiceOptions{}) + qs := querysvc.NewQueryService(traceReader, dependencyStorage, querysvc.QueryServiceOptions{}) h := NewAPIHandler(qs, HandlerOptions.Logger(logger)) e := errors.New("test error") h.handleError(&httptest.ResponseRecorder{}, e, http.StatusInternalServerError) diff --git a/cmd/query/app/querysvc/query_service_test.go b/cmd/query/app/querysvc/query_service_test.go index 582a4568509..9cf6cea9128 100644 --- a/cmd/query/app/querysvc/query_service_test.go +++ b/cmd/query/app/querysvc/query_service_test.go @@ -23,6 +23,7 @@ import ( depsmocks "github.com/jaegertracing/jaeger/storage/dependencystore/mocks" "github.com/jaegertracing/jaeger/storage/spanstore" spanstoremocks "github.com/jaegertracing/jaeger/storage/spanstore/mocks" + "github.com/jaegertracing/jaeger/storage_v2/factoryadapter" ) const millisToNanosMultiplier = int64(time.Millisecond / time.Nanosecond) @@ -87,6 +88,7 @@ func withAdjuster() testOption { func initializeTestService(optionAppliers ...testOption) *testQueryService { readStorage := &spanstoremocks.Reader{} + traceReader := factoryadapter.NewTraceReader(readStorage) dependencyStorage := &depsmocks.Reader{} options := QueryServiceOptions{} @@ -100,7 +102,7 @@ func initializeTestService(optionAppliers ...testOption) *testQueryService { optApplier(&tqs, &options) } - tqs.queryService = NewQueryService(readStorage, dependencyStorage, options) + tqs.queryService = NewQueryService(traceReader, dependencyStorage, options) return &tqs } diff --git a/cmd/query/app/server_test.go b/cmd/query/app/server_test.go index fbc7360483f..5649015f9be 100644 --- a/cmd/query/app/server_test.go +++ b/cmd/query/app/server_test.go @@ -43,6 +43,7 @@ import ( "github.com/jaegertracing/jaeger/proto-gen/api_v2" depsmocks "github.com/jaegertracing/jaeger/storage/dependencystore/mocks" spanstoremocks "github.com/jaegertracing/jaeger/storage/spanstore/mocks" + "github.com/jaegertracing/jaeger/storage_v2/factoryadapter" ) var testCertKeyLocation = "../../../pkg/config/tlscfg/testdata" @@ -331,10 +332,11 @@ type fakeQueryService struct { func makeQuerySvc() *fakeQueryService { spanReader := &spanstoremocks.Reader{} + traceReader := factoryadapter.NewTraceReader(spanReader) dependencyReader := &depsmocks.Reader{} expectedServices := []string{"test"} spanReader.On("GetServices", mock.AnythingOfType("*context.valueCtx")).Return(expectedServices, nil) - qs := querysvc.NewQueryService(spanReader, dependencyReader, querysvc.QueryServiceOptions{}) + qs := querysvc.NewQueryService(traceReader, dependencyReader, querysvc.QueryServiceOptions{}) return &fakeQueryService{ qs: qs, spanReader: spanReader, diff --git a/cmd/query/app/token_propagation_test.go b/cmd/query/app/token_propagation_test.go index 81ec248e4c6..ac4792b51a6 100644 --- a/cmd/query/app/token_propagation_test.go +++ b/cmd/query/app/token_propagation_test.go @@ -29,6 +29,7 @@ import ( "github.com/jaegertracing/jaeger/pkg/tenancy" "github.com/jaegertracing/jaeger/plugin/storage/es" "github.com/jaegertracing/jaeger/ports" + "github.com/jaegertracing/jaeger/storage_v2/factoryadapter" ) const ( @@ -83,8 +84,9 @@ func runQueryService(t *testing.T, esURL string) *Server { spanReader, err := f.CreateSpanReader() require.NoError(t, err) + traceReader := factoryadapter.NewTraceReader(spanReader) - querySvc := querysvc.NewQueryService(spanReader, nil, querysvc.QueryServiceOptions{}) + querySvc := querysvc.NewQueryService(traceReader, nil, querysvc.QueryServiceOptions{}) telset := telemetery.Setting{ Logger: flagsSvc.Logger, TracerProvider: jtracer.NoOp().OTEL,