mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Rust: add verbosity and flamegraph as extractor options
This commit is contained in:
@@ -54,3 +54,27 @@ options:
|
|||||||
Comma-separated list of cfg settings to enable, or disable if prefixed with `-`.
|
Comma-separated list of cfg settings to enable, or disable if prefixed with `-`.
|
||||||
Can be repeated.
|
Can be repeated.
|
||||||
type: array
|
type: array
|
||||||
|
logging:
|
||||||
|
title: Options pertaining to logging.
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
verbosity:
|
||||||
|
title: Extractor logging verbosity level.
|
||||||
|
description: >
|
||||||
|
Controls the level of verbosity of the extractor.
|
||||||
|
The supported levels are (in order of increasing verbosity):
|
||||||
|
- off
|
||||||
|
- errors
|
||||||
|
- warnings
|
||||||
|
- info or progress
|
||||||
|
- debug or progress+
|
||||||
|
- trace or progress++
|
||||||
|
- progress+++
|
||||||
|
type: string
|
||||||
|
pattern: "^(off|errors|warnings|(info|progress)|(debug|progress\\+)|(trace|progress\\+\\+)|progress\\+\\+\\+)$"
|
||||||
|
flamegraph:
|
||||||
|
title: "[Experimental] File path for write flame graph log"
|
||||||
|
description: >
|
||||||
|
Collect flame graph data using the `tracing-flame` crate. To render a flame graph
|
||||||
|
or chart, run the `inferno-flamegraph` command. See also: https://crates.io/crates/tracing-flame
|
||||||
|
type: string
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ pub struct Config {
|
|||||||
pub cargo_target: Option<String>,
|
pub cargo_target: Option<String>,
|
||||||
pub cargo_features: Vec<String>,
|
pub cargo_features: Vec<String>,
|
||||||
pub cargo_cfg_overrides: Vec<String>,
|
pub cargo_cfg_overrides: Vec<String>,
|
||||||
pub flame_log: Option<PathBuf>,
|
pub logging_flamegraph: Option<PathBuf>,
|
||||||
pub verbosity: Option<String>,
|
pub logging_verbosity: Option<String>,
|
||||||
pub compression: Compression,
|
pub compression: Compression,
|
||||||
pub inputs: Vec<PathBuf>,
|
pub inputs: Vec<PathBuf>,
|
||||||
pub qltest: bool,
|
pub qltest: bool,
|
||||||
@@ -65,7 +65,13 @@ impl Config {
|
|||||||
.context("expanding parameter files")?;
|
.context("expanding parameter files")?;
|
||||||
let cli_args = CliConfig::parse_from(args);
|
let cli_args = CliConfig::parse_from(args);
|
||||||
let mut figment = Figment::new()
|
let mut figment = Figment::new()
|
||||||
.merge(Env::prefixed("CODEQL_"))
|
.merge(Env::raw().filter_map(|f| {
|
||||||
|
if f.eq("CODEQL_VERBOSITY") {
|
||||||
|
Some("LOGGING_VERBOSITY".into())
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}))
|
||||||
.merge(Env::prefixed("CODEQL_EXTRACTOR_RUST_"))
|
.merge(Env::prefixed("CODEQL_EXTRACTOR_RUST_"))
|
||||||
.merge(Env::prefixed("CODEQL_EXTRACTOR_RUST_OPTION_"))
|
.merge(Env::prefixed("CODEQL_EXTRACTOR_RUST_OPTION_"))
|
||||||
.merge(Serialized::defaults(cli_args));
|
.merge(Serialized::defaults(cli_args));
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ fn main() -> anyhow::Result<()> {
|
|||||||
qltest::prepare(&mut cfg)?;
|
qltest::prepare(&mut cfg)?;
|
||||||
}
|
}
|
||||||
let start = Instant::now();
|
let start = Instant::now();
|
||||||
let (flame_layer, _flush_guard) = if let Some(path) = &cfg.flame_log {
|
let (flame_layer, _flush_guard) = if let Some(path) = &cfg.logging_flamegraph {
|
||||||
tracing_flame::FlameLayer::with_file(path)
|
tracing_flame::FlameLayer::with_file(path)
|
||||||
.ok()
|
.ok()
|
||||||
.map(|(a, b)| (Some(a), Some(b)))
|
.map(|(a, b)| (Some(a), Some(b)))
|
||||||
@@ -198,7 +198,7 @@ fn main() -> anyhow::Result<()> {
|
|||||||
tracing_subscriber::registry()
|
tracing_subscriber::registry()
|
||||||
.with(codeql_extractor::extractor::default_subscriber_with_level(
|
.with(codeql_extractor::extractor::default_subscriber_with_level(
|
||||||
"single_arch",
|
"single_arch",
|
||||||
&cfg.verbosity,
|
&cfg.logging_verbosity,
|
||||||
))
|
))
|
||||||
.with(flame_layer)
|
.with(flame_layer)
|
||||||
.init();
|
.init();
|
||||||
|
|||||||
Reference in New Issue
Block a user