Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: pass Vec<SpanRecord> to Reporter::report() instead of &[SpanRecord] #25

Merged
merged 4 commits into from
Aug 12, 2024

Conversation

andylokandy
Copy link
Collaborator

@andylokandy andylokandy commented Aug 12, 2024

Closes #24

if spans.is_empty() {
return;
}

if let Err(err) = self.try_report(spans) {
if let Err(err) = self.try_report(&spans) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems not right

Copy link
Collaborator Author

@andylokandy andylokandy Aug 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's intended because a span may be consumed multiple times in jaeger udp reporter:

let batch_size = spans_per_batch.min(spans.len() - sent_spans);
let jaeger_spans = self.convert(&spans[sent_spans..sent_spans + batch_size]);
let bytes = self.serialize(jaeger_spans)?;
if bytes.len() >= MAX_UDP_PACKAGE_SIZE {
if batch_size <= 1 {
sent_spans += 1;
} else {
spans_per_batch /= 2;
}
continue;
}
self.socket.send_to(&bytes, self.agent_addr)?;
sent_spans += batch_size;

@andylokandy andylokandy merged commit aae4490 into fast:main Aug 12, 2024
10 checks passed
@andylokandy andylokandy deleted the dev5 branch August 12, 2024 17:43
This was referenced Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pass SpanRecords by reference in Reporter trait
2 participants