Skip to content

Commit

Permalink
[es] Remove unused indexCache (jaegertracing#5408)
Browse files Browse the repository at this point in the history
## Which problem is this PR solving?
- The cache was initialized with incorrect parameter, and when I looked
around it wasn't even used anywhere

## Description of the changes
- delete indexCache and indexCacheTTL argument

## How was this change tested?
```
$ go test ./plugin/storage/es/spanstore
ok      github.com/jaegertracing/jaeger/plugin/storage/es/spanstore     0.471s
```

Signed-off-by: Yuri Shkuro <github@ysh.us>
  • Loading branch information
yurishkuro authored and Pushkarm029 committed May 4, 2024
1 parent 7c7aa94 commit d631ae9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 21 deletions.
22 changes: 5 additions & 17 deletions plugin/storage/es/spanstore/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ type serviceWriter func(string, *dbmodel.Span)

// SpanWriter is a wrapper around elastic.Client
type SpanWriter struct {
client func() es.Client
logger *zap.Logger
writerMetrics spanWriterMetrics // TODO: build functions to wrap around each Do fn
indexCache cache.Cache
client func() es.Client
logger *zap.Logger
writerMetrics spanWriterMetrics // TODO: build functions to wrap around each Do fn
// indexCache cache.Cache
serviceWriter serviceWriter
spanConverter dbmodel.FromDomain
spanServiceIndex spanAndServiceIndexFn
Expand All @@ -69,7 +69,6 @@ type SpanWriterParams struct {
Archive bool
UseReadWriteAliases bool
ServiceCacheTTL time.Duration
IndexCacheTTL time.Duration
}

// NewSpanWriter creates a new SpanWriter for use
Expand All @@ -79,25 +78,14 @@ func NewSpanWriter(p SpanWriterParams) *SpanWriter {
serviceCacheTTL = serviceCacheTTLDefault
}

indexCacheTTL := p.IndexCacheTTL
if p.ServiceCacheTTL == 0 {
indexCacheTTL = indexCacheTTLDefault
}

serviceOperationStorage := NewServiceOperationStorage(p.Client, p.Logger, serviceCacheTTL)
return &SpanWriter{
client: p.Client,
logger: p.Logger,
writerMetrics: spanWriterMetrics{
indexCreate: storageMetrics.NewWriteMetrics(p.MetricsFactory, "index_create"),
},
serviceWriter: serviceOperationStorage.Write,
indexCache: cache.NewLRUWithOptions(
5,
&cache.Options{
TTL: indexCacheTTL,
},
),
serviceWriter: serviceOperationStorage.Write,
spanConverter: dbmodel.NewFromDomain(p.AllTagsAsFields, p.TagKeysAsFields, p.TagDotReplacement),
spanServiceIndex: getSpanAndServiceIndexFn(p.Archive, p.UseReadWriteAliases, p.IndexPrefix, p.SpanIndexDateLayout, p.ServiceIndexDateLayout),
}
Expand Down
4 changes: 0 additions & 4 deletions plugin/storage/es/spanstore/writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,19 +424,16 @@ func TestSpanWriterParamsTTL(t *testing.T) {
logger, _ := testutils.NewLogger()
metricsFactory := metricstest.NewFactory(0)
testCases := []struct {
indexTTL time.Duration
serviceTTL time.Duration
name string
expectedAddCalls int
}{
{
indexTTL: 0,
serviceTTL: 0,
name: "uses defaults",
expectedAddCalls: 1,
},
{
indexTTL: 1 * time.Nanosecond,
serviceTTL: 1 * time.Nanosecond,
name: "uses provided values",
expectedAddCalls: 3,
Expand All @@ -451,7 +448,6 @@ func TestSpanWriterParamsTTL(t *testing.T) {
Logger: logger,
MetricsFactory: metricsFactory,
ServiceCacheTTL: test.serviceTTL,
IndexCacheTTL: test.indexTTL,
}
w := NewSpanWriter(params)

Expand Down

0 comments on commit d631ae9

Please sign in to comment.