Skip to content

Commit

Permalink
reduces buffered lines limit to 8000
Browse files Browse the repository at this point in the history
  • Loading branch information
arya2 committed Sep 2, 2022
1 parent c51e172 commit 6d2d118
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions zebrad/src/components/tracing/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use tracing_subscriber::{
EnvFilter,
};

use tracing_appender::non_blocking::{NonBlocking, WorkerGuard};
use tracing_appender::non_blocking::{NonBlocking, NonBlockingBuilder, WorkerGuard};

use crate::{application::app_version, config::TracingSection};

Expand Down Expand Up @@ -47,9 +47,13 @@ impl Tracing {
let filter = config.filter.unwrap_or_else(|| "".to_string());
let flame_root = &config.flamegraph;

// By default, the built NonBlocking will be lossy with a line limit of 128_000, lines sent to the worker past
// this limit will be dropped without being written to stdout
let (non_blocking, _guard) = tracing_appender::non_blocking(std::io::stdout());
// Builds a lossy NonBlocking logger with a line limit of 8_000, lines sent to the worker past
// this limit (via the write method which sends it to a crossbeam::bounded channel)
// will be dropped without being written to stdout
let (non_blocking, _guard) = NonBlockingBuilder::default()
.lossy(true)
.buffered_lines_limit(8_000)
.finish(std::io::stdout());

// Only use color if tracing output is being sent to a terminal or if it was explicitly
// forced to.
Expand Down
2 changes: 1 addition & 1 deletion zebrad/tests/acceptance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1233,7 +1233,7 @@ async fn non_blocking_logger() -> Result<()> {
// Create an http client
let client = reqwest::Client::new();

for _ in 0..10_000 {
for _ in 0..20_000 {
let res = client
.post(format!("http://{}", &zebra_rpc_address))
.body(r#"{"jsonrpc":"1.0","method":"getinfo","params":[],"id":123}"#)
Expand Down

0 comments on commit 6d2d118

Please sign in to comment.