From 3783edb6320b64254638a80d15310f4525e766a5 Mon Sep 17 00:00:00 2001
From: Pavol Loffay
Date: Wed, 28 Jul 2021 16:48:03 +0200
Subject: [PATCH] Set lookback in ES rollover to distant past
Signed-off-by: Pavol Loffay
---
plugin/storage/es/spanstore/reader.go | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/plugin/storage/es/spanstore/reader.go b/plugin/storage/es/spanstore/reader.go
index 3e405dfca84e..75c1f10fa8c6 100644
--- a/plugin/storage/es/spanstore/reader.go
+++ b/plugin/storage/es/spanstore/reader.go
@@ -129,10 +129,17 @@ type SpanReaderParams struct {
// NewSpanReader returns a new SpanReader with a metrics.
func NewSpanReader(p SpanReaderParams) *SpanReader {
+ maxSpanAge := p.MaxSpanAge
+ // If rollover is enabled set lookback far into the past
+ // In rollover only read alias is used to query the data so looking far into the past should
+ // not affect performance.
+ if p.UseReadWriteAliases {
+ maxSpanAge = time.Hour * 24 * 365 * 100
+ }
return &SpanReader{
client: p.Client,
logger: p.Logger,
- maxSpanAge: p.MaxSpanAge,
+ maxSpanAge: maxSpanAge,
serviceOperationStorage: NewServiceOperationStorage(p.Client, p.Logger, 0), // the decorator takes care of metrics
spanIndexPrefix: indexNames(p.IndexPrefix, spanIndex),
serviceIndexPrefix: indexNames(p.IndexPrefix, serviceIndex),