Skip to content

Commit

Permalink
logs: faster and more correct JSON format (#1071)
Browse files Browse the repository at this point in the history
  • Loading branch information
howardjohn authored May 17, 2024
1 parent 2f9b1e5 commit 2d41d21
Show file tree
Hide file tree
Showing 7 changed files with 251 additions and 28 deletions.
23 changes: 23 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ h2 = "0.4.5"
http = "1.1"
split-iter = "0.1"
arcstr = { version = "1.1", features = ["serde"] }
tracing-core = "0.1.32"
tracing-appender = "0.2.3"

[target.'cfg(target_os = "linux")'.dependencies]
netns-rs = "0.1"
Expand Down
23 changes: 23 additions & 0 deletions fuzz/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 src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
pub static malloc_conf: &[u8] = b"prof:true,prof_active:true,lg_prof_sample:19\0";

fn main() -> anyhow::Result<()> {
telemetry::setup_logging();
let _log_flush = telemetry::setup_logging();
let config = Arc::new(config::parse_config()?);

// For now we don't need a complex CLI, so rather than pull in dependencies just use basic argv[1]
Expand Down
7 changes: 4 additions & 3 deletions src/proxy/outbound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,17 @@ impl Outbound {
stream.set_nodelay(true).unwrap();
let span = info_span!("outbound", id=%oc.id);
let serve_outbound_connection = (async move {
debug!(dur=?start_outbound_instant.elapsed(), id=%oc.id, "outbound spawn START");
debug!(dur=?start_outbound_instant.elapsed(), "outbound spawn START");
// Since this task is spawned, make sure we are guaranteed to terminate
tokio::select! {
_ = outbound_drain.signaled() => {
debug!("outbound drain signaled");
}
_ = oc.proxy(stream) => {}
}
debug!(dur=?start_outbound_instant.elapsed(), id=%oc.id, "outbound spawn DONE");
}).instrument(span);
debug!(dur=?start_outbound_instant.elapsed(), "outbound spawn DONE");
})
.instrument(span);

assertions::size_between_ref(1000, 1750, &serve_outbound_connection);
tokio::spawn(serve_outbound_connection);
Expand Down
Loading

0 comments on commit 2d41d21

Please sign in to comment.