Skip to main content

torrust_metrics/
lib.rs

1pub mod counter;
2pub mod gauge;
3pub mod label;
4pub mod metric;
5pub mod metric_collection;
6pub mod prometheus;
7pub mod sample;
8pub mod sample_collection;
9pub mod unit;
10
11pub const METRICS_TARGET: &str = "METRICS";
12
13#[cfg(test)]
14mod tests {
15    /// It removes leading and trailing whitespace from each line.
16    pub fn format_prometheus_output(output: &str) -> String {
17        output
18            .lines()
19            .map(str::trim_start)
20            .map(str::trim_end)
21            .collect::<Vec<_>>()
22            .join("\n")
23    }
24
25    pub fn sort_lines(s: &str) -> String {
26        let mut lines: Vec<&str> = s.split('\n').collect();
27        lines.sort_unstable();
28        lines.join("\n")
29    }
30}