From dad636be7adb8be29c8cbf984f5f06be18d661ac Mon Sep 17 00:00:00 2001 From: Yuri Shkuro Date: Sun, 15 Dec 2024 21:59:17 -0400 Subject: [PATCH] [refactor] Rename factoryadapter to v1adapter (#6365) ## Which problem is this PR solving? - `factoryadapter` was inaccurate name since it provides more than a factory ## Description of the changes - Rename `factoryadapter` package to `v1adapter` ## How was this change tested? - CI --------- Signed-off-by: Yuri Shkuro --- cmd/all-in-one/main.go | 4 ++-- cmd/anonymizer/app/query/query_test.go | 4 ++-- .../internal/extension/jaegerstorage/extension.go | 4 ++-- cmd/query/app/apiv3/grpc_handler_test.go | 6 +++--- cmd/query/app/apiv3/http_gateway_test.go | 4 ++-- cmd/query/app/grpc_handler_test.go | 6 +++--- cmd/query/app/http_handler_test.go | 6 +++--- cmd/query/app/querysvc/query_service.go | 10 +++++----- cmd/query/app/querysvc/query_service_test.go | 4 ++-- cmd/query/app/server_test.go | 4 ++-- cmd/query/app/token_propagation_test.go | 4 ++-- cmd/query/main.go | 4 ++-- storage_v2/{factoryadapter => v1adapter}/README.md | 0 storage_v2/{factoryadapter => v1adapter}/factory.go | 2 +- .../{factoryadapter => v1adapter}/factory_test.go | 2 +- .../{factoryadapter => v1adapter}/package_test.go | 2 +- storage_v2/{factoryadapter => v1adapter}/reader.go | 2 +- .../{factoryadapter => v1adapter}/reader_test.go | 2 +- storage_v2/{factoryadapter => v1adapter}/writer.go | 2 +- .../{factoryadapter => v1adapter}/writer_test.go | 2 +- 20 files changed, 37 insertions(+), 37 deletions(-) rename storage_v2/{factoryadapter => v1adapter}/README.md (100%) rename storage_v2/{factoryadapter => v1adapter}/factory.go (98%) rename storage_v2/{factoryadapter => v1adapter}/factory_test.go (99%) rename storage_v2/{factoryadapter => v1adapter}/package_test.go (90%) rename storage_v2/{factoryadapter => v1adapter}/reader.go (99%) rename storage_v2/{factoryadapter => v1adapter}/reader_test.go (99%) rename storage_v2/{factoryadapter => v1adapter}/writer.go (97%) rename storage_v2/{factoryadapter => v1adapter}/writer_test.go (98%) diff --git a/cmd/all-in-one/main.go b/cmd/all-in-one/main.go index 7f31b472945..180a538c4b3 100644 --- a/cmd/all-in-one/main.go +++ b/cmd/all-in-one/main.go @@ -39,8 +39,8 @@ import ( "github.com/jaegertracing/jaeger/plugin/storage" "github.com/jaegertracing/jaeger/ports" "github.com/jaegertracing/jaeger/storage_v2/depstore" - "github.com/jaegertracing/jaeger/storage_v2/factoryadapter" "github.com/jaegertracing/jaeger/storage_v2/tracestore" + "github.com/jaegertracing/jaeger/storage_v2/v1adapter" ) // all-in-one/main is a standalone full-stack jaeger backend, backed by a memory store @@ -106,7 +106,7 @@ by default uses only in-memory database.`, logger.Fatal("Failed to init storage factory", zap.Error(err)) } - v2Factory := factoryadapter.NewFactory(storageFactory) + v2Factory := v1adapter.NewFactory(storageFactory) traceReader, err := v2Factory.CreateTraceReader() if err != nil { logger.Fatal("Failed to create span reader", zap.Error(err)) diff --git a/cmd/anonymizer/app/query/query_test.go b/cmd/anonymizer/app/query/query_test.go index a4a7ed241dd..8f350a191a0 100644 --- a/cmd/anonymizer/app/query/query_test.go +++ b/cmd/anonymizer/app/query/query_test.go @@ -21,7 +21,7 @@ import ( "github.com/jaegertracing/jaeger/storage/spanstore" spanstoremocks "github.com/jaegertracing/jaeger/storage/spanstore/mocks" dependencyStoreMocks "github.com/jaegertracing/jaeger/storage_v2/depstore/mocks" - "github.com/jaegertracing/jaeger/storage_v2/factoryadapter" + "github.com/jaegertracing/jaeger/storage_v2/v1adapter" ) var ( @@ -56,7 +56,7 @@ type testServer struct { func newTestServer(t *testing.T) *testServer { spanReader := &spanstoremocks.Reader{} - traceReader := factoryadapter.NewTraceReader(spanReader) + traceReader := v1adapter.NewTraceReader(spanReader) metricsReader, err := disabled.NewMetricsReader() require.NoError(t, err) diff --git a/cmd/jaeger/internal/extension/jaegerstorage/extension.go b/cmd/jaeger/internal/extension/jaegerstorage/extension.go index c1dd68b01b7..53e29a07d7e 100644 --- a/cmd/jaeger/internal/extension/jaegerstorage/extension.go +++ b/cmd/jaeger/internal/extension/jaegerstorage/extension.go @@ -21,8 +21,8 @@ import ( "github.com/jaegertracing/jaeger/plugin/storage/grpc" "github.com/jaegertracing/jaeger/plugin/storage/memory" "github.com/jaegertracing/jaeger/storage" - "github.com/jaegertracing/jaeger/storage_v2/factoryadapter" "github.com/jaegertracing/jaeger/storage_v2/tracestore" + "github.com/jaegertracing/jaeger/storage_v2/v1adapter" ) var _ Extension = (*storageExt)(nil) @@ -80,7 +80,7 @@ func GetTraceStoreFactory(name string, host component.Host) (tracestore.Factory, return nil, err } - return factoryadapter.NewFactory(f), nil + return v1adapter.NewFactory(f), nil } func findExtension(host component.Host) (Extension, error) { diff --git a/cmd/query/app/apiv3/grpc_handler_test.go b/cmd/query/app/apiv3/grpc_handler_test.go index ffadfbb9ac5..b40ec48e3c2 100644 --- a/cmd/query/app/apiv3/grpc_handler_test.go +++ b/cmd/query/app/apiv3/grpc_handler_test.go @@ -23,7 +23,7 @@ import ( "github.com/jaegertracing/jaeger/storage/spanstore" spanstoremocks "github.com/jaegertracing/jaeger/storage/spanstore/mocks" dependencyStoreMocks "github.com/jaegertracing/jaeger/storage_v2/depstore/mocks" - "github.com/jaegertracing/jaeger/storage_v2/factoryadapter" + "github.com/jaegertracing/jaeger/storage_v2/v1adapter" ) var ( @@ -58,7 +58,7 @@ func newTestServerClient(t *testing.T) *testServerClient { } q := querysvc.NewQueryService( - factoryadapter.NewTraceReader(tsc.reader), + v1adapter.NewTraceReader(tsc.reader), &dependencyStoreMocks.Reader{}, querysvc.QueryServiceOptions{}, ) @@ -211,7 +211,7 @@ func TestFindTracesSendError(t *testing.T) { }, nil).Once() h := &Handler{ QueryService: querysvc.NewQueryService( - factoryadapter.NewTraceReader(reader), + v1adapter.NewTraceReader(reader), new(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 4dcdbbafa9d..66fda73ef17 100644 --- a/cmd/query/app/apiv3/http_gateway_test.go +++ b/cmd/query/app/apiv3/http_gateway_test.go @@ -23,7 +23,7 @@ import ( "github.com/jaegertracing/jaeger/storage/spanstore" spanstoremocks "github.com/jaegertracing/jaeger/storage/spanstore/mocks" dependencyStoreMocks "github.com/jaegertracing/jaeger/storage_v2/depstore/mocks" - "github.com/jaegertracing/jaeger/storage_v2/factoryadapter" + "github.com/jaegertracing/jaeger/storage_v2/v1adapter" ) func setupHTTPGatewayNoServer( @@ -34,7 +34,7 @@ func setupHTTPGatewayNoServer( reader: &spanstoremocks.Reader{}, } - q := querysvc.NewQueryService(factoryadapter.NewTraceReader(gw.reader), + q := querysvc.NewQueryService(v1adapter.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 b3c8b93e5ba..aeaecf4be80 100644 --- a/cmd/query/app/grpc_handler_test.go +++ b/cmd/query/app/grpc_handler_test.go @@ -34,7 +34,7 @@ import ( spanstoremocks "github.com/jaegertracing/jaeger/storage/spanstore/mocks" "github.com/jaegertracing/jaeger/storage_v2/depstore" depsmocks "github.com/jaegertracing/jaeger/storage_v2/depstore/mocks" - "github.com/jaegertracing/jaeger/storage_v2/factoryadapter" + "github.com/jaegertracing/jaeger/storage_v2/v1adapter" ) var ( @@ -950,7 +950,7 @@ func initializeTenantedTestServerGRPCWithOptions(t *testing.T, tm *tenancy.Manag require.NoError(t, err) q := querysvc.NewQueryService( - factoryadapter.NewTraceReader(spanReader), + v1adapter.NewTraceReader(spanReader), dependencyReader, querysvc.QueryServiceOptions{ ArchiveSpanReader: archiveSpanReader, @@ -1214,7 +1214,7 @@ func TestNewGRPCHandlerWithEmptyOptions(t *testing.T) { require.NoError(t, err) q := querysvc.NewQueryService( - factoryadapter.NewTraceReader(&spanstoremocks.Reader{}), + v1adapter.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 6c09caa155f..126e4c194bb 100644 --- a/cmd/query/app/http_handler_test.go +++ b/cmd/query/app/http_handler_test.go @@ -42,7 +42,7 @@ import ( "github.com/jaegertracing/jaeger/storage/spanstore" spanstoremocks "github.com/jaegertracing/jaeger/storage/spanstore/mocks" depsmocks "github.com/jaegertracing/jaeger/storage_v2/depstore/mocks" - "github.com/jaegertracing/jaeger/storage_v2/factoryadapter" + "github.com/jaegertracing/jaeger/storage_v2/v1adapter" ) const millisToNanosMultiplier = int64(time.Millisecond / time.Nanosecond) @@ -122,7 +122,7 @@ func initializeTestServerWithOptions( options = append(options, HandlerOptions.Logger(zaptest.NewLogger(t))) readStorage := &spanstoremocks.Reader{} dependencyStorage := &depsmocks.Reader{} - traceReader := factoryadapter.NewTraceReader(readStorage) + traceReader := v1adapter.NewTraceReader(readStorage) qs := querysvc.NewQueryService(traceReader, dependencyStorage, queryOptions) r := NewRouter() apiHandler := NewAPIHandler(qs, options...) @@ -202,7 +202,7 @@ func TestLogOnServerError(t *testing.T) { zapCore, logs := observer.New(zap.InfoLevel) logger := zap.New(zapCore) readStorage := &spanstoremocks.Reader{} - traceReader := factoryadapter.NewTraceReader(readStorage) + traceReader := v1adapter.NewTraceReader(readStorage) dependencyStorage := &depsmocks.Reader{} qs := querysvc.NewQueryService(traceReader, dependencyStorage, querysvc.QueryServiceOptions{}) h := NewAPIHandler(qs, HandlerOptions.Logger(logger)) diff --git a/cmd/query/app/querysvc/query_service.go b/cmd/query/app/querysvc/query_service.go index 02abd07074a..724a2536583 100644 --- a/cmd/query/app/querysvc/query_service.go +++ b/cmd/query/app/querysvc/query_service.go @@ -15,8 +15,8 @@ import ( "github.com/jaegertracing/jaeger/storage" "github.com/jaegertracing/jaeger/storage/spanstore" "github.com/jaegertracing/jaeger/storage_v2/depstore" - "github.com/jaegertracing/jaeger/storage_v2/factoryadapter" "github.com/jaegertracing/jaeger/storage_v2/tracestore" + "github.com/jaegertracing/jaeger/storage_v2/v1adapter" ) var errNoArchiveSpanStorage = errors.New("archive span storage was not configured") @@ -63,7 +63,7 @@ func NewQueryService(traceReader tracestore.Reader, dependencyReader depstore.Re // GetTrace is the queryService implementation of spanstore.Reader.GetTrace func (qs QueryService) GetTrace(ctx context.Context, query spanstore.GetTraceParameters) (*model.Trace, error) { - spanReader, err := factoryadapter.GetV1Reader(qs.traceReader) + spanReader, err := v1adapter.GetV1Reader(qs.traceReader) if err != nil { return nil, err } @@ -79,7 +79,7 @@ func (qs QueryService) GetTrace(ctx context.Context, query spanstore.GetTracePar // GetServices is the queryService implementation of spanstore.Reader.GetServices func (qs QueryService) GetServices(ctx context.Context) ([]string, error) { - spanReader, err := factoryadapter.GetV1Reader(qs.traceReader) + spanReader, err := v1adapter.GetV1Reader(qs.traceReader) if err != nil { return nil, err } @@ -91,7 +91,7 @@ func (qs QueryService) GetOperations( ctx context.Context, query spanstore.OperationQueryParameters, ) ([]spanstore.Operation, error) { - spanReader, err := factoryadapter.GetV1Reader(qs.traceReader) + spanReader, err := v1adapter.GetV1Reader(qs.traceReader) if err != nil { return nil, err } @@ -100,7 +100,7 @@ func (qs QueryService) GetOperations( // FindTraces is the queryService implementation of spanstore.Reader.FindTraces func (qs QueryService) FindTraces(ctx context.Context, query *spanstore.TraceQueryParameters) ([]*model.Trace, error) { - spanReader, err := factoryadapter.GetV1Reader(qs.traceReader) + spanReader, err := v1adapter.GetV1Reader(qs.traceReader) if err != nil { return nil, err } diff --git a/cmd/query/app/querysvc/query_service_test.go b/cmd/query/app/querysvc/query_service_test.go index 10a3b21e5af..2b1176cf96f 100644 --- a/cmd/query/app/querysvc/query_service_test.go +++ b/cmd/query/app/querysvc/query_service_test.go @@ -24,8 +24,8 @@ import ( spanstoremocks "github.com/jaegertracing/jaeger/storage/spanstore/mocks" "github.com/jaegertracing/jaeger/storage_v2/depstore" depsmocks "github.com/jaegertracing/jaeger/storage_v2/depstore/mocks" - "github.com/jaegertracing/jaeger/storage_v2/factoryadapter" tracestoremocks "github.com/jaegertracing/jaeger/storage_v2/tracestore/mocks" + "github.com/jaegertracing/jaeger/storage_v2/v1adapter" ) const millisToNanosMultiplier = int64(time.Millisecond / time.Nanosecond) @@ -90,7 +90,7 @@ func withAdjuster() testOption { func initializeTestService(optionAppliers ...testOption) *testQueryService { readStorage := &spanstoremocks.Reader{} - traceReader := factoryadapter.NewTraceReader(readStorage) + traceReader := v1adapter.NewTraceReader(readStorage) dependencyStorage := &depsmocks.Reader{} options := QueryServiceOptions{} diff --git a/cmd/query/app/server_test.go b/cmd/query/app/server_test.go index f12723439a6..6a5a625bec6 100644 --- a/cmd/query/app/server_test.go +++ b/cmd/query/app/server_test.go @@ -42,7 +42,7 @@ import ( "github.com/jaegertracing/jaeger/storage/spanstore" spanstoremocks "github.com/jaegertracing/jaeger/storage/spanstore/mocks" depsmocks "github.com/jaegertracing/jaeger/storage_v2/depstore/mocks" - "github.com/jaegertracing/jaeger/storage_v2/factoryadapter" + "github.com/jaegertracing/jaeger/storage_v2/v1adapter" ) var testCertKeyLocation = "../../../pkg/config/tlscfg/testdata" @@ -324,7 +324,7 @@ type fakeQueryService struct { func makeQuerySvc() *fakeQueryService { spanReader := &spanstoremocks.Reader{} - traceReader := factoryadapter.NewTraceReader(spanReader) + traceReader := v1adapter.NewTraceReader(spanReader) dependencyReader := &depsmocks.Reader{} expectedServices := []string{"test"} spanReader.On("GetServices", mock.AnythingOfType("*context.valueCtx")).Return(expectedServices, nil) diff --git a/cmd/query/app/token_propagation_test.go b/cmd/query/app/token_propagation_test.go index 0a48802f37b..333904d7b0a 100644 --- a/cmd/query/app/token_propagation_test.go +++ b/cmd/query/app/token_propagation_test.go @@ -27,7 +27,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" + "github.com/jaegertracing/jaeger/storage_v2/v1adapter" ) const ( @@ -86,7 +86,7 @@ func runQueryService(t *testing.T, esURL string) *Server { spanReader, err := f.CreateSpanReader() require.NoError(t, err) - traceReader := factoryadapter.NewTraceReader(spanReader) + traceReader := v1adapter.NewTraceReader(spanReader) querySvc := querysvc.NewQueryService(traceReader, nil, querysvc.QueryServiceOptions{}) server, err := NewServer(context.Background(), querySvc, nil, diff --git a/cmd/query/main.go b/cmd/query/main.go index 1b8b353a7ae..a2250c9f6a1 100644 --- a/cmd/query/main.go +++ b/cmd/query/main.go @@ -32,7 +32,7 @@ import ( metricsPlugin "github.com/jaegertracing/jaeger/plugin/metricstore" "github.com/jaegertracing/jaeger/plugin/storage" "github.com/jaegertracing/jaeger/ports" - "github.com/jaegertracing/jaeger/storage_v2/factoryadapter" + "github.com/jaegertracing/jaeger/storage_v2/v1adapter" ) func main() { @@ -92,7 +92,7 @@ func main() { logger.Fatal("Failed to init storage factory", zap.Error(err)) } - v2Factory := factoryadapter.NewFactory(storageFactory) + v2Factory := v1adapter.NewFactory(storageFactory) traceReader, err := v2Factory.CreateTraceReader() if err != nil { logger.Fatal("Failed to create trace reader", zap.Error(err)) diff --git a/storage_v2/factoryadapter/README.md b/storage_v2/v1adapter/README.md similarity index 100% rename from storage_v2/factoryadapter/README.md rename to storage_v2/v1adapter/README.md diff --git a/storage_v2/factoryadapter/factory.go b/storage_v2/v1adapter/factory.go similarity index 98% rename from storage_v2/factoryadapter/factory.go rename to storage_v2/v1adapter/factory.go index 1eaaea146ed..243fccebf65 100644 --- a/storage_v2/factoryadapter/factory.go +++ b/storage_v2/v1adapter/factory.go @@ -1,7 +1,7 @@ // Copyright (c) 2024 The Jaeger Authors. // SPDX-License-Identifier: Apache-2.0 -package factoryadapter +package v1adapter import ( "context" diff --git a/storage_v2/factoryadapter/factory_test.go b/storage_v2/v1adapter/factory_test.go similarity index 99% rename from storage_v2/factoryadapter/factory_test.go rename to storage_v2/v1adapter/factory_test.go index d8794adf327..6222138e435 100644 --- a/storage_v2/factoryadapter/factory_test.go +++ b/storage_v2/v1adapter/factory_test.go @@ -1,7 +1,7 @@ // Copyright (c) 2024 The Jaeger Authors. // SPDX-License-Identifier: Apache-2.0 -package factoryadapter +package v1adapter import ( "context" diff --git a/storage_v2/factoryadapter/package_test.go b/storage_v2/v1adapter/package_test.go similarity index 90% rename from storage_v2/factoryadapter/package_test.go rename to storage_v2/v1adapter/package_test.go index 086d725c713..d97d8a197a2 100644 --- a/storage_v2/factoryadapter/package_test.go +++ b/storage_v2/v1adapter/package_test.go @@ -1,7 +1,7 @@ // Copyright (c) 2024 The Jaeger Authors. // SPDX-License-Identifier: Apache-2.0 -package factoryadapter +package v1adapter import ( "testing" diff --git a/storage_v2/factoryadapter/reader.go b/storage_v2/v1adapter/reader.go similarity index 99% rename from storage_v2/factoryadapter/reader.go rename to storage_v2/v1adapter/reader.go index d90a31479c8..a3d2293dd25 100644 --- a/storage_v2/factoryadapter/reader.go +++ b/storage_v2/v1adapter/reader.go @@ -1,7 +1,7 @@ // Copyright (c) 2024 The Jaeger Authors. // SPDX-License-Identifier: Apache-2.0 -package factoryadapter +package v1adapter import ( "context" diff --git a/storage_v2/factoryadapter/reader_test.go b/storage_v2/v1adapter/reader_test.go similarity index 99% rename from storage_v2/factoryadapter/reader_test.go rename to storage_v2/v1adapter/reader_test.go index c870b6a72d9..c142ee99c13 100644 --- a/storage_v2/factoryadapter/reader_test.go +++ b/storage_v2/v1adapter/reader_test.go @@ -1,7 +1,7 @@ // Copyright (c) 2024 The Jaeger Authors. // SPDX-License-Identifier: Apache-2.0 -package factoryadapter +package v1adapter import ( "context" diff --git a/storage_v2/factoryadapter/writer.go b/storage_v2/v1adapter/writer.go similarity index 97% rename from storage_v2/factoryadapter/writer.go rename to storage_v2/v1adapter/writer.go index a36355d7a89..c0a9d4ced99 100644 --- a/storage_v2/factoryadapter/writer.go +++ b/storage_v2/v1adapter/writer.go @@ -1,7 +1,7 @@ // Copyright (c) 2024 The Jaeger Authors. // SPDX-License-Identifier: Apache-2.0 -package factoryadapter +package v1adapter import ( "context" diff --git a/storage_v2/factoryadapter/writer_test.go b/storage_v2/v1adapter/writer_test.go similarity index 98% rename from storage_v2/factoryadapter/writer_test.go rename to storage_v2/v1adapter/writer_test.go index 68a09af6e4c..bc00c7ae0bd 100644 --- a/storage_v2/factoryadapter/writer_test.go +++ b/storage_v2/v1adapter/writer_test.go @@ -1,7 +1,7 @@ // Copyright (c) 2024 The Jaeger Authors. // SPDX-License-Identifier: Apache-2.0 -package factoryadapter +package v1adapter import ( "context"