@@ -5,8 +5,17 @@ use std::path::PathBuf;
55#[ derive( Parser , Debug ) ]
66#[ command( name = "asap-planner" , about = "ASAP Query Planner" ) ]
77struct Args {
8- #[ arg( long = "input_config" ) ]
9- input_config : PathBuf ,
8+ /// Path to a hand-authored YAML workload config. Mutually exclusive with --query-log.
9+ #[ arg( long = "input_config" , conflicts_with = "query_log" ) ]
10+ input_config : Option < PathBuf > ,
11+
12+ /// Path to a Prometheus query log file (newline-delimited JSON). Mutually exclusive with --input_config.
13+ #[ arg( long = "query-log" , conflicts_with = "input_config" ) ]
14+ query_log : Option < PathBuf > ,
15+
16+ /// Path to a metrics config YAML (required when using --query-log).
17+ #[ arg( long = "metrics-config" , requires = "query_log" ) ]
18+ metrics_config : Option < PathBuf > ,
1019
1120 #[ arg( long = "output_dir" ) ]
1221 output_dir : PathBuf ,
@@ -60,9 +69,18 @@ fn main() -> anyhow::Result<()> {
6069 step : args. step ,
6170 } ;
6271
63- let controller = Controller :: from_file ( & args. input_config , opts) ?;
64- controller. generate_to_dir ( & args. output_dir ) ?;
72+ let controller = match ( args. input_config , args. query_log ) {
73+ ( Some ( config_path) , None ) => Controller :: from_file ( & config_path, opts) ?,
74+ ( None , Some ( log_path) ) => {
75+ let metrics_path = args
76+ . metrics_config
77+ . expect ( "--metrics-config is required when using --query-log" ) ;
78+ Controller :: from_query_log ( & log_path, & metrics_path, opts) ?
79+ }
80+ _ => anyhow:: bail!( "exactly one of --input_config or --query-log must be provided" ) ,
81+ } ;
6582
83+ controller. generate_to_dir ( & args. output_dir ) ?;
6684 println ! ( "Generated configs in {}" , args. output_dir. display( ) ) ;
6785 Ok ( ( ) )
6886}
0 commit comments