- 
                Notifications
    
You must be signed in to change notification settings  - Fork 2.7k
 
[v2][storage] Implement read path for v2 storage interface #6170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c5600ba
              23c7700
              2b53471
              617c30c
              dcf6357
              1175e6e
              1683007
              840a679
              24a53df
              df9875a
              51bffb4
              226e3ca
              f4f6cfb
              4b712d1
              d76eeba
              a76d544
              5cad28e
              2bf30b6
              a0ccfe3
              9cbbce8
              9b181e4
              cbfeb0e
              d30b889
              6828667
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| 
          
            
          
           | 
    @@ -72,26 +72,32 @@ | |
| Namespace(metrics.NSOptions{Name: "jaeger"}). | ||
| Namespace(metrics.NSOptions{Name: "query"}) | ||
| 
     | 
||
| f, err := jaegerstorage.GetStorageFactory(s.config.Storage.TracesPrimary, host) | ||
| // TODO currently v1 is still needed because of dependency storage | ||
| v1Factory, err := jaegerstorage.GetStorageFactory(s.config.Storage.TracesPrimary, host) | ||
                
      
                  yurishkuro marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| if err != nil { | ||
| return fmt.Errorf("cannot find primary storage %s: %w", s.config.Storage.TracesPrimary, err) | ||
| return fmt.Errorf("cannot find v1 factory for primary storage %s: %w", s.config.Storage.TracesPrimary, err) | ||
| } | ||
| f, err := jaegerstorage.GetStorageFactoryV2(s.config.Storage.TracesPrimary, host) | ||
| if err != nil { | ||
| return fmt.Errorf("cannot find v2 factory for primary storage %s: %w", s.config.Storage.TracesPrimary, err) | ||
| } | ||
| 
     | 
||
| spanReader, err := f.CreateSpanReader() | ||
| 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) | ||
| } | ||
| 
     | 
||
| depReader, err := f.CreateDependencyReader() | ||
| depReader, err := v1Factory.CreateDependencyReader() | ||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would it make sense to create  There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @yurishkuro Sure. What do we want to put in that package?  | 
||
| if err != nil { | ||
| return fmt.Errorf("cannot create dependencies reader: %w", err) | ||
| } | ||
| 
     | 
||
| var opts querysvc.QueryServiceOptions | ||
| // TODO archive storage still uses v1 factory | ||
| if err := s.addArchiveStorage(&opts, host); err != nil { | ||
                
      
                  yurishkuro marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| return err | ||
| } | ||
| qs := querysvc.NewQueryService(spanReader, depReader, opts) | ||
| qs := querysvc.NewQueryService(traceReader, depReader, opts) | ||
| 
     | 
||
| mqs, err := s.createMetricReader(host) | ||
| if err != nil { | ||
| 
          
            
          
           | 
    ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| 
          
            
          
           | 
    @@ -15,6 +15,8 @@ import ( | |
| "github.com/jaegertracing/jaeger/storage" | ||
| "github.com/jaegertracing/jaeger/storage/dependencystore" | ||
| "github.com/jaegertracing/jaeger/storage/spanstore" | ||
| "github.com/jaegertracing/jaeger/storage_v2/factoryadapter" | ||
| "github.com/jaegertracing/jaeger/storage_v2/tracestore" | ||
| ) | ||
| 
     | 
||
| var errNoArchiveSpanStorage = errors.New("archive span storage was not configured") | ||
| 
        
          
        
         | 
    @@ -40,15 +42,15 @@ type StorageCapabilities struct { | |
| 
     | 
||
| // QueryService contains span utils required by the query-service. | ||
| type QueryService struct { | ||
| spanReader spanstore.Reader | ||
| traceReader tracestore.Reader | ||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what about archive reader/writer, any reason not to upgrade them too? (or PR is too large?) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @yurishkuro I initially thought that we couldn't do this yet because I thought we were using the  There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because of the other question (not having v2 reader fully implemented) it's ok to do these separately, no particular benefit afaict.  | 
||
| dependencyReader dependencystore.Reader | ||
| options QueryServiceOptions | ||
| } | ||
| 
     | 
||
| // NewQueryService returns a new QueryService. | ||
| func NewQueryService(spanReader spanstore.Reader, dependencyReader dependencystore.Reader, options QueryServiceOptions) *QueryService { | ||
| func NewQueryService(traceReader tracestore.Reader, dependencyReader dependencystore.Reader, options QueryServiceOptions) *QueryService { | ||
| qsvc := &QueryService{ | ||
| spanReader: spanReader, | ||
| traceReader: traceReader, | ||
| dependencyReader: dependencyReader, | ||
| options: options, | ||
| } | ||
| 
        
          
        
         | 
    @@ -61,7 +63,11 @@ func NewQueryService(spanReader spanstore.Reader, dependencyReader dependencysto | |
| 
     | 
||
| // GetTrace is the queryService implementation of spanstore.Reader.GetTrace | ||
| func (qs QueryService) GetTrace(ctx context.Context, traceID model.TraceID) (*model.Trace, error) { | ||
| trace, err := qs.spanReader.GetTrace(ctx, traceID) | ||
| spanReader, err := factoryadapter.GetV1Reader(qs.traceReader) | ||
                
      
                  yurishkuro marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| trace, err := spanReader.GetTrace(ctx, traceID) | ||
| if errors.Is(err, spanstore.ErrTraceNotFound) { | ||
| if qs.options.ArchiveSpanReader == nil { | ||
| return nil, err | ||
| 
        
          
        
         | 
    @@ -73,20 +79,32 @@ func (qs QueryService) GetTrace(ctx context.Context, traceID model.TraceID) (*mo | |
| 
     | 
||
| // GetServices is the queryService implementation of spanstore.Reader.GetServices | ||
| func (qs QueryService) GetServices(ctx context.Context) ([]string, error) { | ||
| return qs.spanReader.GetServices(ctx) | ||
| spanReader, err := factoryadapter.GetV1Reader(qs.traceReader) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| return spanReader.GetServices(ctx) | ||
| } | ||
| 
     | 
||
| // GetOperations is the queryService implementation of spanstore.Reader.GetOperations | ||
| func (qs QueryService) GetOperations( | ||
| ctx context.Context, | ||
| query spanstore.OperationQueryParameters, | ||
| ) ([]spanstore.Operation, error) { | ||
| return qs.spanReader.GetOperations(ctx, query) | ||
| spanReader, err := factoryadapter.GetV1Reader(qs.traceReader) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| return spanReader.GetOperations(ctx, query) | ||
| } | ||
| 
     | 
||
| // FindTraces is the queryService implementation of spanstore.Reader.FindTraces | ||
| func (qs QueryService) FindTraces(ctx context.Context, query *spanstore.TraceQueryParameters) ([]*model.Trace, error) { | ||
| return qs.spanReader.FindTraces(ctx, query) | ||
| spanReader, err := factoryadapter.GetV1Reader(qs.traceReader) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| return spanReader.FindTraces(ctx, query) | ||
| } | ||
| 
     | 
||
| // ArchiveTrace is the queryService utility to archive traces. | ||
| 
          
            
          
           | 
    ||
Uh oh!
There was an error while loading. Please reload this page.