Skip to content

Commit

Permalink
Merge branch 'main' into feat/ethtool
Browse files Browse the repository at this point in the history
  • Loading branch information
mmynk authored Oct 10, 2023
2 parents 3edebbb + c264423 commit e818034
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 17 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion below/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ unit-name = "below"
unit-scripts = "../etc"

[dependencies]
anyhow = "1.0.71"
anyhow = "=1.0.72"
cgroupfs = { version = "0.7.1", path = "cgroupfs" }
clap = { version = "4.3.5", features = ["derive", "env", "string", "unicode", "wrap_help"] }
clap_complete = "4.3.1"
Expand Down
2 changes: 1 addition & 1 deletion below/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repository = "https://github.com/facebookincubator/below"
license = "Apache-2.0"

[dependencies]
anyhow = "1.0.71"
anyhow = "=1.0.72"
chrono = { version = "0.4", features = ["clock", "serde", "std"], default-features = false }
cursive = { version = "0.20.0", features = ["crossterm-backend"], default-features = false }
humantime = "2.1"
Expand Down
3 changes: 1 addition & 2 deletions below/config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ repository = "https://github.com/facebookincubator/below"
license = "Apache-2.0"

[dependencies]
anyhow = "1.0.71"
anyhow = "=1.0.72"
btrfs = { package = "below-btrfs", version = "0.7.1", path = "../btrfs" }
cgroupfs = { version = "0.7.1", path = "../cgroupfs" }
once_cell = "1.12"
serde = { version = "1.0.185", features = ["derive", "rc"] }
toml = "0.7.3"

Expand Down
4 changes: 2 additions & 2 deletions below/config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
use std::fs;
use std::path::Path;
use std::path::PathBuf;
use std::sync::OnceLock;

use anyhow::bail;
use anyhow::Result;
use once_cell::sync::OnceCell;
use serde::Deserialize;
use serde::Serialize;

Expand All @@ -30,7 +30,7 @@ const BELOW_DEFAULT_LOG: &str = "/var/log/below";
const BELOW_DEFAULT_STORE: &str = "/var/log/below/store";

/// Global below config
pub static BELOW_CONFIG: OnceCell<BelowConfig> = OnceCell::new();
pub static BELOW_CONFIG: OnceLock<BelowConfig> = OnceLock::new();

#[derive(Serialize, Deserialize, Debug)]
// If value is missing during deserialization, use the Default::default()
Expand Down
2 changes: 1 addition & 1 deletion below/dump/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repository = "https://github.com/facebookincubator/below"
license = "Apache-2.0"

[dependencies]
anyhow = "1.0.71"
anyhow = "=1.0.72"
below_derive = { version = "0.7.1", path = "../below_derive" }
clap = { version = "4.3.5", features = ["derive", "env", "string", "unicode", "wrap_help"] }
common = { package = "below-common", version = "0.7.1", path = "../common" }
Expand Down
32 changes: 26 additions & 6 deletions below/dump/src/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,32 @@ impl Dumper for System {
round: &mut usize,
comma_flag: bool,
) -> Result<IterExecResult> {
let mut fields = self.fields.clone();

if self.opts.detail || self.opts.everything {
// If detail is set, add per-cpu fields.
// The fields need to be added at runtime because we cannot know the number of CPUs in the model statically.
for key in model.system.cpus.keys() {
for subquery_id in
&enum_iterator::all::<model::SingleCpuModelFieldId>().collect::<Vec<_>>()
{
let value = subquery_id.clone();
fields.push(DumpField::FieldId(model::SystemModelFieldId::Cpus(
model::BTreeMapFieldId {
key: Some(*key),
subquery_id: value,
},
)));
}
}
}

match self.opts.output_format {
Some(OutputFormat::Raw) | None => write!(
output,
"{}",
print::dump_raw(
&self.fields,
&fields,
ctx,
&model.system,
*round,
Expand All @@ -55,7 +75,7 @@ impl Dumper for System {
output,
"{}",
print::dump_csv(
&self.fields,
&fields,
ctx,
&model.system,
*round,
Expand All @@ -67,7 +87,7 @@ impl Dumper for System {
output,
"{}",
print::dump_tsv(
&self.fields,
&fields,
ctx,
&model.system,
*round,
Expand All @@ -78,10 +98,10 @@ impl Dumper for System {
Some(OutputFormat::KeyVal) => write!(
output,
"{}",
print::dump_kv(&self.fields, ctx, &model.system, self.opts.raw)
print::dump_kv(&fields, ctx, &model.system, self.opts.raw)
)?,
Some(OutputFormat::Json) => {
let par = print::dump_json(&self.fields, ctx, &model.system, self.opts.raw);
let par = print::dump_json(&fields, ctx, &model.system, self.opts.raw);
if comma_flag {
write!(output, ",{}", par.to_string())?;
} else {
Expand All @@ -91,7 +111,7 @@ impl Dumper for System {
Some(OutputFormat::OpenMetrics) => write!(
output,
"{}",
print::dump_openmetrics(&self.fields, ctx, &model.system)
print::dump_openmetrics(&fields, ctx, &model.system)
)?,
};

Expand Down
2 changes: 1 addition & 1 deletion below/model/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repository = "https://github.com/facebookincubator/below"
license = "Apache-2.0"

[dependencies]
anyhow = "1.0.71"
anyhow = "=1.0.72"
async-trait = "0.1.71"
below_derive = { version = "0.7.1", path = "../below_derive" }
btrfs = { package = "below-btrfs", version = "0.7.1", path = "../btrfs" }
Expand Down
2 changes: 1 addition & 1 deletion below/store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repository = "https://github.com/facebookincubator/below"
license = "Apache-2.0"

[dependencies]
anyhow = "1.0.71"
anyhow = "=1.0.72"
bitflags = "1.3"
bytes = { version = "1.1", features = ["serde"] }
common = { package = "below-common", version = "0.7.1", path = "../common" }
Expand Down
2 changes: 1 addition & 1 deletion below/view/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repository = "https://github.com/facebookincubator/below"
license = "Apache-2.0"

[dependencies]
anyhow = "1.0.71"
anyhow = "=1.0.72"
chrono = { version = "0.4", features = ["clock", "serde", "std"], default-features = false }
common = { package = "below-common", version = "0.7.1", path = "../common" }
crossterm = { version = "0.27.0", features = ["event-stream"] }
Expand Down

0 comments on commit e818034

Please sign in to comment.