Skip to content

Commit

Permalink
Create Two Factories In Query Server
Browse files Browse the repository at this point in the history
Signed-off-by: Mahad Zaryab <[email protected]>
  • Loading branch information
mahadzaryab1 committed Nov 14, 2024
1 parent e3a8487 commit 377d27f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
13 changes: 9 additions & 4 deletions cmd/jaeger/internal/extension/jaegerquery/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,17 @@ func (s *server) Start(ctx context.Context, host component.Host) error {
baseFactory := mf.Namespace(metrics.NSOptions{Name: "jaeger"})
queryMetricsFactory := baseFactory.Namespace(metrics.NSOptions{Name: "query"})

f, err := jaegerstorage.GetStorageFactoryV2(s.config.Storage.TracesPrimary, host)
v1Factory, err := jaegerstorage.GetStorageFactory(s.config.Storage.TracesPrimary, host)
if err != nil {
return fmt.Errorf("cannot find primary storage %s: %w", s.config.Storage.TracesPrimary, err)
return fmt.Errorf("cannot find primary storage for v1 factory %s: %w", s.config.Storage.TracesPrimary, err)
}

traceReader, err := f.CreateTraceReader()
v2Factory, err := jaegerstorage.GetStorageFactoryV2(s.config.Storage.TracesPrimary, host)
if err != nil {
return fmt.Errorf("cannot find primary storage for v2 factory %s: %w", s.config.Storage.TracesPrimary, err)
}

Check warning on line 68 in cmd/jaeger/internal/extension/jaegerquery/server.go

View check run for this annotation

Codecov / codecov/patch

cmd/jaeger/internal/extension/jaegerquery/server.go#L67-L68

Added lines #L67 - L68 were not covered by tests

traceReader, err := v2Factory.CreateTraceReader()
if err != nil {
return fmt.Errorf("cannot create trace reader: %w", err)
}
Expand All @@ -74,7 +79,7 @@ func (s *server) Start(ctx context.Context, host component.Host) error {

spanReader = storageMetrics.NewReadMetricsDecorator(spanReader, queryMetricsFactory)

depReader, err := f.CreateDependencyReader()
depReader, err := v1Factory.CreateDependencyReader()
if err != nil {
return fmt.Errorf("cannot create dependencies reader: %w", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"io"

storage_v1 "github.com/jaegertracing/jaeger/storage"
"github.com/jaegertracing/jaeger/storage/dependencystore"
"github.com/jaegertracing/jaeger/storage_v2/spanstore"
)

Expand Down Expand Up @@ -52,8 +51,3 @@ func (f *Factory) CreateTraceWriter() (spanstore.Writer, error) {
}
return NewTraceWriter(spanWriter), nil
}

// CreateDependencyReader creates a dependencystore.Reader.
func (f *Factory) CreateDependencyReader() (dependencystore.Reader, error) {
return f.ss.CreateDependencyReader()
}
4 changes: 0 additions & 4 deletions storage_v2/spanstore/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package spanstore

import (
"github.com/jaegertracing/jaeger/storage/dependencystore"
"github.com/jaegertracing/jaeger/storage_v2"
)

Expand All @@ -18,7 +17,4 @@ type Factory interface {

// CreateTraceWriter creates a spanstore.Writer.
CreateTraceWriter() (Writer, error)

// CreateDependencyReader creates a dependencystore.Reader.
CreateDependencyReader() (dependencystore.Reader, error)
}

0 comments on commit 377d27f

Please sign in to comment.