From cbae55152c6864c5fb4b5c3e3e8633dbcdf27589 Mon Sep 17 00:00:00 2001 From: Miguel Fernandez Date: Fri, 27 Jan 2023 16:43:57 +0100 Subject: [PATCH] Cosmetic changes --- .../core/src/telemetry/capturing/capturer.rs | 4 +-- .../core/src/telemetry/capturing/settings.rs | 29 +++++++++---------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/query-engine/core/src/telemetry/capturing/capturer.rs b/query-engine/core/src/telemetry/capturing/capturer.rs index 5db1ecc6eee9..3c9d15b23db6 100644 --- a/query-engine/core/src/telemetry/capturing/capturer.rs +++ b/query-engine/core/src/telemetry/capturing/capturer.rs @@ -65,7 +65,7 @@ impl Processor { } } - pub(self) async fn start_capturing(&self, trace_id: TraceId, settings: Settings) { + async fn start_capturing(&self, trace_id: TraceId, settings: Settings) { let mut locked_storage = self.storage.lock().unwrap(); locked_storage.insert(trace_id, settings.clone().into()); drop(locked_storage); @@ -81,7 +81,7 @@ impl Processor { }); } - pub(self) async fn fetch_captures(&self, trace_id: TraceId) -> Option { + async fn fetch_captures(&self, trace_id: TraceId) -> Option { let mut traces = self.storage.lock().unwrap(); traces.remove(&trace_id) diff --git a/query-engine/core/src/telemetry/capturing/settings.rs b/query-engine/core/src/telemetry/capturing/settings.rs index a039212b96d1..771586940fc5 100644 --- a/query-engine/core/src/telemetry/capturing/settings.rs +++ b/query-engine/core/src/telemetry/capturing/settings.rs @@ -5,14 +5,14 @@ static DEFAULT_TTL: time::Duration = time::Duration::from_secs(1800); // 30 minu #[derive(Debug, Clone, Default)] pub struct Settings { - // only capture log events from the specified log levels, the special level "query", which does not - // exist in the engine logging infrastructure, is shimed from any event describing a query, regardless - // of its level. + /// only capture log events from the specified log levels, the special level "query", which does not + /// exist in the engine logging infrastructure, is shimed from any event describing a query, regardless + /// of its level. pub(super) included_log_levels: HashSet, - // whether to include trace spans when capturing + /// whether to include trace spans when capturing pub(super) include_traces: bool, - // how long to keep captured traces in memory, if by any chance the capturing breaks, a tokio task - // will clean captured traces after this duration. Defaults to [`DEFAULT_TTL`]. + /// how long to keep captured traces in memory, if by any chance the capturing breaks, a tokio task + /// will clean captured traces after this duration. Defaults to [`DEFAULT_TTL`]. pub(super) ttl: time::Duration, } @@ -26,13 +26,13 @@ impl Settings { } } -// As the test below shows, settings can be constructed froma comma separated string. -// Examples: valid: `"error, warn, query, tracing"` invalid: "foo, bar baz". strings corresponding -// passed in are trimmed and converted to lowercase. chunks corresponding to levels different from -// those in VALID_LEVELS are ignored. -// -// The ttl is always the same (DEFAULT_TTL) but is there to allow for easier unit-testing of c -// apturing logic +/// As the test below shows, settings can be constructed from a comma separated string. +/// Examples: valid: `"error, warn, query, tracing"` invalid: "foo, bar baz". strings corresponding +/// passed in are trimmed and converted to lowercase. chunks corresponding to levels different from +/// those in VALID_LEVELS are ignored. +/// +/// The ttl is always the same (DEFAULT_TTL) but is there to allow for easier unit-testing of c +/// apturing logic impl From<&str> for Settings { fn from(s: &str) -> Self { let chunks = s.split(','); @@ -52,17 +52,14 @@ impl From<&str> for Settings { } impl Settings { - #[inline(always)] pub fn is_enabled(&self) -> bool { self.traces_enabled() || self.logs_enabled() } - #[inline(always)] pub fn traces_enabled(&self) -> bool { self.include_traces } - #[inline(always)] pub fn logs_enabled(&self) -> bool { !self.included_log_levels.is_empty() }