mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-29 08:27:06 +00:00
fix(obs): tighten low-risk telemetry correctness (#4483)
Refs rustfs/backlog#1007 Refs rustfs/backlog#986 - respect explicit log-target directives when injecting noisy-crate suppressions - fix daily rotation day-boundary checks and add a short retry cooldown after failed rotations - preserve recorder metadata across label variants and serialize gauge updates before export - correct profiling target_env reporting, trace all=true parsing, cleaner accounting/docs, and legacy system interval rounding Co-authored-by: heihutu <heihutu@gmail.com>
This commit is contained in:
@@ -93,13 +93,6 @@ impl ServiceTraceOpts {
|
||||
self.batch_replication = query_pairs.get("batch-replication").is_some_and(|v| v == "true");
|
||||
self.batch_key_rotation = query_pairs.get("batch-keyrotation").is_some_and(|v| v == "true");
|
||||
self.batch_expire = query_pairs.get("batch-expire").is_some_and(|v| v == "true");
|
||||
if query_pairs.get("all").is_some_and(|v| v == "true") {
|
||||
self.s3 = true;
|
||||
self.internal = true;
|
||||
self.storage = true;
|
||||
self.os = true;
|
||||
}
|
||||
|
||||
self.rebalance = query_pairs.get("rebalance").is_some_and(|v| v == "true");
|
||||
self.storage = query_pairs.get("storage").is_some_and(|v| v == "true");
|
||||
self.internal = query_pairs.get("internal").is_some_and(|v| v == "true");
|
||||
@@ -109,6 +102,13 @@ impl ServiceTraceOpts {
|
||||
self.ftp = query_pairs.get("ftp").is_some_and(|v| v == "true");
|
||||
self.ilm = query_pairs.get("ilm").is_some_and(|v| v == "true");
|
||||
|
||||
if query_pairs.get("all").is_some_and(|v| v == "true") {
|
||||
self.s3 = true;
|
||||
self.internal = true;
|
||||
self.storage = true;
|
||||
self.os = true;
|
||||
}
|
||||
|
||||
if let Some(threshold) = query_pairs.get("threshold") {
|
||||
let duration = parse_duration(threshold)?;
|
||||
self.threshold = duration;
|
||||
@@ -117,3 +117,22 @@ impl ServiceTraceOpts {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn parse_params_all_true_keeps_internal_and_storage_enabled() {
|
||||
let uri: Uri = "/trace?all=true".parse().expect("valid uri");
|
||||
let mut opts = ServiceTraceOpts::default();
|
||||
|
||||
opts.parse_params(&uri).expect("all=true should parse");
|
||||
let trace_types = opts.trace_types();
|
||||
|
||||
assert!(trace_types.contains(&TraceType::S3));
|
||||
assert!(trace_types.contains(&TraceType::INTERNAL));
|
||||
assert!(trace_types.contains(&TraceType::STORAGE));
|
||||
assert!(trace_types.contains(&TraceType::OS));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user