Skip to content

Commit

Permalink
Remove Dependency on Archive Flag In ES Reader
Browse files Browse the repository at this point in the history
Signed-off-by: Mahad Zaryab <[email protected]>
  • Loading branch information
mahadzaryab1 committed Jan 6, 2025
1 parent b1153a0 commit 20e7ccc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 2 additions & 4 deletions plugin/storage/es/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func (f *Factory) getArchiveClient() es.Client {

// CreateSpanReader implements storage.Factory
func (f *Factory) CreateSpanReader() (spanstore.Reader, error) {
sr, err := createSpanReader(f.getPrimaryClient, f.primaryConfig, false, f.logger, f.tracer)
sr, err := createSpanReader(f.getPrimaryClient, f.primaryConfig, f.logger, f.tracer)
if err != nil {
return nil, err
}
Expand All @@ -218,7 +218,7 @@ func (f *Factory) CreateArchiveSpanReader() (spanstore.Reader, error) {
if !f.archiveConfig.Enabled {
return nil, nil
}
sr, err := createSpanReader(f.getArchiveClient, f.archiveConfig, true, f.logger, f.tracer)
sr, err := createSpanReader(f.getArchiveClient, f.archiveConfig, f.logger, f.tracer)
if err != nil {
return nil, err
}
Expand All @@ -236,7 +236,6 @@ func (f *Factory) CreateArchiveSpanWriter() (spanstore.Writer, error) {
func createSpanReader(
clientFn func() es.Client,
cfg *config.Configuration,
archive bool,
logger *zap.Logger,
tp trace.TracerProvider,
) (spanstore.Reader, error) {
Expand All @@ -252,7 +251,6 @@ func createSpanReader(
ServiceIndex: cfg.Indices.Services,
TagDotReplacement: cfg.Tags.DotReplacement,
UseReadWriteAliases: cfg.UseReadWriteAliases,
Archive: archive,
RemoteReadClusters: cfg.RemoteReadClusters,
Logger: logger,
Tracer: tp.Tracer("esSpanStore.SpanReader"),
Expand Down
6 changes: 3 additions & 3 deletions plugin/storage/es/spanstore/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ type SpanReaderParams struct {
SpanIndex cfg.IndexOptions
ServiceIndex cfg.IndexOptions
TagDotReplacement string
Archive bool
UseReadWriteAliases bool
RemoteReadClusters []string
Logger *zap.Logger
Expand All @@ -124,6 +123,7 @@ func NewSpanReader(p SpanReaderParams) *SpanReader {
if p.UseReadWriteAliases {
maxSpanAge = rolloverMaxSpanAge
}
archive := maxSpanAge == 0

return &SpanReader{
client: p.Client,
Expand All @@ -136,9 +136,9 @@ func NewSpanReader(p SpanReaderParams) *SpanReader {
spanConverter: dbmodel.NewToDomain(p.TagDotReplacement),
timeRangeIndices: getLoggingTimeRangeIndexFn(
p.Logger,
getTimeRangeIndexFn(p.Archive, p.UseReadWriteAliases, p.RemoteReadClusters),
getTimeRangeIndexFn(archive, p.UseReadWriteAliases, p.RemoteReadClusters),
),
sourceFn: getSourceFn(p.Archive, p.MaxDocCount),
sourceFn: getSourceFn(archive, p.MaxDocCount),
maxDocCount: p.MaxDocCount,
useReadWriteAliases: p.UseReadWriteAliases,
logger: p.Logger,
Expand Down

0 comments on commit 20e7ccc

Please sign in to comment.