Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Andy Lok <[email protected]>
  • Loading branch information
andylokandy committed Jul 23, 2023
1 parent e20213c commit 876b103
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions minitrace-jaeger/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,12 @@ impl JaegerReporter {
}

fn try_report(&self, spans: &[SpanRecord]) -> Result<(), Box<dyn std::error::Error>> {
let jaeger_spans = self.convert(spans);
let bytes = self.serialize(jaeger_spans)?;
self.socket.send_to(&bytes, self.agent_addr)?;
// Report spans in small chunks to avoid exceeding the UDP package size limit.
for spans in spans.chunks(30) {
let jaeger_spans = self.convert(spans);
let bytes = self.serialize(jaeger_spans)?;
self.socket.send_to(&bytes, self.agent_addr)?;
}
Ok(())
}
}
Expand Down
2 changes: 1 addition & 1 deletion minitrace/src/collector/global_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use crate::util::spsc::{self};
use crate::util::CollectToken;

const COLLECT_LOOP_INTERVAL: Duration = Duration::from_millis(50);
const MAX_UNREPORTED_RECORDS: usize = 100_000;
const MAX_UNREPORTED_RECORDS: usize = 10_000;

static NEXT_COLLECT_ID: AtomicUsize = AtomicUsize::new(0);
static GLOBAL_COLLECTOR: Lazy<Mutex<GlobalCollector>> =
Expand Down

0 comments on commit 876b103

Please sign in to comment.