Skip to content

Commit

Permalink
check tag present
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeTeng2001 authored and h3remi7 committed Nov 20, 2024
1 parent dfe5e7d commit 838e932
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/sources/host_metrics/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ impl HostMetrics {

#[cfg(test)]
mod tests {
use crate::sources::host_metrics::tests::count_tag;

use super::super::{HostMetrics, HostMetricsConfig, MetricsBuffer};

#[tokio::test]
Expand All @@ -68,5 +70,10 @@ mod tests {
assert!(!metrics
.iter()
.any(|metric| !metric.name().starts_with("process_")));

// They should all have the required tag
assert_eq!(count_tag(&metrics, "pid"), metrics.len());
assert_eq!(count_tag(&metrics, "name"), metrics.len());
assert_eq!(count_tag(&metrics, "command"), metrics.len());
}
}

0 comments on commit 838e932

Please sign in to comment.