diff --git a/quickwit/quickwit-config/resources/tests/node_config/quickwit.json b/quickwit/quickwit-config/resources/tests/node_config/quickwit.json index 01def63b10e..6871064130f 100644 --- a/quickwit/quickwit-config/resources/tests/node_config/quickwit.json +++ b/quickwit/quickwit-config/resources/tests/node_config/quickwit.json @@ -75,6 +75,7 @@ "jaeger": { "enable_endpoint": true, "lookback_period_hours": 24, + "lookback_period_traces_hours": 24, "max_trace_duration_secs": 600, "max_fetch_spans": 1000 } diff --git a/quickwit/quickwit-config/resources/tests/node_config/quickwit.toml b/quickwit/quickwit-config/resources/tests/node_config/quickwit.toml index 0b4e0c30229..bc71cc5c9ab 100644 --- a/quickwit/quickwit-config/resources/tests/node_config/quickwit.toml +++ b/quickwit/quickwit-config/resources/tests/node_config/quickwit.toml @@ -65,5 +65,6 @@ max_num_retries = 2 [jaeger] enable_endpoint = true lookback_period_hours = 24 +lookback_period_traces_hours = 24 max_trace_duration_secs = 600 max_fetch_spans = 1_000 diff --git a/quickwit/quickwit-config/resources/tests/node_config/quickwit.yaml b/quickwit/quickwit-config/resources/tests/node_config/quickwit.yaml index cb16052fbd1..27c251d077d 100644 --- a/quickwit/quickwit-config/resources/tests/node_config/quickwit.yaml +++ b/quickwit/quickwit-config/resources/tests/node_config/quickwit.yaml @@ -68,5 +68,6 @@ searcher: jaeger: enable_endpoint: true lookback_period_hours: 24 + lookback_period_traces_hours: 24 max_trace_duration_secs: 600 max_fetch_spans: 1000 diff --git a/quickwit/quickwit-config/src/node_config/mod.rs b/quickwit/quickwit-config/src/node_config/mod.rs index e8c347eb4a5..75d5eeb2aa2 100644 --- a/quickwit/quickwit-config/src/node_config/mod.rs +++ b/quickwit/quickwit-config/src/node_config/mod.rs @@ -599,9 +599,14 @@ pub struct JaegerConfig { #[serde(default = "JaegerConfig::default_enable_endpoint")] pub enable_endpoint: bool, /// How far back in time we look for spans when queries at not time-bound (`get_services`, - /// `get_operations`, `get_trace` operations). + /// `get_operations` operations). #[serde(default = "JaegerConfig::default_lookback_period_hours")] lookback_period_hours: NonZeroU64, + + #[serde(default = "JaegerConfig::default_lookback_period_traces_hours")] + /// How far back in time we look for traces when queries at not time-bound (`get_trace` + /// operation). + lookback_period_traces_hours: NonZeroU64, /// The assumed maximum duration of a trace in seconds. /// /// Finding a trace happens in two phases: the first phase identifies at least one span that @@ -621,6 +626,10 @@ impl JaegerConfig { Duration::from_secs(self.lookback_period_hours.get() * 3600) } + pub fn lookback_period_traces(&self) -> Duration { + Duration::from_secs(self.lookback_period_traces_hours.get() * 3600) + } + pub fn max_trace_duration(&self) -> Duration { Duration::from_secs(self.max_trace_duration_secs.get()) } @@ -640,6 +649,10 @@ impl JaegerConfig { NonZeroU64::new(72).unwrap() // 3 days } + fn default_lookback_period_traces_hours() -> NonZeroU64 { + NonZeroU64::new(72).unwrap() // 3 days + } + fn default_max_trace_duration_secs() -> NonZeroU64 { NonZeroU64::new(3600).unwrap() // 1 hour } @@ -654,6 +667,7 @@ impl Default for JaegerConfig { Self { enable_endpoint: Self::default_enable_endpoint(), lookback_period_hours: Self::default_lookback_period_hours(), + lookback_period_traces_hours: Self::default_lookback_period_traces_hours(), max_trace_duration_secs: Self::default_max_trace_duration_secs(), max_fetch_spans: Self::default_max_fetch_spans(), } diff --git a/quickwit/quickwit-config/src/node_config/serialize.rs b/quickwit/quickwit-config/src/node_config/serialize.rs index 7d3b5f2c64b..ab3232e41e4 100644 --- a/quickwit/quickwit-config/src/node_config/serialize.rs +++ b/quickwit/quickwit-config/src/node_config/serialize.rs @@ -694,6 +694,7 @@ mod tests { JaegerConfig { enable_endpoint: true, lookback_period_hours: NonZeroU64::new(24).unwrap(), + lookback_period_traces_hours: NonZeroU64::new(24).unwrap(), max_trace_duration_secs: NonZeroU64::new(600).unwrap(), max_fetch_spans: NonZeroU64::new(1_000).unwrap(), } diff --git a/quickwit/quickwit-jaeger/src/lib.rs b/quickwit/quickwit-jaeger/src/lib.rs index 1b6dfc27d0c..79f0177fdd0 100644 --- a/quickwit/quickwit-jaeger/src/lib.rs +++ b/quickwit/quickwit-jaeger/src/lib.rs @@ -72,6 +72,7 @@ pub(crate) type TracesDataStream = #[derive(Clone)] pub struct JaegerService { search_service: Arc, + lookback_period_traces_secs: i64, lookback_period_secs: i64, max_trace_duration_secs: i64, max_fetch_spans: u64, @@ -82,6 +83,7 @@ impl JaegerService { Self { search_service, lookback_period_secs: config.lookback_period().as_secs() as i64, + lookback_period_traces_secs: config.lookback_period_traces().as_secs() as i64, max_trace_duration_secs: config.max_trace_duration().as_secs() as i64, max_fetch_spans: config.max_fetch_spans.get(), } @@ -190,7 +192,7 @@ impl JaegerService { let trace_id = TraceId::try_from(request.trace_id) .map_err(|error| Status::invalid_argument(error.to_string()))?; let end = OffsetDateTime::now_utc().unix_timestamp(); - let start = end - self.lookback_period_secs; + let start = end - self.lookback_period_traces_secs; let search_window = start..=end; let response = self .stream_spans(