From 58577a5c3e66f35bed4444329e34232ab8ae209e Mon Sep 17 00:00:00 2001 From: Pratik Jadhav Date: Mon, 28 Sep 2026 11:54:02 +0530 Subject: [PATCH 1/4] feat: add process CPU limit metric --- src/handlers/http/resource_check.rs | 47 ++++++++++++++++++++++++++--- src/main.rs | 17 ++++++++--- src/metrics/mod.rs | 22 +++++++++++++- 3 files changed, 77 insertions(+), 9 deletions(-) diff --git a/src/handlers/http/resource_check.rs b/src/handlers/http/resource_check.rs index 05a6bd8eb..1fa44488d 100644 --- a/src/handlers/http/resource_check.rs +++ b/src/handlers/http/resource_check.rs @@ -16,7 +16,10 @@ * */ -use std::sync::{Arc, LazyLock, atomic::AtomicBool}; +use std::{ + fs, + sync::{Arc, LazyLock, atomic::AtomicBool}, +}; use actix_web::{ body::MessageBody, @@ -37,9 +40,38 @@ use crate::metrics::{record_disk_metrics, record_process_metrics_sample}; use crate::parseable::PARSEABLE; const PROCESS_METRICS_SAMPLE_INTERVAL: Duration = Duration::from_secs(5); +const CGROUP_V2_CPU_MAX_PATH: &str = "/sys/fs/cgroup/cpu.max"; +const CGROUP_V1_CPU_QUOTA_PATH: &str = "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"; +const CGROUP_V1_CPU_PERIOD_PATH: &str = "/sys/fs/cgroup/cpu/cpu.cfs_period_us"; static SERVER_OK: LazyLock> = LazyLock::new(|| Arc::new(AtomicBool::new(true))); +fn cpu_quota_cores(quota: &str, period: &str) -> Option { + let quota = quota.trim().parse::().ok()?; + let period = period.trim().parse::().ok()?; + (quota > 0.0 && period > 0.0).then_some(quota / period) +} + +pub fn cpu_limit_cores() -> f64 { + let cgroup_limit = fs::read_to_string(CGROUP_V2_CPU_MAX_PATH) + .ok() + .and_then(|cpu_max| { + let mut values = cpu_max.split_whitespace(); + cpu_quota_cores(values.next()?, values.next()?) + }) + .or_else(|| { + let quota = fs::read_to_string(CGROUP_V1_CPU_QUOTA_PATH).ok()?; + let period = fs::read_to_string(CGROUP_V1_CPU_PERIOD_PATH).ok()?; + cpu_quota_cores("a, &period) + }); + + cgroup_limit.unwrap_or_else(|| { + std::thread::available_parallelism() + .map(|count| count.get() as f64) + .unwrap_or(1.0) + }) +} + async fn sample_process_metrics() { refresh_sys_info(); let process_metrics = tokio::task::spawn_blocking(|| { @@ -52,12 +84,19 @@ async fn sample_process_metrics() { sysinfo::get_current_pid() .ok() .and_then(|pid| sys.process(pid)) - .map(|process| (process.cpu_usage() as f64, process.memory(), total_mem)) + .map(|process| { + ( + process.cpu_usage() as f64, + process.memory(), + total_mem, + cpu_limit_cores(), + ) + }) }) .await .unwrap(); - if let Some((cpu_usage, memory_bytes, total_mem)) = process_metrics { - record_process_metrics_sample(cpu_usage, memory_bytes, total_mem); + if let Some((cpu_usage, memory_bytes, total_mem, cpu_limit_cores)) = process_metrics { + record_process_metrics_sample(cpu_usage, memory_bytes, total_mem, cpu_limit_cores); } let staging_path = PARSEABLE.options.staging_dir().clone(); diff --git a/src/main.rs b/src/main.rs index 75522e8ef..4927a635f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -22,7 +22,9 @@ use parseable::connectors; use parseable::{ IngestServer, ParseableServer, QueryServer, Server, analytics::{SYS_INFO, refresh_sys_info}, - banner, metrics, + banner, + handlers::http::resource_check::cpu_limit_cores, + metrics, option::Mode, parseable::PARSEABLE, rbac, storage, @@ -107,13 +109,20 @@ async fn main() -> anyhow::Result<()> { sysinfo::get_current_pid() .ok() .and_then(|pid| sys.process(pid)) - .map(|process| (process.cpu_usage() as f64, process.memory(), total_mem)) + .map(|process| { + ( + process.cpu_usage() as f64, + process.memory(), + total_mem, + cpu_limit_cores(), + ) + }) }) .await .unwrap(); // first measurement - if let Some((cpu_usage, memory_bytes, total_mem)) = process_metrics { - record_process_metrics_sample(cpu_usage, memory_bytes, total_mem); + if let Some((cpu_usage, memory_bytes, total_mem, cpu_limit_cores)) = process_metrics { + record_process_metrics_sample(cpu_usage, memory_bytes, total_mem, cpu_limit_cores); } // Start servers diff --git a/src/metrics/mod.rs b/src/metrics/mod.rs index 367dc8793..063f78785 100644 --- a/src/metrics/mod.rs +++ b/src/metrics/mod.rs @@ -381,6 +381,17 @@ pub static PROCESS_CPU_USAGE_PERCENT_AVG: Lazy = Lazy::new(|| { .expect("metric can be created") }); +pub static PROCESS_CPU_LIMIT_CORES: Lazy = Lazy::new(|| { + Gauge::with_opts( + Opts::new( + "process_cpu_limit_cores", + "Cgroup CPU limit in cores, or available logical CPUs when cgroup limits are unavailable", + ) + .namespace(METRICS_NAMESPACE), + ) + .expect("metric can be created") +}); + pub static PROCESS_MEMORY_BYTES_AVG: Lazy = Lazy::new(|| { Gauge::with_opts( Opts::new( @@ -453,7 +464,12 @@ impl ProcessMetricsAccumulator { pub static PROCESS_METRICS_ACCUMULATOR: Lazy = Lazy::new(ProcessMetricsAccumulator::default); -pub fn record_process_metrics_sample(cpu_usage_percent: f64, memory_bytes: u64, total_mem: u64) { +pub fn record_process_metrics_sample( + cpu_usage_percent: f64, + memory_bytes: u64, + total_mem: u64, + cpu_limit_cores: f64, +) { if PROCESS_METRICS_INIT.get().is_none() { // first measurement let _ = PROCESS_METRICS_INIT.set((cpu_usage_percent, memory_bytes)); @@ -461,6 +477,7 @@ pub fn record_process_metrics_sample(cpu_usage_percent: f64, memory_bytes: u64, let (average_cpu_usage, average_memory_bytes) = PROCESS_METRICS_ACCUMULATOR.record(cpu_usage_percent, memory_bytes); PROCESS_CPU_USAGE_PERCENT_AVG.set(average_cpu_usage); + PROCESS_CPU_LIMIT_CORES.set(cpu_limit_cores); PROCESS_MEMORY_BYTES_AVG.set(average_memory_bytes); PROCESS_MEMORY_LIMIT_BYTES.set(total_mem as f64); } @@ -1037,6 +1054,9 @@ fn custom_metrics(registry: &Registry) { registry .register(Box::new(PROCESS_CPU_USAGE_PERCENT_AVG.clone())) .expect("metric can be registered"); + registry + .register(Box::new(PROCESS_CPU_LIMIT_CORES.clone())) + .expect("metric can be registered"); registry .register(Box::new(PROCESS_MEMORY_BYTES_AVG.clone())) .expect("metric can be registered"); From d0ed8efe80bac2b9fee6761e70d2df1bb1b5808b Mon Sep 17 00:00:00 2001 From: Pratik Jadhav Date: Mon, 28 Sep 2026 14:45:38 +0530 Subject: [PATCH 2/4] fix: resolve CPU limit from process cgroup --- Cargo.lock | 1 + Cargo.toml | 3 ++ src/handlers/http/resource_check.rs | 76 +++++++++++++++++++++-------- 3 files changed, 60 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bc8db37ae..4d64aed4b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4666,6 +4666,7 @@ dependencies = [ "parking_lot", "parquet", "path-clean", + "procfs", "prometheus", "prometheus-parse", "prost 0.13.5", diff --git a/Cargo.toml b/Cargo.toml index cf5052937..be0a3012c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -220,6 +220,9 @@ vergen-gitcl = { version = "9.1.0", features = [ zip = { version = "8.6.0", default-features = false, features = ["deflate"] } anyhow = "1.0" +[target.'cfg(target_os = "linux")'.dependencies] +procfs = { version = "0.16.0", default-features = false } + [dev-dependencies] rstest = "0.26.1" arrow = "59.2.0" diff --git a/src/handlers/http/resource_check.rs b/src/handlers/http/resource_check.rs index 1fa44488d..4f14de616 100644 --- a/src/handlers/http/resource_check.rs +++ b/src/handlers/http/resource_check.rs @@ -16,10 +16,9 @@ * */ -use std::{ - fs, - sync::{Arc, LazyLock, atomic::AtomicBool}, -}; +#[cfg(target_os = "linux")] +use std::path::{Path, PathBuf}; +use std::sync::{Arc, LazyLock, atomic::AtomicBool}; use actix_web::{ body::MessageBody, @@ -40,32 +39,69 @@ use crate::metrics::{record_disk_metrics, record_process_metrics_sample}; use crate::parseable::PARSEABLE; const PROCESS_METRICS_SAMPLE_INTERVAL: Duration = Duration::from_secs(5); -const CGROUP_V2_CPU_MAX_PATH: &str = "/sys/fs/cgroup/cpu.max"; -const CGROUP_V1_CPU_QUOTA_PATH: &str = "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"; -const CGROUP_V1_CPU_PERIOD_PATH: &str = "/sys/fs/cgroup/cpu/cpu.cfs_period_us"; +#[cfg(target_os = "linux")] +const CGROUP_V2_CPU_MAX_FILE: &str = "cpu.max"; +#[cfg(target_os = "linux")] +const CGROUP_V1_CPU_QUOTA_FILE: &str = "cpu.cfs_quota_us"; +#[cfg(target_os = "linux")] +const CGROUP_V1_CPU_PERIOD_FILE: &str = "cpu.cfs_period_us"; static SERVER_OK: LazyLock> = LazyLock::new(|| Arc::new(AtomicBool::new(true))); +#[cfg(target_os = "linux")] fn cpu_quota_cores(quota: &str, period: &str) -> Option { let quota = quota.trim().parse::().ok()?; let period = period.trim().parse::().ok()?; (quota > 0.0 && period > 0.0).then_some(quota / period) } +#[cfg(target_os = "linux")] +fn cgroup_directory(pathname: &str, root: &str, mount_point: &Path) -> Option { + let pathname = Path::new(pathname); + if pathname == Path::new("/") { + return Some(mount_point.to_path_buf()); + } + Some(mount_point.join(pathname.strip_prefix(root).ok()?)) +} + +#[cfg(target_os = "linux")] +fn cgroup_cpu_limit_cores() -> Option { + let process = procfs::process::Process::myself().ok()?; + let cgroups = process.cgroups().ok()?.0; + let mounts = process.mountinfo().ok()?.0; + + let v2_limit = || { + let cgroup = cgroups.iter().find(|group| group.controllers.is_empty())?; + let mount = mounts.iter().find(|mount| mount.fs_type == "cgroup2")?; + let directory = cgroup_directory(&cgroup.pathname, &mount.root, &mount.mount_point)?; + let cpu_max = std::fs::read_to_string(directory.join(CGROUP_V2_CPU_MAX_FILE)).ok()?; + let mut values = cpu_max.split_whitespace(); + cpu_quota_cores(values.next()?, values.next()?) + }; + + let v1_limit = || { + let cgroup = cgroups + .iter() + .find(|group| group.controllers.iter().any(|item| item == "cpu"))?; + let mount = mounts + .iter() + .find(|mount| mount.fs_type == "cgroup" && mount.super_options.contains_key("cpu"))?; + let directory = cgroup_directory(&cgroup.pathname, &mount.root, &mount.mount_point)?; + let quota = std::fs::read_to_string(directory.join(CGROUP_V1_CPU_QUOTA_FILE)).ok()?; + let period = std::fs::read_to_string(directory.join(CGROUP_V1_CPU_PERIOD_FILE)).ok()?; + cpu_quota_cores("a, &period) + }; + + v2_limit().or_else(v1_limit) +} + +#[cfg(not(target_os = "linux"))] +fn cgroup_cpu_limit_cores() -> Option { + None +} + pub fn cpu_limit_cores() -> f64 { - let cgroup_limit = fs::read_to_string(CGROUP_V2_CPU_MAX_PATH) - .ok() - .and_then(|cpu_max| { - let mut values = cpu_max.split_whitespace(); - cpu_quota_cores(values.next()?, values.next()?) - }) - .or_else(|| { - let quota = fs::read_to_string(CGROUP_V1_CPU_QUOTA_PATH).ok()?; - let period = fs::read_to_string(CGROUP_V1_CPU_PERIOD_PATH).ok()?; - cpu_quota_cores("a, &period) - }); - - cgroup_limit.unwrap_or_else(|| { + cgroup_cpu_limit_cores().unwrap_or_else(|| { std::thread::available_parallelism() .map(|count| count.get() as f64) .unwrap_or(1.0) From 3ba0d8b94fcf6efeb1d8ce28c8d7305c89cb86a9 Mon Sep 17 00:00:00 2001 From: Pratik Jadhav Date: Mon, 28 Sep 2026 15:33:24 +0530 Subject: [PATCH 3/4] fix: detect cgroup v2 CPU limits --- src/handlers/http/resource_check.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/handlers/http/resource_check.rs b/src/handlers/http/resource_check.rs index 4f14de616..f2222f13a 100644 --- a/src/handlers/http/resource_check.rs +++ b/src/handlers/http/resource_check.rs @@ -71,7 +71,7 @@ fn cgroup_cpu_limit_cores() -> Option { let mounts = process.mountinfo().ok()?.0; let v2_limit = || { - let cgroup = cgroups.iter().find(|group| group.controllers.is_empty())?; + let cgroup = cgroups.iter().find(|group| group.hierarchy == 0)?; let mount = mounts.iter().find(|mount| mount.fs_type == "cgroup2")?; let directory = cgroup_directory(&cgroup.pathname, &mount.root, &mount.mount_point)?; let cpu_max = std::fs::read_to_string(directory.join(CGROUP_V2_CPU_MAX_FILE)).ok()?; @@ -101,11 +101,7 @@ fn cgroup_cpu_limit_cores() -> Option { } pub fn cpu_limit_cores() -> f64 { - cgroup_cpu_limit_cores().unwrap_or_else(|| { - std::thread::available_parallelism() - .map(|count| count.get() as f64) - .unwrap_or(1.0) - }) + cgroup_cpu_limit_cores().unwrap_or(0.0) } async fn sample_process_metrics() { From e86c994c211749bdea3b3fb67a2dd345bbcc410a Mon Sep 17 00:00:00 2001 From: Pratik Jadhav Date: Tue, 29 Sep 2026 15:46:54 +0530 Subject: [PATCH 4/4] fix: update CPU metrics and remove slow query tracking --- Cargo.lock | 27 ++++++- Cargo.toml | 2 +- src/handlers/http/query.rs | 30 +------ src/metrics/mod.rs | 159 +------------------------------------ 4 files changed, 31 insertions(+), 187 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4d64aed4b..8417c9a29 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4666,7 +4666,7 @@ dependencies = [ "parking_lot", "parquet", "path-clean", - "procfs", + "procfs 0.18.0", "prometheus", "prometheus-parse", "prost 0.13.5", @@ -4936,10 +4936,21 @@ dependencies = [ "bitflags 2.10.0", "hex", "lazy_static", - "procfs-core", + "procfs-core 0.16.0", "rustix 0.38.44", ] +[[package]] +name = "procfs" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25485360a54d6861439d60facef26de713b1e126bf015ec8f98239467a2b82f7" +dependencies = [ + "bitflags 2.10.0", + "procfs-core 0.18.0", + "rustix 1.1.3", +] + [[package]] name = "procfs-core" version = "0.16.0" @@ -4950,6 +4961,16 @@ dependencies = [ "hex", ] +[[package]] +name = "procfs-core" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6401bf7b6af22f78b563665d15a22e9aef27775b79b149a66ca022468a4e405" +dependencies = [ + "bitflags 2.10.0", + "hex", +] + [[package]] name = "prometheus" version = "0.13.4" @@ -4962,7 +4983,7 @@ dependencies = [ "libc", "memchr", "parking_lot", - "procfs", + "procfs 0.16.0", "thiserror 1.0.69", ] diff --git a/Cargo.toml b/Cargo.toml index be0a3012c..39d649c41 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -221,7 +221,7 @@ zip = { version = "8.6.0", default-features = false, features = ["deflate"] } anyhow = "1.0" [target.'cfg(target_os = "linux")'.dependencies] -procfs = { version = "0.16.0", default-features = false } +procfs = { version = "0.18.0", default-features = false } [dev-dependencies] rstest = "0.26.1" diff --git a/src/handlers/http/query.rs b/src/handlers/http/query.rs index c572a51e0..bdfe3b6ef 100644 --- a/src/handlers/http/query.rs +++ b/src/handlers/http/query.rs @@ -46,9 +46,7 @@ use tokio::task::JoinSet; use tracing::{error, warn}; use crate::event::{DEFAULT_TIMESTAMP_KEY, commit_schema}; -use crate::metrics::{ - QUERY_EXECUTE_TIME, QueryType, increment_query_calls_by_date, record_query_metrics, -}; +use crate::metrics::{QUERY_EXECUTE_TIME, increment_query_calls_by_date}; use crate::parseable::{DEFAULT_TENANT, PARSEABLE, StreamNotFound}; use crate::query::error::ExecuteError; use crate::query::resolve_stream_names; @@ -160,8 +158,6 @@ pub async fn query(req: HttpRequest, query_request: Query) -> Result Result, ) -> Result { let counts_req = CountsRequest { @@ -270,7 +249,6 @@ async fn handle_count_query( QUERY_EXECUTE_TIME .with_label_values(&[table_name, tenant_id.as_deref().unwrap_or(DEFAULT_TENANT)]) .observe(time); - record_query_metrics(time, query_range_seconds, QueryType::Sql); Ok(HttpResponse::Ok() .insert_header((TIME_ELAPSED_HEADER, total_time.as_str())) @@ -296,7 +274,6 @@ async fn handle_non_streaming_query( table_name: Vec, query_request: &Query, time: Instant, - query_range_seconds: f64, tenant_id: &Option, ) -> Result { let first_table_name = table_name[0].clone(); @@ -318,7 +295,6 @@ async fn handle_non_streaming_query( tenant_id.as_deref().unwrap_or(DEFAULT_TENANT), ]) .observe(time); - record_query_metrics(time, query_range_seconds, QueryType::Sql); let response = QueryResponse { records, fields, diff --git a/src/metrics/mod.rs b/src/metrics/mod.rs index 063f78785..8283caea0 100644 --- a/src/metrics/mod.rs +++ b/src/metrics/mod.rs @@ -17,10 +17,7 @@ */ pub mod prom_utils; -use std::{ - path::Path, - sync::{Mutex, OnceLock}, -}; +use std::{path::Path, sync::OnceLock}; use crate::{ handlers::{TelemetryType, http::metrics_path}, @@ -42,145 +39,10 @@ const SYNC_TASK_DURATION_BUCKETS: &[f64] = &[ 15.0, 30.0, 45.0, 60.0, 90.0, 120.0, 150.0, 180.0, 300.0, 600.0, ]; -const QUERY_EXECUTE_TIME_BUCKETS: &[f64] = &[ +pub const QUERY_EXECUTE_TIME_BUCKETS: &[f64] = &[ 0.1, 0.2, 0.5, 1.0, 5.0, 15.0, 30.0, 45.0, 60.0, 90.0, 120.0, 150.0, 180.0, ]; -#[derive(Debug, PartialEq)] -pub enum QueryType { - Sql, - Promql, -} - -impl QueryType { - fn as_label(&self) -> &'static str { - match self { - Self::Sql => "SQL", - Self::Promql => "PromQL", - } - } -} - -#[derive(Debug, PartialEq)] -struct QueryMetricsSnapshot { - duration_seconds: f64, - time_range_seconds: f64, - query_type: QueryType, -} - -#[derive(Default)] -struct QueryMetricsAccumulator { - slowest_query: Mutex>, -} - -impl QueryMetricsAccumulator { - fn record(&self, duration_seconds: f64, time_range_seconds: f64, query_type: QueryType) { - let mut slowest_query = self - .slowest_query - .lock() - .expect("query metrics window lock should not be poisoned"); - - if slowest_query - .as_ref() - .is_none_or(|query| duration_seconds > query.duration_seconds) - { - *slowest_query = Some(QueryMetricsSnapshot { - duration_seconds, - time_range_seconds, - query_type, - }); - } - } - - fn take_and_reset(&self) -> Option { - let mut slowest_query = self - .slowest_query - .lock() - .expect("query metrics window lock should not be poisoned"); - slowest_query.take() - } -} - -static QUERY_METRICS_ACCUMULATOR: Lazy = - Lazy::new(QueryMetricsAccumulator::default); - -pub fn record_query_metrics(duration_seconds: f64, time_range_seconds: f64, query_type: QueryType) { - QUERY_METRICS_ACCUMULATOR.record(duration_seconds, time_range_seconds, query_type); -} - -pub fn refresh_query_metrics() { - let snapshot = QUERY_METRICS_ACCUMULATOR.take_and_reset(); - SLOWEST_QUERY_DURATION_SECONDS.reset(); - - if let Some(snapshot) = snapshot { - SLOWEST_QUERY_DURATION_SECONDS - .with_label_values(&[ - &snapshot.time_range_seconds.to_string(), - snapshot.query_type.as_label(), - ]) - .set(snapshot.duration_seconds); - } -} - -#[cfg(test)] -mod query_metrics_tests { - use prometheus::core::Collector; - - use super::{ - METRICS_NAMESPACE, METRICS_REGISTRY, QueryMetricsAccumulator, QueryMetricsSnapshot, - QueryType, SLOWEST_QUERY_DURATION_SECONDS, record_query_metrics, refresh_query_metrics, - }; - - #[test] - fn tracks_slowest_query_and_resets_after_snapshot() { - let accumulator = QueryMetricsAccumulator::default(); - - accumulator.record(20.0, 600.0, QueryType::Sql); - accumulator.record(70.0, 7_200.0, QueryType::Promql); - accumulator.record(65.0, 300.0, QueryType::Sql); - - assert_eq!( - accumulator.take_and_reset(), - Some(QueryMetricsSnapshot { - duration_seconds: 70.0, - time_range_seconds: 7_200.0, - query_type: QueryType::Promql, - }) - ); - assert_eq!(accumulator.take_and_reset(), None); - } - - #[test] - fn refreshes_gauges_and_clears_previous_window() { - record_query_metrics(20.0, 600.0, QueryType::Sql); - record_query_metrics(70.0, 7_200.0, QueryType::Promql); - refresh_query_metrics(); - - assert_eq!( - SLOWEST_QUERY_DURATION_SECONDS - .with_label_values(&["7200", "PromQL"]) - .get(), - 70.0 - ); - let metric_name = format!("{METRICS_NAMESPACE}_slowest_query_duration_seconds"); - assert!( - METRICS_REGISTRY - .gather() - .iter() - .any(|family| family.get_name() == metric_name) - ); - - refresh_query_metrics(); - - assert!( - SLOWEST_QUERY_DURATION_SECONDS - .collect() - .iter() - .all(|family| family.get_metric().is_empty()) - ); - } -} - pub static METRICS_REGISTRY: Lazy = Lazy::new(|| { let registry = Registry::new(); custom_metrics(®istry); @@ -385,7 +247,7 @@ pub static PROCESS_CPU_LIMIT_CORES: Lazy = Lazy::new(|| { Gauge::with_opts( Opts::new( "process_cpu_limit_cores", - "Cgroup CPU limit in cores, or available logical CPUs when cgroup limits are unavailable", + "Cgroup CPU limit in cores, or zero when unavailable", ) .namespace(METRICS_NAMESPACE), ) @@ -509,18 +371,6 @@ pub static QUERY_EXECUTE_TIME: Lazy = Lazy::new(|| { .expect("metric can be created") }); -pub static SLOWEST_QUERY_DURATION_SECONDS: Lazy = Lazy::new(|| { - GaugeVec::new( - Opts::new( - "slowest_query_duration_seconds", - "Duration of the slowest query completed in the latest query metrics interval", - ) - .namespace(METRICS_NAMESPACE), - &["time_range_seconds", "query_type"], - ) - .expect("metric can be created") -}); - pub static CONVERSION_TASK_DURATION: Lazy = Lazy::new(|| { HistogramVec::new( HistogramOpts::new( @@ -1066,9 +916,6 @@ fn custom_metrics(registry: &Registry) { registry .register(Box::new(QUERY_EXECUTE_TIME.clone())) .expect("metric can be registered"); - registry - .register(Box::new(SLOWEST_QUERY_DURATION_SECONDS.clone())) - .expect("metric can be registered"); registry .register(Box::new(CONVERSION_TASK_DURATION.clone())) .expect("metric can be registered");