feat: Add tracing support#123
Conversation
| Ok(()) | ||
| } | ||
|
|
||
|
|
There was a problem hiding this comment.
Tssk, someone is removing all by formatting whitespace :P
|
I'm trying to check out how it looks like, but it seems like the output of BRANE_API_LOG=DEBUG ./target/release/branectl start centralor, to try and trigger your tracing error: BRANE_LOG=DaskjdhasdEBUG ./target/release/branectl start centralbut none of them seem to have any effect on Maybe there's something weird with caching here? |
4415bae to
c87372b
Compare
|
I forgot to remove an optimization that it would not generate an overlay if there were no hostname overrides. This did not fail for me before as I used to always set It should "work" now. Don't expect too much however, it is still very drafty. |
caf5d87 to
00003e7
Compare
00003e7 to
07df136
Compare
07df136 to
92567f7
Compare
| if log::max_level() == log::LevelFilter::Debug { | ||
| crate::traversals::print::ast::do_traversal(&workflow, std::io::stdout()).unwrap(); | ||
| } | ||
| // TODO: Implement tracing |
Check notice
Code scanning / devskim
A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note
| if let Err(err) = HumanLogger::terminal(DebugMode::Debug).init() { | ||
| eprintln!("WARNING: Failed to setup Rust logger: {err} (logging disabled for this session)"); | ||
| } | ||
| // TODO: Set up tracing |
Check notice
Code scanning / devskim
A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note
| args.node_config, | ||
| DockerOptions { socket: docker_socket, version: docker_version }, | ||
| StartOpts { compose_verbose: args.debug || args.trace, version, image_dir, local_aux, skip_import, profile_dir }, | ||
| // FIXME: Drop compose verbose? |
Check notice
Code scanning / devskim
A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note
| }, | ||
| CtlSubcommand::Stop { exe, file } => { | ||
| if let Err(err) = lifetime::stop(args.debug || args.trace, exe, file, args.node_config) { | ||
| // FIXME: Drop compose verbose? |
Check notice
Code scanning / devskim
A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note
| }, | ||
| CtlSubcommand::Logs { exe, file } => { | ||
| if let Err(err) = lifetime::logs(exe, file, args.node_config, LogsOpts { compose_verbose: args.debug || args.trace }).await { | ||
| // FIXME: Drop compose verbose? |
Check notice
Code scanning / devskim
A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note
| #[derive(Parser)] | ||
| #[clap(version = env!("CARGO_PKG_VERSION"))] | ||
| struct Opts { | ||
| #[clap(short, long, default_value = "127.0.0.1:8081", env = "ADDRESS")] |
Check notice
Code scanning / devskim
Accessing localhost could indicate debug code, or could hinder scaling. Note
| /// Service address | ||
| address: String, | ||
| /// Scylla endpoint | ||
| #[clap(short, long, default_value = "127.0.0.1", env = "SCYLLA")] |
Check notice
Code scanning / devskim
Accessing localhost could indicate debug code, or could hinder scaling. Note
| #[clap(short, long, default_value = "127.0.0.1", env = "SCYLLA")] | ||
| scylla: String, | ||
| /// Kafka brokers | ||
| #[clap(short, long, default_value = "127.0.0.1:9092", env = "BROKERS")] |
Check notice
Code scanning / devskim
Accessing localhost could indicate debug code, or could hinder scaling. Note
| })) | ||
| .map(|reply| { | ||
| // TODO#584: remove this workaround | ||
| warp::reply::with_header(reply, "Sec-WebSocket-Protocol", "graphql-ws") |
Check notice
Code scanning / devskim
A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note
| eprintln!("WARNING: Failed to setup test logger: {err} (no logging for this session)"); | ||
| } | ||
| } | ||
| // TODO: Set up tracing subscriber |
Check notice
Code scanning / devskim
A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note
92567f7 to
163f771
Compare
This uses the `tracing_subscriber` with `EnvFilter` to get log levels that can be set using environment variables. This also enables `branectl` to translate a set of environment variables so that every container can get a specific log level set at start
This guard clause was a correct optimization before we set loglevels via overrides
163f771 to
0e4dfec
Compare
Codecov ReportAttention: Patch coverage is 📢 Thoughts on this report? Let us know! |
0e4dfec to
b230403
Compare
b230403 to
13d724d
Compare
This uses the
tracing_subscriberwithEnvFilterto get log levels that can be set using environment variables.This also enables
branectlto translate a set of environment variables so that every container can get a specific log level set at startThis currently only changes the logging for the brane-api crate as an indication what this would look like.
I am not entirely happy with my solution for the env var translation in branectl, but it is good enough for a draft right now.
@Lut99, what do you think?
Marking this PR as a draft until we hash out how we want to do this, and until all workspace members have been converted.
Fixes: #116