Skip to content

Commit f2567f8

Browse files
Turn off delta_kernel::log_segment logging and refactor log filtering (spiceai#5367)
1 parent edafaec commit f2567f8

1 file changed

Lines changed: 37 additions & 9 deletions

File tree

bin/spiced/src/tracing.rs

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,46 @@ impl LogVerbosity {
5454
LogVerbosity::Default
5555
}
5656
}
57+
58+
const INTERNAL_COMPONENTS: &[&str] = &[
59+
"task_history",
60+
"spiced",
61+
"runtime",
62+
"secrets",
63+
"data_components",
64+
"cache",
65+
"extensions",
66+
"spice_cloud",
67+
"llms",
68+
"tpc_extension",
69+
];
70+
71+
const OFF_FILTERS: &str =
72+
"reqwest_retry::middleware=off,opentelemetry_sdk=off,delta_kernel::log_segment=off";
73+
5774
impl From<LogVerbosity> for EnvFilter {
5875
fn from(v: LogVerbosity) -> Self {
76+
fn internal_components(level: &str) -> String {
77+
INTERNAL_COMPONENTS
78+
.iter()
79+
.map(|component| format!("{component}={level}"))
80+
.collect::<Vec<_>>()
81+
.join(",")
82+
}
83+
5984
match v {
60-
LogVerbosity::Default => EnvFilter::new(
61-
"task_history=INFO,spiced=INFO,runtime=INFO,secrets=INFO,data_components=INFO,cache=INFO,extensions=INFO,spice_cloud=INFO,llms=INFO,tpc_extension=INFO,reqwest_retry::middleware=off,opentelemetry_sdk=off,WARN",
62-
),
63-
LogVerbosity::Verbose => EnvFilter::new(
64-
"task_history=DEBUG,spiced=DEBUG,runtime=DEBUG,secrets=DEBUG,data_components=DEBUG,cache=DEBUG,extensions=DEBUG,spice_cloud=DEBUG,llms=DEBUG,tpc_extension=DEBUG,INFO",
65-
),
66-
LogVerbosity::VeryVerbose => EnvFilter::new(
67-
"task_history=TRACE,spiced=TRACE,runtime=TRACE,secrets=TRACE,data_components=TRACE,cache=TRACE,extensions=TRACE,spice_cloud=TRACE,llms=TRACE,tpc_extension=TRACE,DEBUG",
68-
),
85+
LogVerbosity::Default => EnvFilter::new(format!(
86+
"{},{OFF_FILTERS},WARN",
87+
internal_components("INFO")
88+
)),
89+
LogVerbosity::Verbose => EnvFilter::new(format!(
90+
"{},{OFF_FILTERS},INFO",
91+
internal_components("DEBUG")
92+
)),
93+
LogVerbosity::VeryVerbose => EnvFilter::new(format!(
94+
"{},{OFF_FILTERS},DEBUG",
95+
internal_components("TRACE")
96+
)),
6997
LogVerbosity::Specific(filter) => EnvFilter::new(filter),
7098
}
7199
}

0 commit comments

Comments
 (0)