Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
Add llite statistics (#64)
Browse files Browse the repository at this point in the history
* Add llite statistics

* Add new snapshot

* Address comments

* fixed cargo fmt issues.

* Bump deps

Signed-off-by: Joe Grund <[email protected]>

---------

Signed-off-by: Joe Grund <[email protected]>
Co-authored-by: Andy Breuhan <[email protected]>
Co-authored-by: Joe Grund <[email protected]>
  • Loading branch information
3 people authored May 7, 2024
1 parent f942050 commit 44b440c
Show file tree
Hide file tree
Showing 16 changed files with 798 additions and 2,861 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ tracing = "0.1"
tracing-subscriber = "0.3"

[dev-dependencies]
include_dir = {version = "0.7", features = ["glob"]}
include_dir = {version = "0.7", features = ["glob"]}
insta = "1"

[profile.release]
Expand Down
28 changes: 28 additions & 0 deletions src/fixtures/valid/lustre-2-14-0/client/llite_client.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
memused=35721854085
memused_max=41220347397
lnet_memused=22228358
health_check=healthy
ldlm.services.ldlm_cbd.stats=
snapshot_time 1710759783.270541554 secs.nsecs
req_waittime 41083956 samples [usecs] 1 33890 255153949 6336801119
req_qdepth 41083956 samples [reqs] 0 7 429581 432557
req_active 41083956 samples [reqs] 1 14 53101359 86233965
req_timeout 41083956 samples [secs] 15 15 616259340 9243890100
reqbuf_avail 87745428 samples [bufs] 0 3 80539671 80656909
ldlm_bl_callback 41083956 samples [usecs] 1 1623 446351106 6062478214
llite.ai400x2-ff47bce9ca35d800.stats=
snapshot_time 1710759783.271040288 secs.nsecs
ioctl 114 samples [reqs]
open 35955554 samples [usecs] 0 172939 3393651645 8836730033307
close 35955554 samples [usecs] 63 194037 5402095148 11956065309788
readdir 60 samples [usecs] 0 2242 34741 52343869
getattr 35955647 samples [usecs] 0 85505 2317024138 904252691326
unlink 17977752 samples [usecs] 107 148413 3846291010 6948473454642
mkdir 17987059 samples [usecs] 104 1306648 23731812831 644644512447919
rmdir 17987079 samples [usecs] 95 1478009 37000527306 744761005599966
mknod 17977752 samples [usecs] 119 193901 4144162753 7852936850197
statfs 17864 samples [usecs] 0 88480 10257950 80137794724
setxattr 1 samples [usecs] 8760 8760 8760 76737600
inode_permission 629305628 samples [usecs] 0 147014 196719589 76130795547
opencount 35955576 samples [reqs] 1 2 40433335 49388853
openclosetime 17977772 samples [usecs] 34302 20804335332 4185265858629453 2084188699388296969
2 changes: 1 addition & 1 deletion src/ldlm/ldlm_service_parser.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 DDN. All rights reserved.
// Copyright (c) 2024 DDN. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.

Expand Down
8 changes: 5 additions & 3 deletions src/ldlm/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Copyright (c) 2023 DDN. All rights reserved.
// Copyright (c) 2024 DDN. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.

use crate::{base_parsers::period, Record};
use combine::{parser::char::string, ParseError, Parser, Stream};
use combine::{attempt, parser::char::string, ParseError, Parser, Stream};

mod ldlm_namespace_parser;
mod ldlm_service_parser;
Expand All @@ -22,5 +22,7 @@ where
I: Stream<Token = char>,
I::Error: ParseError<I::Token, I::Range, I::Position>,
{
(string(LDLM), period()).with(ldlm_namespace_parser::parse().or(ldlm_service_parser::parse()))
(attempt(string(LDLM)), period())
.with(ldlm_namespace_parser::parse().or(ldlm_service_parser::parse()))
.message("while parsing ldlm")
}
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ mod base_parsers;
pub(crate) mod brw_stats_parser;
pub mod error;
pub(crate) mod ldlm;
pub(crate) mod llite;
mod lnetctl_parser;
mod mds;
pub mod mgs;
Expand Down
90 changes: 90 additions & 0 deletions src/llite/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
// Copyright (c) 2024 DDN. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.

use crate::{
base_parsers::{param, period, target},
stats_parser::stats,
Param, Record, Stat, Target, TargetStats,
};
use combine::{parser::char::string, ParseError, Parser, Stream};

pub(crate) const LLITE: &str = "llite";
pub(crate) const STATS: &str = "stats";

pub(crate) fn params() -> Vec<String> {
[STATS]
.into_iter()
.map(|x| format!("{LLITE}.*.{x}"))
.collect()
}

fn target_name<I>() -> impl Parser<I, Output = Target>
where
I: Stream<Token = char>,
I::Error: ParseError<I::Token, I::Range, I::Position>,
{
(string(LLITE).skip(period()), target().skip(period()))
.map(|(_, x)| x)
.message("while parsing llite target_name")
}

enum LliteStat {
Stats(Vec<Stat>),
}

fn llite_stat<I>() -> impl Parser<I, Output = (Param, LliteStat)>
where
I: Stream<Token = char>,
I::Error: ParseError<I::Token, I::Range, I::Position>,
{
(param(STATS), stats().map(LliteStat::Stats)).message("while parsing llite_stat")
}

pub(crate) fn parse<I>() -> impl Parser<I, Output = Record>
where
I: Stream<Token = char>,
I::Error: ParseError<I::Token, I::Range, I::Position>,
{
(target_name(), llite_stat())
.map(|(target, (param, value))| match value {
LliteStat::Stats(stats) => TargetStats::Llite(crate::types::LliteStat {
target,
param,
stats,
}),
})
.map(Record::Target)
.message("while parsing llite")
}

#[cfg(test)]
mod tests {
use super::*;
use combine::many;
use insta::assert_debug_snapshot;

#[test]
fn test_parse() {
let x = r#"llite.ai400x2-ffff9440f1003000.stats=
snapshot_time 1689697369.331040915 secs.nsecs
ioctl 2 samples [reqs]
open 13812423 samples [usec] 1 725287 1027077752 8835364169944
close 13812423 samples [usec] 47 778498 1320315612 17542973849370
readdir 12 samples [usec] 0 4647 6715 22456295
getattr 14812440 samples [usec] 2 320411 1317584841 2110166912709
unlink 6906208 samples [usec] 117 749323 1386719680 23443327087798
mkdir 7906554 samples [usec] 104 1529199 20996782592 1837945636486522
rmdir 6939862 samples [usec] 95 646028 16617944601 635123583760591
mknod 6906208 samples [usec] 119 775827 1454511094 10119157242014
statfs 7 samples [usec] 147 197 1236 220284
inode_permission 251887103 samples [usec] 0 14235 178199279 1102415701
opencount 13812424 samples [reqs] 1 2 20718632 34531048
openclosetime 6906208 samples [usec] 2225920 34405427 163169641155255 11416538743473681487
"#;

let result: (Vec<_>, _) = many(parse()).parse(x).unwrap();

assert_debug_snapshot!(result)
}
}
Loading

0 comments on commit 44b440c

Please sign in to comment.