Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 15 additions & 1 deletion quickwit/quickwit-config/src/node_config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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())
}
Expand All @@ -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
}
Expand All @@ -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(),
}
Expand Down
1 change: 1 addition & 0 deletions quickwit/quickwit-config/src/node_config/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
Expand Down
4 changes: 3 additions & 1 deletion quickwit/quickwit-jaeger/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pub(crate) type TracesDataStream =
#[derive(Clone)]
pub struct JaegerService {
search_service: Arc<dyn SearchService>,
lookback_period_traces_secs: i64,
lookback_period_secs: i64,
max_trace_duration_secs: i64,
max_fetch_spans: u64,
Expand All @@ -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(),
}
Expand Down Expand Up @@ -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(
Expand Down