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 @@ -74,6 +74,7 @@
"jaeger": {
"enable_endpoint": true,
"lookback_period_hours": 24,
"lookback_period_traces_hours": 72,
"max_trace_duration_secs": 600,
"max_fetch_spans": 1000
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,6 @@ max_num_retries = 2
[jaeger]
enable_endpoint = true
lookback_period_hours = 24
lookback_period_traces_hours = 72
max_trace_duration_secs = 600
max_fetch_spans = 1_000
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,6 @@ searcher:
jaeger:
enable_endpoint: true
lookback_period_hours: 24
lookback_period_traces_hours: 72
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 @@ -497,9 +497,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 @@ -519,6 +524,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 @@ -538,6 +547,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 @@ -552,6 +565,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
55 changes: 24 additions & 31 deletions quickwit/quickwit-config/src/node_config/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ use std::net::{IpAddr, SocketAddr};
use std::str::FromStr;
use std::time::Duration;

use anyhow::{Context, bail};
use anyhow::{bail, Context};
use bytesize::ByteSize;
use http::HeaderMap;
use quickwit_common::fs::get_disk_size;
use quickwit_common::net::{Host, find_private_ip, get_short_hostname};
use quickwit_common::net::{find_private_ip, get_short_hostname, Host};
use quickwit_common::new_coolid;
use quickwit_common::uri::Uri;
use quickwit_proto::types::NodeId;
Expand All @@ -35,8 +35,8 @@ use crate::service::QuickwitService;
use crate::storage_config::StorageConfigs;
use crate::templating::render_config;
use crate::{
ConfigFormat, IndexerConfig, IngestApiConfig, JaegerConfig, MetastoreConfigs, NodeConfig,
SearcherConfig, TlsConfig, validate_identifier, validate_node_id,
validate_identifier, validate_node_id, ConfigFormat, IndexerConfig, IngestApiConfig,
JaegerConfig, MetastoreConfigs, NodeConfig, SearcherConfig, TlsConfig,
};

pub const DEFAULT_CLUSTER_ID: &str = "quickwit-default-cluster";
Expand Down Expand Up @@ -679,6 +679,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 Expand Up @@ -718,10 +719,8 @@ mod tests {
)
.await
.unwrap_err();
assert!(
format!("{parsing_error:?}")
.contains("unknown field `max_num_concurrent_split_searches_with_typo`")
);
assert!(format!("{parsing_error:?}")
.contains("unknown field `max_num_concurrent_split_searches_with_typo`"));
}

#[tokio::test]
Expand Down Expand Up @@ -1058,15 +1057,13 @@ mod tests {
node_id: 1
metastore_uri: ''
"#;
assert!(
load_node_config_with_env(
ConfigFormat::Yaml,
config_yaml.as_bytes(),
&Default::default()
)
.await
.is_err()
);
assert!(load_node_config_with_env(
ConfigFormat::Yaml,
config_yaml.as_bytes(),
&Default::default()
)
.await
.is_err());
}
{
let config_yaml = r#"
Expand All @@ -1075,15 +1072,13 @@ mod tests {
metastore_uri: postgres://username:password@host:port/db
default_index_root_uri: ''
"#;
assert!(
load_node_config_with_env(
ConfigFormat::Yaml,
config_yaml.as_bytes(),
&Default::default()
)
.await
.is_err()
);
assert!(load_node_config_with_env(
ConfigFormat::Yaml,
config_yaml.as_bytes(),
&Default::default()
)
.await
.is_err());
}
}

Expand Down Expand Up @@ -1163,11 +1158,9 @@ mod tests {
max_trace_duration_secs: 0
"#;
let error = serde_yaml::from_str::<JaegerConfig>(jaeger_config_yaml).unwrap_err();
assert!(
error
.to_string()
.contains("max_trace_duration_secs: invalid value: integer `0`")
)
assert!(error
.to_string()
.contains("max_trace_duration_secs: invalid value: integer `0`"))
}

#[tokio::test]
Expand Down
Loading