GeezerVison is showing github.com — Rust: add verbosity and flamegraph as extractor options · github/codeql@18cf39d
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: rust/codeql-extractor.yml +24Lines changed: 24 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -54,3 +54,27 @@ options: | 54 | 54 | Comma-separated list of cfg settings to enable, or disable if prefixed with `-`. | 55 | 55 | Can be repeated. | 56 | 56 | type: array | | 57 | + logging: | | 58 | + title: Options pertaining to logging. | | 59 | + type: object | | 60 | + properties: | | 61 | + verbosity: | | 62 | + title: Extractor logging verbosity level. | | 63 | + description: > | | 64 | + Controls the level of verbosity of the extractor. | | 65 | + The supported levels are (in order of increasing verbosity): | | 66 | + - off | | 67 | + - errors | | 68 | + - warnings | | 69 | + - info or progress | | 70 | + - debug or progress+ | | 71 | + - trace or progress++ | | 72 | + - progress+++ | | 73 | + type: string | | 74 | + pattern: "^(off|errors|warnings|(info|progress)|(debug|progress\\+)|(trace|progress\\+\\+)|progress\\+\\+\\+)$" | | 75 | + flamegraph: | | 76 | + title: "[Experimental] File path for write flame graph log" | | 77 | + description: > | | 78 | + Collect flame graph data using the `tracing-flame` crate. To render a flame graph | | 79 | + or chart, run the `inferno-flamegraph` command. See also: https://crates.io/crates/tracing-flame | | 80 | + type: string |
Collapse file Copy file name to clipboardExpand all lines: rust/extractor/src/config.rs +9-3Lines changed: 9 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -50,8 +50,8 @@ pub struct Config { | 50 | 50 | pub cargo_target: Option<String>, | 51 | 51 | pub cargo_features: Vec<String>, | 52 | 52 | pub cargo_cfg_overrides: Vec<String>, | 53 | | - pub flame_log: Option<PathBuf>, | 54 | | - pub verbosity: Option<String>, | | 53 | + pub logging_flamegraph: Option<PathBuf>, | | 54 | + pub logging_verbosity: Option<String>, | 55 | 55 | pub compression: Compression, | 56 | 56 | pub inputs: Vec<PathBuf>, | 57 | 57 | pub qltest: bool, | @@ -65,7 +65,13 @@ impl Config { | 65 | 65 | .context("expanding parameter files")?; | 66 | 66 | let cli_args = CliConfig::parse_from(args); | 67 | 67 | let mut figment = Figment::new() | 68 | | - .merge(Env::prefixed("CODEQL_")) | | 68 | + .merge(Env::raw().filter_map(|f| { | | 69 | + if f.eq("CODEQL_VERBOSITY") { | | 70 | + Some("LOGGING_VERBOSITY".into()) | | 71 | + } else { | | 72 | + None | | 73 | + } | | 74 | + })) | 69 | 75 | .merge(Env::prefixed("CODEQL_EXTRACTOR_RUST_")) | 70 | 76 | .merge(Env::prefixed("CODEQL_EXTRACTOR_RUST_OPTION_")) | 71 | 77 | .merge(Serialized::defaults(cli_args)); | |
Collapse file Copy file name to clipboardExpand all lines: rust/extractor/src/main.rs +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -186,7 +186,7 @@ fn main() -> anyhow::Result<()> { | 186 | 186 | qltest::prepare(&mut cfg)?; | 187 | 187 | } | 188 | 188 | let start = Instant::now(); | 189 | | - let (flame_layer, _flush_guard) = if let Some(path) = &cfg.flame_log { | | 189 | + let (flame_layer, _flush_guard) = if let Some(path) = &cfg.logging_flamegraph { | 190 | 190 | tracing_flame::FlameLayer::with_file(path) | 191 | 191 | .ok() | 192 | 192 | .map(|(a, b)| (Some(a), Some(b))) | @@ -198,7 +198,7 @@ fn main() -> anyhow::Result<()> { | 198 | 198 | tracing_subscriber::registry() | 199 | 199 | .with(codeql_extractor::extractor::default_subscriber_with_level( | 200 | 200 | "single_arch", | 201 | | - &cfg.verbosity, | | 201 | + &cfg.logging_verbosity, | 202 | 202 | )) | 203 | 203 | .with(flame_layer) | 204 | 204 | .init(); | |
|