From 2b7fb73f4c43b36693c9c8c4ef679fbbe3a3bfe1 Mon Sep 17 00:00:00 2001 From: Charles Treatman Date: Mon, 4 Oct 2021 15:25:44 -0400 Subject: [PATCH] Close #3270: Prevent rollover lookback from passing the Unix epoch (#3299) * Close #3270: Prevent rollover lookback from passing the Unix epoch Version 1.26 introduced an automatic configuration for the query lookback when using ElasticSearch with aliases enabled. When aliases are enabled, the ES plugin will look back 100 years. This pre-dates the Unix epoch, and while such dates can be modeled as negative timestamps, the model defined in `jaeger/model/time.go` only supports unsigned timestamps. As a result, the 100-year lookback ends up overflowing the time model, resulting in a distant-future lookback date, rather than a distant-past lookback date. While the time model could be updated to support negative timestamps, it seems unlikely that any Jaeger users would reasonably need to search for spans from the 1920s. This reduces the automatic lookback to 50 years to remove the overflow issue while still providing an extremely long search window that should serve even the most ambitious searches of historical trace data. Signed-off-by: Charles Treatman * Update test for maxSpanAge when aliases are enabled Signed-off-by: Charles Treatman --- plugin/storage/es/spanstore/reader.go | 2 +- plugin/storage/es/spanstore/reader_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/storage/es/spanstore/reader.go b/plugin/storage/es/spanstore/reader.go index 09c4cadf141..5bba2aee665 100644 --- a/plugin/storage/es/spanstore/reader.go +++ b/plugin/storage/es/spanstore/reader.go @@ -61,7 +61,7 @@ const ( defaultNumTraces = 100 - rolloverMaxSpanAge = time.Hour * 24 * 365 * 100 + rolloverMaxSpanAge = time.Hour * 24 * 365 * 50 ) var ( diff --git a/plugin/storage/es/spanstore/reader_test.go b/plugin/storage/es/spanstore/reader_test.go index 9ce044c9bd2..ba3d00e294c 100644 --- a/plugin/storage/es/spanstore/reader_test.go +++ b/plugin/storage/es/spanstore/reader_test.go @@ -149,7 +149,7 @@ func TestNewSpanReader(t *testing.T) { MaxSpanAge: time.Hour * 72, UseReadWriteAliases: true, }, - maxSpanAge: time.Hour * 24 * 365 * 100, + maxSpanAge: time.Hour * 24 * 365 * 50, }, } for _, test := range tests {