From df9875ab8c6e787d833d9d9f11fab8b766f54a04 Mon Sep 17 00:00:00 2001 From: Mahad Zaryab Date: Sat, 30 Nov 2024 12:23:40 -0500 Subject: [PATCH] Fix Errors From Merge Commit Signed-off-by: Mahad Zaryab --- cmd/all-in-one/main.go | 7 ++----- .../internal/extension/jaegerquery/server.go | 16 ++++------------ .../extension/jaegerquery/server_test.go | 2 +- cmd/query/app/token_propagation_test.go | 2 +- cmd/query/main.go | 4 +--- 5 files changed, 9 insertions(+), 22 deletions(-) diff --git a/cmd/all-in-one/main.go b/cmd/all-in-one/main.go index e13d50ee961..fb84484233c 100644 --- a/cmd/all-in-one/main.go +++ b/cmd/all-in-one/main.go @@ -39,11 +39,9 @@ import ( "github.com/jaegertracing/jaeger/plugin/storage" "github.com/jaegertracing/jaeger/ports" "github.com/jaegertracing/jaeger/storage/dependencystore" + "github.com/jaegertracing/jaeger/storage/metricsstore/metricstoremetrics" "github.com/jaegertracing/jaeger/storage_v2/factoryadapter" "github.com/jaegertracing/jaeger/storage_v2/spanstore" - "github.com/jaegertracing/jaeger/storage/metricsstore/metricstoremetrics" - "github.com/jaegertracing/jaeger/storage/spanstore" - "github.com/jaegertracing/jaeger/storage/spanstore/spanstoremetrics" ) // all-in-one/main is a standalone full-stack jaeger backend, backed by a memory store @@ -226,8 +224,7 @@ func startQuery( tm *tenancy.Manager, telset telemetry.Settings, ) *queryApp.Server { - spanReader = spanstoremetrics.NewReaderDecorator(spanReader, telset.Metrics) - qs := querysvc.NewQueryService(spanReader, depReader, *queryOpts) + qs := querysvc.NewQueryService(traceReader, depReader, *queryOpts) server, err := queryApp.NewServer(context.Background(), qs, metricsQueryService, qOpts, tm, telset) if err != nil { diff --git a/cmd/jaeger/internal/extension/jaegerquery/server.go b/cmd/jaeger/internal/extension/jaegerquery/server.go index e99819e0f2d..30eeab616b4 100644 --- a/cmd/jaeger/internal/extension/jaegerquery/server.go +++ b/cmd/jaeger/internal/extension/jaegerquery/server.go @@ -23,7 +23,6 @@ import ( "github.com/jaegertracing/jaeger/plugin/metrics/disabled" "github.com/jaegertracing/jaeger/storage/metricsstore" "github.com/jaegertracing/jaeger/storage/metricsstore/metricstoremetrics" - "github.com/jaegertracing/jaeger/storage/spanstore/spanstoremetrics" ) var ( @@ -52,10 +51,6 @@ func (*server) Dependencies() []component.ID { } func (s *server) Start(ctx context.Context, host component.Host) error { - mf := otelmetrics.NewFactory(s.telset.MeterProvider) - baseFactory := mf.Namespace(metrics.NSOptions{Name: "jaeger"}) - queryMetricsFactory := baseFactory.Namespace(metrics.NSOptions{Name: "query"}) - v1Factory, err := jaegerstorage.GetStorageFactory(s.config.Storage.TracesPrimary, host) // TODO OTel-collector does not initialize the tracer currently // https://github.com/open-telemetry/opentelemetry-collector/issues/7532 //nolint @@ -79,23 +74,20 @@ func (s *server) Start(ctx context.Context, host component.Host) error { Namespace(metrics.NSOptions{Name: "jaeger"}). Namespace(metrics.NSOptions{Name: "query"}) - f, err := jaegerstorage.GetStorageFactory(s.config.Storage.TracesPrimary, host) + v1Factory, err := jaegerstorage.GetStorageFactory(s.config.Storage.TracesPrimary, host) if err != nil { return fmt.Errorf("cannot find primary storage from v1 factory %s: %w", s.config.Storage.TracesPrimary, err) } - v2Factory, err := jaegerstorage.GetStorageFactoryV2(s.config.Storage.TracesPrimary, host) + f, err := jaegerstorage.GetStorageFactoryV2(s.config.Storage.TracesPrimary, host) if err != nil { return fmt.Errorf("cannot find primary storage from v2 factory %s: %w", s.config.Storage.TracesPrimary, err) } - v1Factory.CreateSpanReader() - traceReader, err := v2Factory.CreateTraceReader() + traceReader, err := f.CreateTraceReader() if err != nil { - return fmt.Errorf("cannot create span reader: %w", err) + return fmt.Errorf("cannot create trace reader: %w", err) } - spanReader = spanstoremetrics.NewReaderDecorator(spanReader, telset.Metrics) - depReader, err := v1Factory.CreateDependencyReader() if err != nil { return fmt.Errorf("cannot create dependencies reader: %w", err) diff --git a/cmd/jaeger/internal/extension/jaegerquery/server_test.go b/cmd/jaeger/internal/extension/jaegerquery/server_test.go index 54b3733f24c..eaf436ba8d1 100644 --- a/cmd/jaeger/internal/extension/jaegerquery/server_test.go +++ b/cmd/jaeger/internal/extension/jaegerquery/server_test.go @@ -158,7 +158,7 @@ func TestServerStart(t *testing.T) { TracesPrimary: "need-span-reader-error", }, }, - expectedErr: "cannot create span reader", + expectedErr: "cannot create trace reader", }, { name: "dependency error", diff --git a/cmd/query/app/token_propagation_test.go b/cmd/query/app/token_propagation_test.go index 5ce7ae4ac14..0a48802f37b 100644 --- a/cmd/query/app/token_propagation_test.go +++ b/cmd/query/app/token_propagation_test.go @@ -88,7 +88,7 @@ func runQueryService(t *testing.T, esURL string) *Server { require.NoError(t, err) traceReader := factoryadapter.NewTraceReader(spanReader) - querySvc := querysvc.NewQueryService(spanReader, nil, querysvc.QueryServiceOptions{}) + querySvc := querysvc.NewQueryService(traceReader, nil, querysvc.QueryServiceOptions{}) server, err := NewServer(context.Background(), querySvc, nil, &QueryOptions{ BearerTokenPropagation: true, diff --git a/cmd/query/main.go b/cmd/query/main.go index 82b571500ec..0e7bd303e35 100644 --- a/cmd/query/main.go +++ b/cmd/query/main.go @@ -32,9 +32,8 @@ import ( metricsPlugin "github.com/jaegertracing/jaeger/plugin/metrics" "github.com/jaegertracing/jaeger/plugin/storage" "github.com/jaegertracing/jaeger/ports" - "github.com/jaegertracing/jaeger/storage_v2/factoryadapter" "github.com/jaegertracing/jaeger/storage/metricsstore/metricstoremetrics" - "github.com/jaegertracing/jaeger/storage/spanstore/spanstoremetrics" + "github.com/jaegertracing/jaeger/storage_v2/factoryadapter" ) func main() { @@ -97,7 +96,6 @@ func main() { if err != nil { logger.Fatal("Failed to create trace reader", zap.Error(err)) } - spanReader = spanstoremetrics.NewReaderDecorator(spanReader, metricsFactory) dependencyReader, err := storageFactory.CreateDependencyReader() if err != nil { logger.Fatal("Failed to create dependency reader", zap.Error(err))