Skip to content

Commit 279ba18

Browse files
committed
quickwit-jaeger: add lookback_period_traces_hours config option
1 parent 607ffbd commit 279ba18

File tree

8 files changed

+160
-166
lines changed

8 files changed

+160
-166
lines changed

quickwit/quickwit-config/resources/tests/node_config/quickwit.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"jaeger": {
7575
"enable_endpoint": true,
7676
"lookback_period_hours": 24,
77+
"lookback_period_traces_hours": 72,
7778
"max_trace_duration_secs": 600,
7879
"max_fetch_spans": 1000
7980
}

quickwit/quickwit-config/resources/tests/node_config/quickwit.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,6 @@ max_num_retries = 2
6464
[jaeger]
6565
enable_endpoint = true
6666
lookback_period_hours = 24
67+
lookback_period_traces_hours = 72
6768
max_trace_duration_secs = 600
6869
max_fetch_spans = 1_000

quickwit/quickwit-config/resources/tests/node_config/quickwit.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,6 @@ searcher:
6767
jaeger:
6868
enable_endpoint: true
6969
lookback_period_hours: 24
70+
lookback_period_traces_hours: 72
7071
max_trace_duration_secs: 600
7172
max_fetch_spans: 1000

quickwit/quickwit-config/src/node_config/mod.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,9 +497,14 @@ pub struct JaegerConfig {
497497
#[serde(default = "JaegerConfig::default_enable_endpoint")]
498498
pub enable_endpoint: bool,
499499
/// How far back in time we look for spans when queries at not time-bound (`get_services`,
500-
/// `get_operations`, `get_trace` operations).
500+
/// `get_operations` operations).
501501
#[serde(default = "JaegerConfig::default_lookback_period_hours")]
502502
lookback_period_hours: NonZeroU64,
503+
504+
#[serde(default = "JaegerConfig::default_lookback_period_traces_hours")]
505+
/// How far back in time we look for traces when queries at not time-bound (`get_trace`
506+
/// operation).
507+
lookback_period_traces_hours: NonZeroU64,
503508
/// The assumed maximum duration of a trace in seconds.
504509
///
505510
/// Finding a trace happens in two phases: the first phase identifies at least one span that
@@ -519,6 +524,10 @@ impl JaegerConfig {
519524
Duration::from_secs(self.lookback_period_hours.get() * 3600)
520525
}
521526

527+
pub fn lookback_period_traces(&self) -> Duration {
528+
Duration::from_secs(self.lookback_period_traces_hours.get() * 3600)
529+
}
530+
522531
pub fn max_trace_duration(&self) -> Duration {
523532
Duration::from_secs(self.max_trace_duration_secs.get())
524533
}
@@ -538,6 +547,10 @@ impl JaegerConfig {
538547
NonZeroU64::new(72).unwrap() // 3 days
539548
}
540549

550+
fn default_lookback_period_traces_hours() -> NonZeroU64 {
551+
NonZeroU64::new(72).unwrap() // 3 days
552+
}
553+
541554
fn default_max_trace_duration_secs() -> NonZeroU64 {
542555
NonZeroU64::new(3600).unwrap() // 1 hour
543556
}
@@ -552,6 +565,7 @@ impl Default for JaegerConfig {
552565
Self {
553566
enable_endpoint: Self::default_enable_endpoint(),
554567
lookback_period_hours: Self::default_lookback_period_hours(),
568+
lookback_period_traces_hours: Self::default_lookback_period_traces_hours(),
555569
max_trace_duration_secs: Self::default_max_trace_duration_secs(),
556570
max_fetch_spans: Self::default_max_fetch_spans(),
557571
}

quickwit/quickwit-config/src/node_config/serialize.rs

Lines changed: 24 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ use std::net::{IpAddr, SocketAddr};
1717
use std::str::FromStr;
1818
use std::time::Duration;
1919

20-
use anyhow::{Context, bail};
20+
use anyhow::{bail, Context};
2121
use bytesize::ByteSize;
2222
use http::HeaderMap;
2323
use quickwit_common::fs::get_disk_size;
24-
use quickwit_common::net::{Host, find_private_ip, get_short_hostname};
24+
use quickwit_common::net::{find_private_ip, get_short_hostname, Host};
2525
use quickwit_common::new_coolid;
2626
use quickwit_common::uri::Uri;
2727
use quickwit_proto::types::NodeId;
@@ -35,8 +35,8 @@ use crate::service::QuickwitService;
3535
use crate::storage_config::StorageConfigs;
3636
use crate::templating::render_config;
3737
use crate::{
38-
ConfigFormat, IndexerConfig, IngestApiConfig, JaegerConfig, MetastoreConfigs, NodeConfig,
39-
SearcherConfig, TlsConfig, validate_identifier, validate_node_id,
38+
validate_identifier, validate_node_id, ConfigFormat, IndexerConfig, IngestApiConfig,
39+
JaegerConfig, MetastoreConfigs, NodeConfig, SearcherConfig, TlsConfig,
4040
};
4141

4242
pub const DEFAULT_CLUSTER_ID: &str = "quickwit-default-cluster";
@@ -679,6 +679,7 @@ mod tests {
679679
JaegerConfig {
680680
enable_endpoint: true,
681681
lookback_period_hours: NonZeroU64::new(24).unwrap(),
682+
lookback_period_traces_hours: NonZeroU64::new(24).unwrap(),
682683
max_trace_duration_secs: NonZeroU64::new(600).unwrap(),
683684
max_fetch_spans: NonZeroU64::new(1_000).unwrap(),
684685
}
@@ -718,10 +719,8 @@ mod tests {
718719
)
719720
.await
720721
.unwrap_err();
721-
assert!(
722-
format!("{parsing_error:?}")
723-
.contains("unknown field `max_num_concurrent_split_searches_with_typo`")
724-
);
722+
assert!(format!("{parsing_error:?}")
723+
.contains("unknown field `max_num_concurrent_split_searches_with_typo`"));
725724
}
726725

727726
#[tokio::test]
@@ -1058,15 +1057,13 @@ mod tests {
10581057
node_id: 1
10591058
metastore_uri: ''
10601059
"#;
1061-
assert!(
1062-
load_node_config_with_env(
1063-
ConfigFormat::Yaml,
1064-
config_yaml.as_bytes(),
1065-
&Default::default()
1066-
)
1067-
.await
1068-
.is_err()
1069-
);
1060+
assert!(load_node_config_with_env(
1061+
ConfigFormat::Yaml,
1062+
config_yaml.as_bytes(),
1063+
&Default::default()
1064+
)
1065+
.await
1066+
.is_err());
10701067
}
10711068
{
10721069
let config_yaml = r#"
@@ -1075,15 +1072,13 @@ mod tests {
10751072
metastore_uri: postgres://username:password@host:port/db
10761073
default_index_root_uri: ''
10771074
"#;
1078-
assert!(
1079-
load_node_config_with_env(
1080-
ConfigFormat::Yaml,
1081-
config_yaml.as_bytes(),
1082-
&Default::default()
1083-
)
1084-
.await
1085-
.is_err()
1086-
);
1075+
assert!(load_node_config_with_env(
1076+
ConfigFormat::Yaml,
1077+
config_yaml.as_bytes(),
1078+
&Default::default()
1079+
)
1080+
.await
1081+
.is_err());
10871082
}
10881083
}
10891084

@@ -1163,11 +1158,9 @@ mod tests {
11631158
max_trace_duration_secs: 0
11641159
"#;
11651160
let error = serde_yaml::from_str::<JaegerConfig>(jaeger_config_yaml).unwrap_err();
1166-
assert!(
1167-
error
1168-
.to_string()
1169-
.contains("max_trace_duration_secs: invalid value: integer `0`")
1170-
)
1161+
assert!(error
1162+
.to_string()
1163+
.contains("max_trace_duration_secs: invalid value: integer `0`"))
11711164
}
11721165

11731166
#[tokio::test]

0 commit comments

Comments
 (0)