Skip to content

Commit 015c7fb

Browse files
authored
[es] Remove unused indexCache (jaegertracing#5408)
## 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 <[email protected]>
1 parent 14aa43d commit 015c7fb

File tree

2 files changed

+5
-21
lines changed

2 files changed

+5
-21
lines changed

plugin/storage/es/spanstore/writer.go

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ type serviceWriter func(string, *dbmodel.Span)
4646

4747
// SpanWriter is a wrapper around elastic.Client
4848
type SpanWriter struct {
49-
client func() es.Client
50-
logger *zap.Logger
51-
writerMetrics spanWriterMetrics // TODO: build functions to wrap around each Do fn
52-
indexCache cache.Cache
49+
client func() es.Client
50+
logger *zap.Logger
51+
writerMetrics spanWriterMetrics // TODO: build functions to wrap around each Do fn
52+
// indexCache cache.Cache
5353
serviceWriter serviceWriter
5454
spanConverter dbmodel.FromDomain
5555
spanServiceIndex spanAndServiceIndexFn
@@ -69,7 +69,6 @@ type SpanWriterParams struct {
6969
Archive bool
7070
UseReadWriteAliases bool
7171
ServiceCacheTTL time.Duration
72-
IndexCacheTTL time.Duration
7372
}
7473

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

82-
indexCacheTTL := p.IndexCacheTTL
83-
if p.ServiceCacheTTL == 0 {
84-
indexCacheTTL = indexCacheTTLDefault
85-
}
86-
8781
serviceOperationStorage := NewServiceOperationStorage(p.Client, p.Logger, serviceCacheTTL)
8882
return &SpanWriter{
8983
client: p.Client,
9084
logger: p.Logger,
9185
writerMetrics: spanWriterMetrics{
9286
indexCreate: storageMetrics.NewWriteMetrics(p.MetricsFactory, "index_create"),
9387
},
94-
serviceWriter: serviceOperationStorage.Write,
95-
indexCache: cache.NewLRUWithOptions(
96-
5,
97-
&cache.Options{
98-
TTL: indexCacheTTL,
99-
},
100-
),
88+
serviceWriter: serviceOperationStorage.Write,
10189
spanConverter: dbmodel.NewFromDomain(p.AllTagsAsFields, p.TagKeysAsFields, p.TagDotReplacement),
10290
spanServiceIndex: getSpanAndServiceIndexFn(p.Archive, p.UseReadWriteAliases, p.IndexPrefix, p.SpanIndexDateLayout, p.ServiceIndexDateLayout),
10391
}

plugin/storage/es/spanstore/writer_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -424,19 +424,16 @@ func TestSpanWriterParamsTTL(t *testing.T) {
424424
logger, _ := testutils.NewLogger()
425425
metricsFactory := metricstest.NewFactory(0)
426426
testCases := []struct {
427-
indexTTL time.Duration
428427
serviceTTL time.Duration
429428
name string
430429
expectedAddCalls int
431430
}{
432431
{
433-
indexTTL: 0,
434432
serviceTTL: 0,
435433
name: "uses defaults",
436434
expectedAddCalls: 1,
437435
},
438436
{
439-
indexTTL: 1 * time.Nanosecond,
440437
serviceTTL: 1 * time.Nanosecond,
441438
name: "uses provided values",
442439
expectedAddCalls: 3,
@@ -451,7 +448,6 @@ func TestSpanWriterParamsTTL(t *testing.T) {
451448
Logger: logger,
452449
MetricsFactory: metricsFactory,
453450
ServiceCacheTTL: test.serviceTTL,
454-
IndexCacheTTL: test.indexTTL,
455451
}
456452
w := NewSpanWriter(params)
457453

0 commit comments

Comments
 (0)